Instructions to use mozilla-ai/granite-34b-code-instruct-llamafile with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mozilla-ai/granite-34b-code-instruct-llamafile with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mozilla-ai/granite-34b-code-instruct-llamafile")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mozilla-ai/granite-34b-code-instruct-llamafile", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mozilla-ai/granite-34b-code-instruct-llamafile with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mozilla-ai/granite-34b-code-instruct-llamafile" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mozilla-ai/granite-34b-code-instruct-llamafile", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mozilla-ai/granite-34b-code-instruct-llamafile
- SGLang
How to use mozilla-ai/granite-34b-code-instruct-llamafile 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 "mozilla-ai/granite-34b-code-instruct-llamafile" \ --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": "mozilla-ai/granite-34b-code-instruct-llamafile", "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 "mozilla-ai/granite-34b-code-instruct-llamafile" \ --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": "mozilla-ai/granite-34b-code-instruct-llamafile", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mozilla-ai/granite-34b-code-instruct-llamafile with Docker Model Runner:
docker model run hf.co/mozilla-ai/granite-34b-code-instruct-llamafile
Commit History
-
Update README.md (#1)
Verified signature- Update README.md (18f1c34d132f8ab94044aa8d86e9e1fa62968c5e) Co-authored-by: Timothy Bula <timrbula@users.noreply.huggingface.co>25e781a
-
Quantize Q8_0 with llamafile-0.8.7
Verified signature7d62023 -
Quantize Q5_0 with llamafile-0.8.7
Verified signature16fe1f3
-
Update README.md
Verified signature5c09627 -
Update README.md
Verified signature9f3578f -
Update README.md
Verified signature47a64ba -
Quantize Q8_0 with llamafile-0.8.6
Verified signatured20e0ab -
Update README.md
Verified signature7a5f8e0 -
Update README.md
Verified signaturedeada0d -
Quantize Q5_0 with llamafile-0.8.6
Verified signaturee2d5598 -
Update README.md
Verified signatureade73f1 -
Update README.md
Verified signaturede1686b -
Update LICENSE.txt
Verified signature3048f7d -
Update README.md
Verified signaturea92633c -
initial commit
Verified signature97e141d