Downloads · 30 days
14
11% of all-time downloads
KavinduHansaka/phi4-mini-bnb-4bit
phi4-mini-bnb-4bit is a text generation model from KavinduHansaka. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
This repository contains a 4-bit quantized version of microsoft/Phi-4-mini-reasoning, produced with BitsAndBytes via Hugging Face Transformers. Quantization reduces VRAM usage while preserving most of the model’s reas…
Downloads · 30 days
14
11% of all-time downloads
All-time downloads
126
Public
Parameters
3.9B
2.9 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.9 GB · 99%
How the weights are stored.
U83.3B · 84%
From the Hugging Face model README
This repository contains a 4-bit quantized version of microsoft/Phi-4-mini-reasoning, produced with BitsAndBytes via Hugging Face Transformers.
Quantization reduces VRAM usage while preserving most of the model’s reasoning capabilities.
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch
model_id = "KavinduHansaka/phi4-mini-bnb-4bit"
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.bfloat16
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
dtype=torch.bfloat16,
quantization_config=bnb_config
)
inputs = tokenizer("Explain why the sky is blue in simple terms.", return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
This model inherits training data from microsoft/Phi-4-mini-reasoning. No additional fine-tuning was done.
If you use this quantized model, please also cite the original Microsoft release:
@misc{microsoft2025phi4mini,
title={Phi-4-mini-reasoning},
author={Microsoft},
year={2025},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/microsoft/Phi-4-mini-reasoning}}
}