Views
No views yet
Sunbird/Sunflower-Qwen3.5-9B.scripts/push_4bit.py.| Source repo | Sunbird/Sunflower-Qwen3.5-9B |
| Source revision | 10156eaa72a329ee5bef01a72d561fb1923274d2 |
| Quantisation | bitsandbytes 4-bit, nf4 |
| Double quantisation | True |
| Compute dtype | bfloat16 |
| Size on disk | 7.9 GB |
embed_tokens and lm_head stay in bfloat16 (~4.1 GB) because bitsandbytes
quantises nn.Linear only, and this model has a 248k-token vocabulary with
untied embeddings.1import torch
2from transformers import AutoModelForImageTextToText, AutoProcessor
3
4MODEL_ID = "Sunbird/Sunflower-Qwen3.5-9B-bnb-4bit"
5
6# Quantisation config is already in config.json — nothing extra to pass.
7model = AutoModelForImageTextToText.from_pretrained(MODEL_ID, device_map="cuda")
8tokenizer = AutoProcessor.from_pretrained(MODEL_ID).tokenizer
9
10messages = [{"role": "user", "content": "Translate to Luganda: Good morning, how are you?"}]
11enc = tokenizer.apply_chat_template(
12 messages, add_generation_prompt=True, enable_thinking=False,
13 return_tensors="pt", return_dict=True,
14).to(model.device)
15
16out = model.generate(**enc, max_new_tokens=256, do_sample=False) # temperature 0
17print(tokenizer.decode(out[0][enc["input_ids"].shape[1]:], skip_special_tokens=True))bitsandbytes (pip install bitsandbytes).quantization="fp8" on an
L4/A100/H100, or build a compressed-tensors checkpoint with llm-compressor.Translate to Luganda: Good morning, how are you?
-> Wasuze otya, oli otya?