Instructions to use codellama/CodeLlama-7b-Python-hf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use codellama/CodeLlama-7b-Python-hf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="codellama/CodeLlama-7b-Python-hf")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("codellama/CodeLlama-7b-Python-hf") model = AutoModelForCausalLM.from_pretrained("codellama/CodeLlama-7b-Python-hf", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use codellama/CodeLlama-7b-Python-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-Python-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-Python-hf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/codellama/CodeLlama-7b-Python-hf
- SGLang
How to use codellama/CodeLlama-7b-Python-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-Python-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-Python-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-Python-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-Python-hf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use codellama/CodeLlama-7b-Python-hf with Docker Model Runner:
docker model run hf.co/codellama/CodeLlama-7b-Python-hf
Commit History
-
Update README.md
Verified signatureHi there! I just wanted to say that your model is fantastic. We would love to contribute by updating the README to include the base_model information. This is to help fill in the missing details in the model card. Thank you for your great work!0144527
-
Update README.md
Verified signatured4178f5
-
Update README.md
Verified signature9535943
-
Fix link to responsible use guide (#9)
- Fix link to responsible use guide (4f9a778db31424d44b20591dfddaa4ad0b0bbbe0)7ee7b6b
-
Update README.md
b1d96d6 -
delete unused ckpts (#8)
- delete unused ckpts (ac10cbbf2b111ad2e812f5301d8bbdd8287f37cb) - Delete pytorch_model-00001-of-00006.bin (b7082c59e29d40553191bfa4d0fd701a3b0ff3c4) - Delete pytorch_model-00002-of-00006.bin (b7e78cf212ee39d45f27ceea82ca3110547c9188) - Delete pytorch_model-00003-of-00006.bin (ffa812272f35a718234f18bef1a46317c718743f) - Delete pytorch_model-00004-of-00006.bin (73761b7396b2e8ea4411a2638bcf93a42cd0ed50) - Delete pytorch_model-00005-of-00006.bin (475a70f834a4aad508c12c3abb415459ed0af3da) - Delete pytorch_model-00006-of-00006.bin (3d204181ab649f1509295d9d4cf4f84ab17afcd2) - Delete pytorch_model-00002-of-00002.bin (c01d096045fbdbeda47be1f50ca6a0158e3546a5)51955db -
Upload LlamaForCausalLM
5fda389 -
CodeLlamaTokenizer (#7)
- CodeLlamaTokenizer (a79e73f4e1cedfb2936d71a87729f795dbde4d6f) Co-authored-by: Pedro Cuenca <pcuenq@users.noreply.huggingface.co>307860e
-
Fix version description
c2e2591 -
Use and capabilities (#6)
- Use and capabilities (ca60ec876a66e37b01e4ed6c0e524cf0a2d6aac7)a677700 -
use 6 shards instead of 2
ec4dd26 -
Adding `safetensors` variant of this model (#3)
- Adding `safetensors` variant of this model (494cc3ea6757d35422b6232ab6e0c51140bd1140)9ff48fe -
Update README.md
4dc50ea -
Fix 13b and 34b instruct links (#1)
- Fix 13b and 34b instruct links (184d86477cf1c364b7df5f68609d61e0f687f48b)1cfac9d
-
Upload 2 files
2296230 -
add model weights
32d416f -
Create README.md
cdd7100 -
initial commit
018d978