FoodExtract: Fine-Tuned Gemma 3 270M

A fine-tuned version of google/gemma-3-270m-it trained to extract food and drink items from raw text.

What It Does

Given any text input, this model outputs a structured extraction:
food_or_drink: 1
tags: fi, di
foods: eggs, bacon, toast
drinks: orange juice
If the input contains no food or drink items:
food_or_drink: 0
tags:
foods:
drinks:

Tag Reference

Tag Meaning
np nutrition_panel
il ingredient_list
me menu
re recipe
fi food_items
di drink_items
fa food_advertisement
fp food_packaging

How to Use

from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
model_id = "xorslider/FoodExtract-gemma-3-270m-finetuned"
model     = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_id)
pipe      = pipeline("text-generation", model=model, tokenizer=tokenizer)
input_text = "A bowl of ramen with soft-boiled eggs, nori, and a side of green tea."
formatted  = pipe.tokenizer.apply_chat_template(
    [&#123"role": "user", "content": input_text&#125],
    tokenize=False,
    add_generation_prompt=True
)
output = pipe(formatted, max_new_tokens=128)
print(output[0]["generated_text"][len(formatted):])

Training

Base model: google/gemma-3–270m-it
Dataset: mrdbourke/FoodExtract-1k (1,136 training samples)
Method: Full supervised fine-tuning (SFT) via Hugging Face TRL
Epochs: 3
Batch size: 16
Learning rate: 5e-5

Downloads last month
369
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for xorslider/FoodExtract-gemma-3-270m-finetuned

Finetuned
(1178)
this model

Space using xorslider/FoodExtract-gemma-3-270m-finetuned 1