Text Generation
Transformers
Safetensors
English
llama
quadrotor
quantization
4-bit precision
conversational
text-generation-inference
8-bit precision
Instructions to use majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit") 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("majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit") model = AutoModelForCausalLM.from_pretrained("majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit", 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 majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit
- SGLang
How to use majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit 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 "majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit" \ --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": "majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit", "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 "majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit" \ --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": "majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit with Docker Model Runner:
docker model run hf.co/majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit
SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit
Weight-quantized via QuadRotor-Full at 4 bits.
Smoke results (WikiText-2, seq_len 2048, MPS)
| Variant | Perplexity | Δ vs BF16 |
|---|---|---|
| BF16 (upstream) | 8.9391 | — |
| Affine 4-bit | 11.0134 | +2.07 (+23 %) |
| QuadRotor-Full 4-bit | 11.0197 | +2.08 (+23 %) |
Random Haar quaternions without calibration are essentially identical to plain affine 4-bit on this model (Δ +0.006). See the source repo for the consolidated picture and next-step recommendations.
Algorithm
Per group of 64 weight elements:
- Split norm
ρ = ‖x‖₂from directionx̄ = x/ρ - Reshape
x̄into 16 blocks of 4 coordinates - Sample 16 pairs of unit quaternions from a per-tensor seed (SHA-256 of tensor name → 32-bit seed → Haar-on-S³)
- Apply
T(v) = q_L · v · q̄_Rper block - Group-wise affine 4-bit quantize the rotated coordinates
Loading
import json, torch
from pathlib import Path
from huggingface_hub import snapshot_download
from safetensors.torch import load_file
from quadrotor.quantize import QuadRotorConfig
from quadrotor.state_dict import decode_state_dict
p = Path(snapshot_download("majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit"))
sidecar = json.loads((p / "quadrotor.json").read_text())
cfg = QuadRotorConfig(variant=sidecar["variant"], bits=sidecar["bits"], group_size=sidecar["group_size"])
state = load_file(str(p / "model.safetensors"))
restored = decode_state_dict(state, cfg, sidecar)
Source
- Algorithm + tooling:
github.com/ajentik/quadrotor - Base model:
HuggingFaceTB/SmolLM2-1.7B-Instruct
License
Apache 2.0 (inherited from base model).
- Downloads last month
- 9
Model tree for majentik/SmolLM2-1.7B-Instruct-QuadRotor-Full-4bit
Base model
HuggingFaceTB/SmolLM2-1.7B Quantized
HuggingFaceTB/SmolLM2-1.7B-Instruct