Text Generation
Transformers
Safetensors
English
llama
llama-3
meta
facebook
unsloth
text-generation-inference
Instructions to use unsloth/Llama-3.2-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/Llama-3.2-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/Llama-3.2-1B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("unsloth/Llama-3.2-1B") model = AutoModelForCausalLM.from_pretrained("unsloth/Llama-3.2-1B", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use unsloth/Llama-3.2-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/Llama-3.2-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/Llama-3.2-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/unsloth/Llama-3.2-1B
- SGLang
How to use unsloth/Llama-3.2-1B 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 "unsloth/Llama-3.2-1B" \ --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": "unsloth/Llama-3.2-1B", "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 "unsloth/Llama-3.2-1B" \ --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": "unsloth/Llama-3.2-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Desktop
- Docker Model Runner
How to use unsloth/Llama-3.2-1B with Docker Model Runner:
docker model run hf.co/unsloth/Llama-3.2-1B
Upload folder using huggingface_hub
Browse files- config.json +1 -2
- generation_config.json +1 -1
- tokenizer_config.json +2 -2
config.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "meta-llama/Llama-3.2-1B",
|
| 3 |
"architectures": [
|
| 4 |
"LlamaForCausalLM"
|
| 5 |
],
|
|
@@ -31,7 +30,7 @@
|
|
| 31 |
"rope_theta": 500000.0,
|
| 32 |
"tie_word_embeddings": true,
|
| 33 |
"torch_dtype": "bfloat16",
|
| 34 |
-
"transformers_version": "4.
|
| 35 |
"unsloth_fixed": true,
|
| 36 |
"use_cache": true,
|
| 37 |
"vocab_size": 128256
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"architectures": [
|
| 3 |
"LlamaForCausalLM"
|
| 4 |
],
|
|
|
|
| 30 |
"rope_theta": 500000.0,
|
| 31 |
"tie_word_embeddings": true,
|
| 32 |
"torch_dtype": "bfloat16",
|
| 33 |
+
"transformers_version": "4.52.4",
|
| 34 |
"unsloth_fixed": true,
|
| 35 |
"use_cache": true,
|
| 36 |
"vocab_size": 128256
|
generation_config.json
CHANGED
|
@@ -7,5 +7,5 @@
|
|
| 7 |
"pad_token_id": 128004,
|
| 8 |
"temperature": 0.6,
|
| 9 |
"top_p": 0.9,
|
| 10 |
-
"transformers_version": "4.
|
| 11 |
}
|
|
|
|
| 7 |
"pad_token_id": 128004,
|
| 8 |
"temperature": 0.6,
|
| 9 |
"top_p": 0.9,
|
| 10 |
+
"transformers_version": "4.52.4"
|
| 11 |
}
|
tokenizer_config.json
CHANGED
|
@@ -2061,6 +2061,6 @@
|
|
| 2061 |
"model_max_length": 131072,
|
| 2062 |
"pad_token": "<|finetune_right_pad_id|>",
|
| 2063 |
"padding_side": "left",
|
| 2064 |
-
"tokenizer_class": "
|
| 2065 |
"unk_token": null
|
| 2066 |
-
}
|
|
|
|
| 2061 |
"model_max_length": 131072,
|
| 2062 |
"pad_token": "<|finetune_right_pad_id|>",
|
| 2063 |
"padding_side": "left",
|
| 2064 |
+
"tokenizer_class": "PreTrainedTokenizer",
|
| 2065 |
"unk_token": null
|
| 2066 |
+
}
|