Downloads · 30 days
10
19% of all-time downloads
mufasabrownie/gemma-4-E2B-it-ham10000-lora
gemma-4-E2B-it-ham10000-lora is a image-to-text model from mufasabrownie. Use it when you need a caption or text from an image. It is set up for peft. The card lists the license as gemma.
LoRA adapter fine-tuned from google/gemma-4-E2B-it on marmal88/skincancer for 7-class dermoscopic lesion classification.
Downloads · 30 days
10
19% of all-time downloads
All-time downloads
54
Public
Repo size
129 MB
Likes
0
Public
Click a slice to open those files.
.safetensors96.7 MB · 75%
From the Hugging Face model README
LoRA adapter fine-tuned from google/gemma-4-E2B-it on
marmal88/skin_cancer for 7-class
dermoscopic lesion classification.
nvmelbklakiecbccdfvascFull per-class metrics are in the attached metrics.json.
from peft import PeftModel
from transformers import AutoProcessor
try:
from transformers import AutoModelForMultimodalLM as _AutoModelForMM
except ImportError:
from transformers import AutoModelForImageTextToText as _AutoModelForMM # pragma: no cover
import torch
BASE = "google/gemma-4-E2B-it"
ADAPTER = "mufasabrownie/gemma-4-E2B-it-ham10000-lora"
processor = AutoProcessor.from_pretrained(BASE)
model = AutoModelForMultimodalLM.from_pretrained(BASE, torch_dtype=torch.bfloat16) # or the auto class matching your transformers version
model = PeftModel.from_pretrained(model, ADAPTER)
model.eval()
messages = [{
"role": "user",
"content": [
{"type": "image", "image": "<PIL.Image or URL>"},
{"type": "text", "text": "Classify this dermoscopic image into one of: "
"nv, mel, bkl, akiec, bcc, df, vasc. Answer with the label only."},
],
}]
prompt = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
inputs = processor(text=prompt, images=your_image, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=8, do_sample=False)
print(processor.tokenizer.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))