Views
No views yet
unsloth/gemma-4-12b-ityusasif/nutrimama-vision (branch v2-12b-q8)nutrimama_dataset, nutrimama_dataset-1, nutrimama_dataset-2, nutrimama_dataset-3) and enriched with detailed Gemma-generated captions (finetune_dataset_gemma.json).| Setting | Value |
|---|---|
| Base model | unsloth/gemma-4-12b-it |
| LoRA rank | 32 |
| LoRA alpha | 32 |
| Target modules | all-linear (vision + language layers) |
| Epochs | 5 |
| Learning rate | 1e-5 |
| LR scheduler | cosine |
| Batch size | 1 × 8 grad accum = effective 8 |
| Optimizer | adamw_8bit |
| Precision | bfloat16 |
| Max sequence length | 2048 |
1from PIL import Image
2import torch
3from transformers import AutoProcessor, AutoModelForImageTextToText
4
5MODEL_PATH = "yusasif/nutrimama-vision" # or local path to merged model
6
7processor = AutoProcessor.from_pretrained(MODEL_PATH)
8model = AutoModelForImageTextToText.from_pretrained(
9 MODEL_PATH,
10 torch_dtype=torch.bfloat16,
11 device_map="auto",
12)
13model.eval()
14
15image = Image.open("your_food_image.jpg").convert("RGB")
16
17messages = [
18 {
19 "role": "user",
20 "content": [
21 {"type": "text", "text": "Identify the exact Nigerian food in this image by name."},
22 {"type": "image", "image": image},
23 ],
24 }
25]
26
27input_text = processor.apply_chat_template(messages, add_generation_prompt=True)
28inputs = processor(text=input_text, images=[image], return_tensors="pt").to("cuda")
29
30with torch.no_grad():
31 out = model.generate(
32 **inputs,
33 max_new_tokens=128,
34 do_sample=True,
35 temperature=1.0,
36 top_p=0.95,
37 top_k=64,
38 )
39
40answer = processor.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
41print(answer)python gemma-vision.py # starts an OpenAI-compatible API on port 8002v2-12b-q8 branch and exposes the model as gemma-4-finetuned.| File | Description |
|---|---|
nutrimam.py | Training script (12B model) |
nutrimam_v2.py | Training script (4B model) |
gemma-vision.py | vLLM inference server |
test_nutrimama.py | Local inference test |
dataset_download_registry.json | Primary image-caption dataset (~398 records) |
finetune_dataset_gemma.json | Gemma-enriched captions (~202 records) |
efficientnet_labels.json | Per-image food class labels |
yusasif/Nigerian-language-tts — multilingual TTS for Nigerian languagesyusasif/nutrimama-vision-v2 — 4B model variant