Instructions to use TheBloke/CodeLlama-34B-GPTQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TheBloke/CodeLlama-34B-GPTQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TheBloke/CodeLlama-34B-GPTQ", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TheBloke/CodeLlama-34B-GPTQ", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("TheBloke/CodeLlama-34B-GPTQ", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use TheBloke/CodeLlama-34B-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-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-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TheBloke/CodeLlama-34B-GPTQ
- SGLang
How to use TheBloke/CodeLlama-34B-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-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-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-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-GPTQ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TheBloke/CodeLlama-34B-GPTQ with Docker Model Runner:
docker model run hf.co/TheBloke/CodeLlama-34B-GPTQ
This model breaks laws of physic.
I have no clue how to explain this situation:
This model is supposed to be 34B so it should take lots of VRAM and leave very little memory for context, however in some unknown way it manages to fit 16k tokens into 24gb vram when even 20B models will only fit 8k
and in fact it can remember what was said in the very beginning of the text if asked the question.
This is happening on exllamav2 newest version probably with flash attention, but other models still can't match this absurd context size.
@Onix22 the reason is the codellama models, 70b llama 2 model, mistral models, mixtral models have gqa(grouped query attention) instead of mqa. gqa basically allows the model to use much less vram with less context so thats why its happening.
The 13b, 7b llama 2 and llama 1 models do not have gqa. 20b models are usually merges of 13b so it will also not have gqa
This was useful information It should be mentioned somewhere more.
Because for this fact, 34 B model managed to fit more context than 13B model
sadly there are no other models of the same size to use