Text Generation
Transformers
Safetensors
PyTorch
llama
facebook
meta
llama-3
conversational
text-generation-inference
Instructions to use fanherodev/Llama-3.2-1B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fanherodev/Llama-3.2-1B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="fanherodev/Llama-3.2-1B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("fanherodev/Llama-3.2-1B-Instruct") model = AutoModelForCausalLM.from_pretrained("fanherodev/Llama-3.2-1B-Instruct", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use fanherodev/Llama-3.2-1B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "fanherodev/Llama-3.2-1B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fanherodev/Llama-3.2-1B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/fanherodev/Llama-3.2-1B-Instruct
- SGLang
How to use fanherodev/Llama-3.2-1B-Instruct 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 "fanherodev/Llama-3.2-1B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fanherodev/Llama-3.2-1B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "fanherodev/Llama-3.2-1B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "fanherodev/Llama-3.2-1B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use fanherodev/Llama-3.2-1B-Instruct with Docker Model Runner:
docker model run hf.co/fanherodev/Llama-3.2-1B-Instruct
Commit History
-
Add model.safetensors.index.json
67038be
-
Update model card (#25)
Verified signature- Update model card (8124ca2a858fd1c8ceea2fc56f2ff3f9e76a30c3) Co-authored-by: Pedro Cuenca <pcuenq@users.noreply.huggingface.co>9213176
-
Update README.md (#11)
Verified signature- Update README.md (f678605081c436120a4c56aaa69d2f1e2ce093c9)e9f8eff -
Update chat template (#10)
Verified signature- Update chat template (41f045afe680103c97600a98f2f9021f095d8983)0907763 -
Fixes gate (#9)
Verified signature- Fixes gate (bcedc546f90c68cbe7a98dbdb0f502f2d5069322)bb0afa2 -
Upload folder using huggingface_hub (#8)
Verified signature- Upload folder using huggingface_hub (270281d0d0cc91dc6fa781a4a968e5c34c468345) Co-authored-by: Vaibhav Srivastav <reach-vb@users.noreply.huggingface.co>b0445fe -
Update README (#4)
Verified signature- Update README (fc9004aec2c581e0163b71ab8ed59c52a0207b1f) Co-authored-by: Pedro Cuenca <pcuenq@users.noreply.huggingface.co>efe927e -
Update README.md (#3)
Verified signature- Update README.md (7d207e4971d450a04237f3ae7644bb4eb01306bb) Co-authored-by: Vaibhav Srivastav <reach-vb@users.noreply.huggingface.co>6325870
-
Update README.md
Verified signature123455c -
Update README.md
Verified signature123b9d1 -
Update config.json (#2)
Verified signature- Update config.json (77454b7f1dcbf58a47cbdc056a3800c8acc4940e) Co-authored-by: Sanyam Bhutani <Sanyam@users.noreply.huggingface.co>c4219cc
-
Model card, license, AUP (#1)
Verified signature- Model card, license, AUP (0ab9681cbd2f2c163d69cbbdac8d8e9b9b643e6a)d0a2081
-
Upload folder using huggingface_hub
Verified signature898999b -
initial commit
Verified signaturea3911b5