Instructions to use TheBloke/Llama-2-70B-Chat-GPTQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TheBloke/Llama-2-70B-Chat-GPTQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TheBloke/Llama-2-70B-Chat-GPTQ")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TheBloke/Llama-2-70B-Chat-GPTQ") model = AutoModelForCausalLM.from_pretrained("TheBloke/Llama-2-70B-Chat-GPTQ", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TheBloke/Llama-2-70B-Chat-GPTQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TheBloke/Llama-2-70B-Chat-GPTQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheBloke/Llama-2-70B-Chat-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TheBloke/Llama-2-70B-Chat-GPTQ
- SGLang
How to use TheBloke/Llama-2-70B-Chat-GPTQ with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "TheBloke/Llama-2-70B-Chat-GPTQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheBloke/Llama-2-70B-Chat-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "TheBloke/Llama-2-70B-Chat-GPTQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TheBloke/Llama-2-70B-Chat-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TheBloke/Llama-2-70B-Chat-GPTQ with Docker Model Runner:
docker model run hf.co/TheBloke/Llama-2-70B-Chat-GPTQ
Inference time with TGI
Thanks for posting this model, I was able to run inference with TGI on a single 40 GB A100 with the following command:
docker run \
-p 8080:80 \
-e GPTQ_BITS=4 \
-e GPTQ_GROUPSIZE=1 \
--gpus all \
--shm-size 5g \
-v $volume:/data ghcr.io/huggingface/text-generation-inference:latest \
--model-id TheBloke/Llama-2-70B-chat-GPTQ \
--max-input-length 4096 \
--max-total-tokens 8192 \
--quantize gptq \
--sharded false
This was able to generate a response at 225ms/token. However, when running the unquantized model sharded across 4 A100s I was able to get around 45ms/token. Am I missing a config or environment variable that would improve the inference time or is this expected behavior with this quantization?
I get the same number of latency (>100ms/ toekn) with half the length for input and total_tokens. It even slower than using quantization with bitsandbytes-nf4 (~51 ms/token).
This is weird as it is said that gptq is faster for inference than bitsandbytes.
...