Instructions to use TheBloke/CodeLlama-34B-Instruct-GPTQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TheBloke/CodeLlama-34B-Instruct-GPTQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TheBloke/CodeLlama-34B-Instruct-GPTQ", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TheBloke/CodeLlama-34B-Instruct-GPTQ", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("TheBloke/CodeLlama-34B-Instruct-GPTQ", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use TheBloke/CodeLlama-34B-Instruct-GPTQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TheBloke/CodeLlama-34B-Instruct-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/CodeLlama-34B-Instruct-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TheBloke/CodeLlama-34B-Instruct-GPTQ
- SGLang
How to use TheBloke/CodeLlama-34B-Instruct-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/CodeLlama-34B-Instruct-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/CodeLlama-34B-Instruct-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/CodeLlama-34B-Instruct-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/CodeLlama-34B-Instruct-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TheBloke/CodeLlama-34B-Instruct-GPTQ with Docker Model Runner:
docker model run hf.co/TheBloke/CodeLlama-34B-Instruct-GPTQ
Is the 34B llama2 actually GPTQ working?
Somehow I keep getting an error for the fused llama attention.
/auto_gptq/nn_modules/fused_llama_attn.py", line 59, in forward
query_states, key_states, value_states = torch.split(qkv_states, self.hidden_size, dim=2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It seems that qkv_states doesn't match
Shape of qkv_states: torch.Size([1, 62, 10240])
Expected third dimension size: 24576
Actual third dimension size: 10240
Value of self.hidden_size: 8192
@giblesnot, thanks mate, I was using AutoGPTQ to load the model. I will try the Exllama.
same here when running not in oogabooga. i am using the code for running it with AutoGPTQForCausalLM from huggingface and it's failing with the same error. please help.
If using AutoGPTQ, please pass inject_fused_attention=False.
The issue is that Llama 2 70B and 34B introduced a new optimisation called GQA (Ghost Query Attention) which is not supported by AutoGPTQ's Fused Attention optimisation.
This issue will be fixed in AutoGPTQ fairly soon, hopefully: https://github.com/PanQiWei/AutoGPTQ/pull/237

