Views
No views yet
| Configuration | Hardware | Generation Speed | VRAM / RAM |
|---|---|---|---|
| NF4 (this model) | DGX Spark GB10 | 39.3 tok/s | 3.5 GB |
| bf16 (full precision) | DGX Spark GB10 | 20.5 tok/s | 8.6 GB |
| Q4_K_M GGUF | Azure 4-core EPYC | 12.3 tok/s | ~4 GB |
1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
3
4tokenizer = AutoTokenizer.from_pretrained("CraneAILabs/medgemma-1.5-4b-it-nf4-blackwell")
5model = AutoModelForCausalLM.from_pretrained(
6 "CraneAILabs/medgemma-1.5-4b-it-nf4-blackwell",
7 device_map="auto"
8)
9
10messages = [{"role": "user", "content": "What are the symptoms of malaria?"}]
11inputs = tokenizer.apply_chat_template(
12 messages, return_tensors="pt", add_generation_prompt=True
13).to(model.device)
14
15with torch.no_grad():
16 outputs = model.generate(inputs, max_new_tokens=200, temperature=0.3, do_sample=True)
17
18print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))The symptoms of malaria can vary depending on the type of malaria parasite, the severity of the infection, and the individual's immune status. Common symptoms include:Early Symptoms: Fever, chills, headache, muscle aches, fatigue, nausea, vomiting...
max_new_tokens=200, temperature=0.3, do_sample=Truetorch.cuda.synchronize() before and after generation; wall-clock for CPU