Update README.md
Browse files# MASID-v3
**MASID-v3** is a fine-tuned version of **Qwen2.5-7B** trained specifically for **Filipino recipe generation**, with a focus on main dish preparation.
This model was trained on the **Filipino Recipes 2K V2 dataset**, a curated collection of ~2,000 authentic Filipino recipes.
Unlike earlier variants that explored multi-stage fine-tuning, **MASID-v3 was trained directly from Qwen2.5-7B** using this dataset to specialize the model toward Filipino culinary knowledge.
The goal of MASID-v3 is to generate structured and culturally accurate Filipino main dish recipes, covering a wide range of traditional cooking methods and ingredient combinations.
---
## Model Details
- **Base Model**: [Qwen2.5-7B](https://huggingface.co/Qwen/Qwen2.5-7B)
- **Dataset**: Filipino Recipes 2K V2 (~2,000 samples)
- **Training Objective**: Recipe text generation (Filipino cuisine, main dishes)
- **Method**: Direct fine-tuning from Qwen2.5-7B
---
## Intended Use
- Assisting in **recipe writing**
- Exploring **Filipino food culture**
- Generating **cooking instructions** in natural language
---
## Limitations
- The model was trained on a relatively **small dataset (~2k samples)**.
- May sometimes produce **hallucinated ingredients** or **inaccurate cooking steps**.
- Not suitable for use as a **nutritional or food safety reference**.
- Best used for **research, education, and creative applications**.
---
## Example Usage
```python
from typing import List
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
# Load model and tokenizer
model_name = "joackimagno/MASID-v3"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, device_map="auto")
# ==============================================================
# Alpaca-style prompt
# ==============================================================
SYSTEM_INSTRUCTION = (
"You are a Filipino chef. Generate Filipino MAIN DISH recipes.\n"
"Follow these output rules:\n"
"1) Use standard stovetop or oven methods.\n"
"2) Keep steps concise and logically ordered.\n"
"3) Output FORMAT and ORDER must be exactly:\n"
" Recipe name, Prep time, Cook time, Total time, Servings,\n"
" Full Ingredients (numbered list), Instructions (numbered list)"
)
ALPACA_TEMPLATE = (
"Below is an instruction that describes a task, paired with an input that "
"provides further context. Write a response that appropriately completes the request.\n\n"
"### Instruction:\n{}\n\n### Input:\n{}\n\n### Response:\n{}"
)
def make_model_input_from_ing(ing_names: List[str]) -> str:
return (
"Ingredients to use: " + ", ".join(ing_names) + ".\n"
"Task: create a Filipino main dish recipe using these ingredients. "
"Keep steps concise, clear, and coherent."
)
# Example input
ing_names = ["Beef", "Potato", "Sili", "Carrot", "Sayote"]
alpaca_prompt = ALPACA_TEMPLATE.format(
SYSTEM_INSTRUCTION,
make_model_input_from_ing(ing_names),
"" # leave response empty for model to generate
)
# ==============================================================
# Run inference
# ==============================================================
inputs = tokenizer(alpaca_prompt, return_tensors="pt").to(model.device)
gen_config = GenerationConfig(
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
do_sample=True,
)
outputs = model.generate(**inputs, generation_config=gen_config)
generated = tokenizer.decode(
outputs[0][inputs["input_ids"].shape[1]:],
skip_special_tokens=True
)
print(generated.strip())
|
@@ -8,6 +8,38 @@ tags:
|
|
| 8 |
license: apache-2.0
|
| 9 |
language:
|
| 10 |
- en
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
# Uploaded finetuned model
|
|
@@ -18,4 +50,4 @@ language:
|
|
| 18 |
|
| 19 |
This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
| 20 |
|
| 21 |
-
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
|
| 8 |
license: apache-2.0
|
| 9 |
language:
|
| 10 |
- en
|
| 11 |
+
datasets:
|
| 12 |
+
- joackimagno/FILIPINO_RECIPES_2K_V2
|
| 13 |
+
metrics:
|
| 14 |
+
- bleu
|
| 15 |
+
- rouge
|
| 16 |
+
- meteor
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
model-index:
|
| 20 |
+
- name: MASID-v3
|
| 21 |
+
results:
|
| 22 |
+
- task:
|
| 23 |
+
name: Text Generation
|
| 24 |
+
type: text-generation
|
| 25 |
+
dataset:
|
| 26 |
+
name: joackimagno/FILIPINO_RECIPES_2K_V2
|
| 27 |
+
type: joackimagno/FILIPINO_RECIPES_2K_V2
|
| 28 |
+
split: test
|
| 29 |
+
# (optional but recommended)
|
| 30 |
+
revision: <dataset_git_sha_or_tag>
|
| 31 |
+
metrics:
|
| 32 |
+
- name: BLEU-4
|
| 33 |
+
type: bleu
|
| 34 |
+
value: 0.07
|
| 35 |
+
- name: METEOR
|
| 36 |
+
type: meteor
|
| 37 |
+
value: 0.35
|
| 38 |
+
- name: ROUGE-L (F1)
|
| 39 |
+
type: rouge
|
| 40 |
+
value: 0.32
|
| 41 |
+
unit: f1
|
| 42 |
+
config: rougeL
|
| 43 |
---
|
| 44 |
|
| 45 |
# Uploaded finetuned model
|
|
|
|
| 50 |
|
| 51 |
This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
|
| 52 |
|
| 53 |
+
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|