Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "sweatSmile/Gemma-2-2B-MedicalQA-Assistant"
4tokenizer = AutoTokenizer.from_pretrained(model_name)
5model = AutoModelForCausalLM.from_pretrained(model_name)
6
7# Format your medical query
8prompt = """<start_of_turn>user
9I've been experiencing persistent headaches for the past week. What could be causing this?<end_of_turn>
10<start_of_turn>model
11"""
12
13inputs = tokenizer(prompt, return_tensors="pt")
14outputs = model.generate(
15 **inputs,
16 max_new_tokens=256,
17 temperature=0.7,
18 top_p=0.9,
19 do_sample=True
20)
21
22response = tokenizer.decode(outputs[0], skip_special_tokens=True)
23print(response)1from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
2import torch
3
4quantization_config = BitsAndBytesConfig(
5 load_in_4bit=True,
6 bnb_4bit_quant_type="nf4",
7 bnb_4bit_compute_dtype=torch.float16
8)
9
10model = AutoModelForCausalLM.from_pretrained(
11 "sweatSmile/Gemma-2-2B-MedicalQA-Assistant",
12 quantization_config=quantization_config,
13 device_map="auto"
14)
15tokenizer = AutoTokenizer.from_pretrained("sweatSmile/Gemma-2-2B-MedicalQA-Assistant")Common symptoms of Type 2 diabetes include frequent urination, increased thirst, unexplained weight loss, fatigue, blurred vision, slow-healing wounds, and tingling or numbness in hands or feet. If you're experiencing multiple symptoms, it's important to get your blood sugar levels checked. Early detection and management are crucial.⚕️ Disclaimer: This information is for educational purposes only. Please consult a qualified healthcare professional for medical advice.
Natural management of high blood pressure includes: regular exercise (30 minutes daily), reducing sodium intake, maintaining healthy weight, limiting alcohol, managing stress through meditation or yoga, eating potassium-rich foods (bananas, leafy greens), and ensuring adequate sleep. However, these should complement, not replace, prescribed medications.⚕️ Disclaimer: This information is for educational purposes only. Please consult a qualified healthcare professional for medical advice.
| Specification | Value |
|---|---|
| Base Architecture | Gemma 2 (Google) |
| Model Size | 2B parameters |
| Quantization | 4-bit (nf4) |
| Context Window | 8,192 tokens |
| Training Tokens | ~1.5M medical tokens |
| LoRA Rank | 8 |
| LoRA Alpha | 16 |
| Trainable Parameters | ~4.2M (0.2% of base) |
1@misc{gemma2-medical-qa-2025,
2 author = {sweatSmile},
3 title = {Gemma-2-2B Medical Q&A Assistant},
4 year = {2025},
5 publisher = {HuggingFace},
6 journal = {HuggingFace Model Hub},
7 howpublished = {\url{https://huggingface.co/sweatSmile/Gemma-2-2B-MedicalQA-Assistant}}
8}