Instructions to use codellama/CodeLlama-7b-hf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use codellama/CodeLlama-7b-hf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="codellama/CodeLlama-7b-hf")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("codellama/CodeLlama-7b-hf") model = AutoModelForCausalLM.from_pretrained("codellama/CodeLlama-7b-hf", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use codellama/CodeLlama-7b-hf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "codellama/CodeLlama-7b-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-7b-hf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/codellama/CodeLlama-7b-hf
- SGLang
How to use codellama/CodeLlama-7b-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-7b-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-7b-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-7b-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-7b-hf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use codellama/CodeLlama-7b-hf with Docker Model Runner:
docker model run hf.co/codellama/CodeLlama-7b-hf
Commit History
-
Update README.md
Verified signature6c284d1
-
Update README.md
Verified signature7f22f0a
-
Fix link to responsible use guide (#20)
- Fix link to responsible use guide (c2cda56db2670ac30a7d7d95ff0ae2ca2e704e21) Co-authored-by: Jonathan Simantzik <simanjo@users.noreply.huggingface.co>bc52832
-
Update README.md
3773f63 -
delete unused checkpoints (#12)
- delete unused checkpoints (7f53ce00ce7ec921b6c69a47dbae369cbf0a37ca) - Delete pytorch_model-00001-of-00006.bin (60970c639e823afddd6f5988c26dc7314d83e7bb) - Delete pytorch_model-00002-of-00006.bin (2372c9b91d1c328e03246eecbc4804875fb478a6) - Delete pytorch_model-00003-of-00006.bin (34d6f3879bf185a4814b0205258439fdf3614c94) - Delete pytorch_model-00004-of-00006.bin (acf0537632a52172c13e09908315326260472e0f) - Delete pytorch_model-00005-of-00006.bin (ca72bca3339ab20ee9a54c5de6057069a45e9397) - Delete pytorch_model-00006-of-00006.bin (c1dcd7c84bb36a4a47fa6642fcb4af78a2a517e5) - Delete pytorch_model-00002-of-00002.bin (06c1b70fdef6e16ffcc7d43f4270df09c9c54394)a6a8170 -
Upload LlamaForCausalLM
ab8c802 -
CodeLlamaTokenizer (#11)
- CodeLlamaTokenizer (ae1b44173f3d23fdc5b62a0797e158855c05549c) Co-authored-by: Pedro Cuenca <pcuenq@users.noreply.huggingface.co>0b6e5ef
-
Model capabilities (#9)
- Model capabilities (6026421fb9f6d72f03546d1bfaebf4b6c553bef8)533ac5f -
Install transformers from main (#8)
- Install transformers from main (3783f4b83c788e130f7b745242f5e5eb7b5abefb)82ad5cd -
use 6 shards instead of 2
be52f4a -
Adding `safetensors` variant of this model (#5)
- Adding `safetensors` variant of this model (48af482a77b908a911152207179f877efe0f9ff7)0d6f9ee -
Update README.md
7571482 -
Fix 13b and 34b instruct links, small typo (#2)
- Fix 13b and 34b instruct links, small typo (bb5ede09fcf9a316a44cdb2da3aea21bba9278d1)4a90c02
-
Upload 2 files
31eddd0 -
Update README.md
304c992 -
Update README.md
b9a2245 -
Update README.md
f274875 -
add model weights
ba606a6 -
Update README.md
aa112c5 -
Update README.md
7202730 -
Update README.md
b0ef4a0 -
Update README.md
8a68eed -
Update README.md
485cb6c -
Update README.md
7e58ad0 -
Create README.md
bca487f -
initial commit
7d63311