Downloads · 30 days
9
4% of all-time downloads
LewinRobin/Medgemma_ROCOv2_Standalone
Medgemma_ROCOv2_Standalone is a machine learning model from LewinRobin. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as gemma.
This is a fully merged (adapter-free) version of MedGemma fine-tuned on RoCoV2.
Downloads · 30 days
9
4% of all-time downloads
All-time downloads
215
Public
Parameters
4.3B
8.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8.6 GB · 100%
From the Hugging Face model README
This is a fully merged (adapter-free) version of MedGemma fine-tuned on RoCoV2.
The LoRA adapters from LewinRobin/Medgemma_Rocov2 have been merged directly into the base weights of google/medgemma-4b-it.
No PEFT dependency required — load with plain AutoModelForCausalLM.
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model = AutoModelForCausalLM.from_pretrained(
"LewinRobin/Medgemma_ROCOv2_Standalone", torch_dtype=torch.bfloat16, device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("LewinRobin/Medgemma_ROCOv2_Standalone")
messages = [
{"role": "system", "content": "You are a highly experienced radiologist. Given a radiology image identifier and its associated UMLS medical concepts, write an accurate and concise radiology report caption."},
{"role": "user", "content": "Image ID: ROCOv2_2023_train_000001
Medical Concepts (UMLS CUIs): C0040405
Write the radiology report caption for this image."}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt", return_token_type_ids=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))