Text Generation
Transformers
Safetensors
llama
quantization
int8
research
smollm2
text-generation-inference
8-bit precision
Instructions to use bquast/SmolLM2-135B-int8-absmax with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bquast/SmolLM2-135B-int8-absmax with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bquast/SmolLM2-135B-int8-absmax")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bquast/SmolLM2-135B-int8-absmax") model = AutoModelForCausalLM.from_pretrained("bquast/SmolLM2-135B-int8-absmax") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bquast/SmolLM2-135B-int8-absmax with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bquast/SmolLM2-135B-int8-absmax" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bquast/SmolLM2-135B-int8-absmax", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/bquast/SmolLM2-135B-int8-absmax
- SGLang
How to use bquast/SmolLM2-135B-int8-absmax 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 "bquast/SmolLM2-135B-int8-absmax" \ --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": "bquast/SmolLM2-135B-int8-absmax", "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 "bquast/SmolLM2-135B-int8-absmax" \ --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": "bquast/SmolLM2-135B-int8-absmax", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use bquast/SmolLM2-135B-int8-absmax with Docker Model Runner:
docker model run hf.co/bquast/SmolLM2-135B-int8-absmax
SmolLM2-135M โ INT8 absmax (per-tensor, symmetric)
A research artifact, not a production model. This is the simplest possible weight-only post-training quantization, applied to SmolLM2-135M, to establish a baseline.
What this is
- Symmetric per-tensor absmax scaling
- 8-bit signed integer weights (
torch.int8) - FP32 scale factors, one per quantized tensor
- No calibration data, no activation quantization
- 1D parameters (biases, layernorm scales, etc.) left in bf16
- Embedding and LM head matrices are quantized along with all other 2D weight tensors
The math, in full:
scale = max(|W|) / 127
W_q = round(W / scale).clip(-127, 127).to(int8)
W_hat = W_q.to(bf16) * scale
What this is not
- Not loadable with
AutoModelForCausalLM.from_pretraineddirectly. Use the includedloader.py. - Not int8 inference. Weights are dequantized to bf16 at load time. For real int8 compute, reach for
bitsandbytes,AutoGPTQ, orAutoAWQ. - Not better than other quantization methods. Per-tensor absmax is the textbook baseline that GPTQ / AWQ / SmoothQuant exist to improve on. Expect the worst error on
down_projandlm_headโ fat-tailed weight distributions, one outlier blows up the scale and crushes everyone else's resolution.
Usage
from loader import load_dequantized
model, tokenizer = load_dequantized("your-username/SmolLM2-135M-int8-absmax")
inputs = tokenizer("The capital of France is", return_tensors="pt")
out = model.generate(**inputs, max_new_tokens=10, do_sample=False)
print(tokenizer.decode(out[0]))
Why it exists
To see what naive absmax quantization actually does to a small language model, before reaching for more sophisticated methods. Companion to the experiment notebook at https://github.com/your-username/... (link your repo if you publish one).
- Downloads last month
- 3
Model tree for bquast/SmolLM2-135B-int8-absmax
Base model
HuggingFaceTB/SmolLM2-135M