Instructions to use jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4") model = AutoModelForCausalLM.from_pretrained("jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4
- SGLang
How to use jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4 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 "jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4" \ --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": "jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4", "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 "jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4" \ --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": "jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4 with Docker Model Runner:
docker model run hf.co/jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4
SmolLM2-1.7B โ Scheduled QAT (Linear Schedule)
This model was produced by Scheduled Quantization-Aware Training with a linear precision reduction schedule, targeting INT4 deployment on edge devices (Android, iOS, Raspberry Pi).
Important
This model is in bfloat16 โ it is NOT quantized. QAT trains weights to be robust to quantization noise, but the actual quantization happens at export time. For the quantized GGUF versions ready for deployment, see:
jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-GGUF
Training Details
| Parameter | Value |
|---|---|
| Base model | HuggingFaceTB/SmolLM2-1.7B |
| Method | Scheduled QAT (Linear bit-width reduction) |
| Training data | WikiText-103 (4000 sequences ร 512 tokens) |
| Hardware | Kaggle TPU v5e-8 (8 cores) |
| Epochs | 1 |
| Effective batch size | 64 (4 per-core ร 2 grad accum ร 8 cores) |
| Learning rate | 2e-5 (cosine decay) |
| Optimizer | AdamW (weight_decay=0.01) |
| Training precision | bfloat16 |
| Training time | ~1150 seconds |
Bit-Width Schedule
| Phase | Epoch Range | Bit-width |
|---|---|---|
| Warmup | 0.0 โ 0.1 | FP32 (no quantization noise) |
| Linear reduction | 0.1 โ 0.9 | 32 โ 16 โ 8 โ 4 (gradual) |
| Stabilization | 0.9 โ 1.0 | INT4 (final fine-tuning) |
Results (WikiText-103 Test)
| Metric | Value |
|---|---|
| Test loss | 3.0392 |
| Test perplexity | 20.89 |
How to Use
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model = AutoModelForCausalLM.from_pretrained(
"jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4",
torch_dtype=torch.bfloat16,
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained("jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4")
inputs = tokenizer("The future of AI is", return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Files
| File | Description |
|---|---|
model.safetensors |
Model weights (bfloat16) |
config.json |
Model architecture config |
tokenizer.json |
Tokenizer |
results.json |
Training results (loss, perplexity) |
training_log.json |
Step-by-step training log |
Related
- GGUF (quantized, for deployment): jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-GGUF
- Base model: HuggingFaceTB/SmolLM2-1.7B
Citation
This model is part of a thesis on Scheduled Quantization-Aware Training for Small Language Models targeting edge deployment.
License
Apache 2.0 (same as base model)
- Downloads last month
- 10
Model tree for jpcurada/SmolLM2-1.7B-Scheduled-QAT-Linear-INT4
Base model
HuggingFaceTB/SmolLM2-1.7B