Downloads · 30 days
10
21% of all-time downloads
Nefflymicn/gemma3-4b-bean-captioning
gemma3-4b-bean-captioning is a image classification model from Nefflymicn. Use it when you need a label for an image. It is set up for peft. The card lists the license as gemma.
This model is a fine-tuned version of google/gemma-3-4b-it for classifying bean plant diseases.
Downloads · 30 days
10
21% of all-time downloads
All-time downloads
47
Public
Repo size
61.9 MB
Likes
0
Public
Click a slice to open those files.
.json34.5 MB · 55%
From the Hugging Face model README
This model is a fine-tuned version of google/gemma-3-4b-it for classifying bean plant diseases.
from transformers import AutoProcessor, Gemma3ForConditionalGeneration
from peft import PeftModel
from PIL import Image
import torch
# Load base model
base_model = Gemma3ForConditionalGeneration.from_pretrained(
"google/gemma-3-4b-it",
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "Nefflymicn/gemma3-4b-bean-captioning")
processor = AutoProcessor.from_pretrained("Nefflymicn/gemma3-4b-bean-captioning")
# Prepare input
image = Image.open("bean_plant.jpg")
messages = [
{
"role": "user",
"content": [
{"type": "image"},
{"type": "text", "text": "Describe this plant image."}
]
}
]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=text, images=image, return_tensors="pt").to(model.device)
# Generate
outputs = model.generate(**inputs, max_new_tokens=50, do_sample=False)
response = processor.decode(outputs[0], skip_special_tokens=True)
print(response)
If you use this model, please cite:
@misc{gemma3-bean-captioning,
author = {younaice},
title = {Gemma-3-4B Fine-tuned for Bean Disease Classification},
year = {2024},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/Nefflymicn/gemma3-4b-bean-captioning}}
}
This model inherits the Gemma license from the base model. Please refer to the Gemma license for usage terms.