Instructions to use codellama/CodeLlama-34b-hf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use codellama/CodeLlama-34b-hf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="codellama/CodeLlama-34b-hf")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("codellama/CodeLlama-34b-hf") model = AutoModelForCausalLM.from_pretrained("codellama/CodeLlama-34b-hf") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use codellama/CodeLlama-34b-hf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "codellama/CodeLlama-34b-hf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codellama/CodeLlama-34b-hf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/codellama/CodeLlama-34b-hf
- SGLang
How to use codellama/CodeLlama-34b-hf 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 "codellama/CodeLlama-34b-hf" \ --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": "codellama/CodeLlama-34b-hf", "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 "codellama/CodeLlama-34b-hf" \ --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": "codellama/CodeLlama-34b-hf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use codellama/CodeLlama-34b-hf with Docker Model Runner:
docker model run hf.co/codellama/CodeLlama-34b-hf
Upload tokenizer
#15
by ArthurZ HF Staff - opened
- tokenizer.json +3 -3
- tokenizer_config.json +9 -3
tokenizer.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
| 9 |
"single_word": false,
|
| 10 |
"lstrip": false,
|
| 11 |
"rstrip": false,
|
| 12 |
-
"normalized":
|
| 13 |
"special": true
|
| 14 |
},
|
| 15 |
{
|
|
@@ -18,7 +18,7 @@
|
|
| 18 |
"single_word": false,
|
| 19 |
"lstrip": false,
|
| 20 |
"rstrip": false,
|
| 21 |
-
"normalized":
|
| 22 |
"special": true
|
| 23 |
},
|
| 24 |
{
|
|
@@ -27,7 +27,7 @@
|
|
| 27 |
"single_word": false,
|
| 28 |
"lstrip": false,
|
| 29 |
"rstrip": false,
|
| 30 |
-
"normalized":
|
| 31 |
"special": true
|
| 32 |
}
|
| 33 |
],
|
|
|
|
| 9 |
"single_word": false,
|
| 10 |
"lstrip": false,
|
| 11 |
"rstrip": false,
|
| 12 |
+
"normalized": true,
|
| 13 |
"special": true
|
| 14 |
},
|
| 15 |
{
|
|
|
|
| 18 |
"single_word": false,
|
| 19 |
"lstrip": false,
|
| 20 |
"rstrip": false,
|
| 21 |
+
"normalized": true,
|
| 22 |
"special": true
|
| 23 |
},
|
| 24 |
{
|
|
|
|
| 27 |
"single_word": false,
|
| 28 |
"lstrip": false,
|
| 29 |
"rstrip": false,
|
| 30 |
+
"normalized": true,
|
| 31 |
"special": true
|
| 32 |
}
|
| 33 |
],
|
tokenizer_config.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"
|
| 3 |
-
"add_eos_token": false,
|
| 4 |
"bos_token": {
|
| 5 |
"__type": "AddedToken",
|
| 6 |
"content": "<s>",
|
|
@@ -18,10 +17,16 @@
|
|
| 18 |
"rstrip": false,
|
| 19 |
"single_word": false
|
| 20 |
},
|
|
|
|
|
|
|
| 21 |
"legacy": null,
|
|
|
|
| 22 |
"model_max_length": 1000000000000000019884624838656,
|
| 23 |
"pad_token": null,
|
|
|
|
| 24 |
"sp_model_kwargs": {},
|
|
|
|
|
|
|
| 25 |
"tokenizer_class": "CodeLlamaTokenizer",
|
| 26 |
"unk_token": {
|
| 27 |
"__type": "AddedToken",
|
|
@@ -30,5 +35,6 @@
|
|
| 30 |
"normalized": true,
|
| 31 |
"rstrip": false,
|
| 32 |
"single_word": false
|
| 33 |
-
}
|
|
|
|
| 34 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"additional_special_tokens": [],
|
|
|
|
| 3 |
"bos_token": {
|
| 4 |
"__type": "AddedToken",
|
| 5 |
"content": "<s>",
|
|
|
|
| 17 |
"rstrip": false,
|
| 18 |
"single_word": false
|
| 19 |
},
|
| 20 |
+
"eot_token": null,
|
| 21 |
+
"fill_token": "<FILL_ME>",
|
| 22 |
"legacy": null,
|
| 23 |
+
"middle_token": null,
|
| 24 |
"model_max_length": 1000000000000000019884624838656,
|
| 25 |
"pad_token": null,
|
| 26 |
+
"prefix_token": null,
|
| 27 |
"sp_model_kwargs": {},
|
| 28 |
+
"suffix_first": false,
|
| 29 |
+
"suffix_token": null,
|
| 30 |
"tokenizer_class": "CodeLlamaTokenizer",
|
| 31 |
"unk_token": {
|
| 32 |
"__type": "AddedToken",
|
|
|
|
| 35 |
"normalized": true,
|
| 36 |
"rstrip": false,
|
| 37 |
"single_word": false
|
| 38 |
+
},
|
| 39 |
+
"use_default_system_prompt": false
|
| 40 |
}
|