Views
No views yet
load_in_4bit=True, nf4 quantization type).⚡ Part of the ZAYA1 Community Deployment Stack
GitHub: zaya1‑vllm‑docker (CUDA/ROCm Docker images & benchmarks coming soon)
bfloat16 compute dtypepip install transformers bitsandbytes accelerate torch1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_name = "ayoubelouardi/ZAYA1-8B-bnb-4bit"
5
6# The model loads directly in 4‑bit – no extra config needed
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 device_map="auto",
10 trust_remote_code=True
11)
12tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
13
14prompt = "Once upon a time,"
15inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
16outputs = model.generate(**inputs, max_new_tokens=50)
17print(tokenizer.decode(outputs[0], skip_special_tokens=True))⚠️ Note:trust_remote_code=Trueis required because the model uses a custom architecture.
1from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
2import torch
3
4bnb_config = BitsAndBytesConfig(
5 load_in_4bit=True,
6 bnb_4bit_use_double_quant=True,
7 bnb_4bit_quant_type="nf4",
8 bnb_4bit_compute_dtype=torch.bfloat16
9)
10
11model = AutoModelForCausalLM.from_pretrained(
12 "Zyphra/ZAYA1-8B",
13 quantization_config=bnb_config,
14 torch_dtype=torch.bfloat16,
15 device_map="auto",
16 trust_remote_code=True
17)
18tokenizer = AutoTokenizer.from_pretrained("Zyphra/ZAYA1-8B", trust_remote_code=True)
19
20model.save_pretrained("./ZAYA1-8B-bnb-4bit")
21tokenizer.save_pretrained("./ZAYA1-8B-bnb-4bit")load_in_4bit again when loading from this repo.| GPU | Quantization | Tokens/sec (batch=1) | Notes |
|---|---|---|---|
| NVIDIA A100 80GB | FP16 (original) | coming soon | via vLLM |
| NVIDIA A100 80GB | 4‑bit (this repo) | coming soon | via transformers |
| AMD MI300X 192GB | FP16 (original) | coming soon | via vLLM + ROCm |