Text Generation
Transformers
Safetensors
qwen3
quantized
awq
int4
4-bit precision
medical
biomedical
reasoning
llmcompressor
conversational
text-generation-inference
compressed-tensors
Instructions to use hassanshka/Biomni-R0-32B-AWQ-INT4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hassanshka/Biomni-R0-32B-AWQ-INT4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hassanshka/Biomni-R0-32B-AWQ-INT4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hassanshka/Biomni-R0-32B-AWQ-INT4") model = AutoModelForCausalLM.from_pretrained("hassanshka/Biomni-R0-32B-AWQ-INT4") 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use hassanshka/Biomni-R0-32B-AWQ-INT4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hassanshka/Biomni-R0-32B-AWQ-INT4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hassanshka/Biomni-R0-32B-AWQ-INT4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/hassanshka/Biomni-R0-32B-AWQ-INT4
- SGLang
How to use hassanshka/Biomni-R0-32B-AWQ-INT4 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 "hassanshka/Biomni-R0-32B-AWQ-INT4" \ --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": "hassanshka/Biomni-R0-32B-AWQ-INT4", "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 "hassanshka/Biomni-R0-32B-AWQ-INT4" \ --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": "hassanshka/Biomni-R0-32B-AWQ-INT4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use hassanshka/Biomni-R0-32B-AWQ-INT4 with Docker Model Runner:
docker model run hf.co/hassanshka/Biomni-R0-32B-AWQ-INT4
Biomni-R0-32B-AWQ-INT4
This is an AWQ INT4 quantized version of Biomni-R0-32B-Preview.
Quantization Details
| Parameter | Value |
|---|---|
| Scheme | W4A16 (4-bit weights, 16-bit activations) |
| Method | AWQ (Activation-aware Weight Quantization) |
| Group Size | 128 |
| Calibration | Custom biomedical dataset |
| Framework | LLM Compressor |
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"hassanshka/Biomni-R0-32B-AWQ-INT4",
device_map="auto",
torch_dtype="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("hassanshka/Biomni-R0-32B-AWQ-INT4")
# Inference
messages = [{"role": "user", "content": "Your medical question here"}]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
outputs = model.generate(inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0]))
Quantization Script
from llmcompressor.modifiers.awq import AWQModifier
from llmcompressor import oneshot
recipe = AWQModifier(
scheme="W4A16",
targets="Linear",
ignore=["lm_head"],
)
oneshot(
model=model,
dataset=calibration_data,
recipe=recipe,
max_seq_length=2048,
num_calibration_samples=len(calibration_data),
)
Performance
- Memory Reduction: ~75% compared to BF16
- Inference Speed: Optimized for consumer GPUs (RTX 3090/4090)
- Accuracy: Minimal degradation due to custom calibration on biomedical data
License
Apache 2.0 (same as base model)
Citation
If you use this model, please cite the original Biomni model.
- Downloads last month
- 207