Text Generation
Transformers
Safetensors
English
llama
ternary1b
quantization
ternary
smollm2
bitnet
text-generation-inference
Instructions to use AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET") model = AutoModelForCausalLM.from_pretrained("AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET
- SGLang
How to use AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET 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 "AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET" \ --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": "AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET", "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 "AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET" \ --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": "AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET with Docker Model Runner:
docker model run hf.co/AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET
Download packed/quant_config.json from AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET: direct link, hf CLI and curl.
- Browser
- Download file 17.7 kB
-
https://huggingface.co/AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET/resolve/main/packed/quant_config.json
- Command line
-
hf download hf://AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET/packed/quant_config.json
-
curl -L -o quant_config.json https://huggingface.co/AmareshHebbar/Ternary1B_SmolLM2_1.7B_BITNET/resolve/main/packed/quant_config.json
17.7 kB
{
"method": "bitnet",
"format": "ternary 1.58 bit",
"act_bits": 8,
"layout": {
"model.layers.0.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.0.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.0.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.0.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.0.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.0.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.0.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.1.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.1.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.1.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.1.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.1.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.1.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.1.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.2.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.2.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.2.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.2.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.2.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.2.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.2.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.3.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.3.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.3.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.3.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.3.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.3.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.3.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.4.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.4.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.4.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.4.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.4.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.4.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.4.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.5.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.5.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.5.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.5.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.5.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.5.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.5.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.6.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.6.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.6.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.6.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.6.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.6.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.6.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.7.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.7.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.7.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.7.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.7.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.7.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.7.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.8.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.8.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.8.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.8.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.8.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.8.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.8.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.9.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.9.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.9.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.9.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.9.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.9.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.9.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.10.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.10.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.10.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.10.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.10.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.10.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.10.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.11.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.11.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.11.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.11.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.11.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.11.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.11.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.12.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.12.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.12.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.12.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.12.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.12.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.12.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.13.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.13.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.13.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.13.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.13.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.13.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.13.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.14.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.14.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.14.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.14.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.14.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.14.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.14.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.15.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.15.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.15.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.15.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.15.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.15.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.15.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.16.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.16.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.16.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.16.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.16.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.16.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.16.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.17.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.17.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.17.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.17.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.17.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.17.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.17.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.18.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.18.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.18.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.18.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.18.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.18.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.18.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.19.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.19.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.19.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.19.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.19.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.19.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.19.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.20.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.20.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.20.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.20.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.20.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.20.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.20.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.21.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.21.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.21.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.21.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.21.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.21.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.21.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.22.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.22.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.22.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.22.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.22.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.22.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.22.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.23.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.23.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.23.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.23.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.23.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.23.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.23.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
}
}
}
{
"method": "bitnet",
"format": "ternary 1.58 bit",
"act_bits": 8,
"layout": {
"model.layers.0.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.0.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.0.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.0.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.0.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.0.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.0.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,
8192
]
},
"model.layers.1.self_attn.q_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.1.self_attn.k_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.1.self_attn.v_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.1.self_attn.o_proj": {
"format": "ternary",
"shape": [
2048,
2048
]
},
"model.layers.1.mlp.gate_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.1.mlp.up_proj": {
"format": "ternary",
"shape": [
8192,
2048
]
},
"model.layers.1.mlp.down_proj": {
"format": "ternary",
"shape": [
2048,