Instructions to use junwatu/resep-ID-chat-gemma-4-E4B-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use junwatu/resep-ID-chat-gemma-4-E4B-it with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="junwatu/resep-ID-chat-gemma-4-E4B-it") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("junwatu/resep-ID-chat-gemma-4-E4B-it") model = AutoModelForMultimodalLM.from_pretrained("junwatu/resep-ID-chat-gemma-4-E4B-it", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use junwatu/resep-ID-chat-gemma-4-E4B-it with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "junwatu/resep-ID-chat-gemma-4-E4B-it" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "junwatu/resep-ID-chat-gemma-4-E4B-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/junwatu/resep-ID-chat-gemma-4-E4B-it
- SGLang
How to use junwatu/resep-ID-chat-gemma-4-E4B-it with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "junwatu/resep-ID-chat-gemma-4-E4B-it" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "junwatu/resep-ID-chat-gemma-4-E4B-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "junwatu/resep-ID-chat-gemma-4-E4B-it" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "junwatu/resep-ID-chat-gemma-4-E4B-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use junwatu/resep-ID-chat-gemma-4-E4B-it with Docker Model Runner:
docker model run hf.co/junwatu/resep-ID-chat-gemma-4-E4B-it
Resep ID Chat Gemma 4 E4B
A full fine-tune of google/gemma-4-E4B-it that writes Indonesian recipes the
way Indonesian home cooks actually write them — short, structured, and with
the right bumbu. The better chat version than junwatu/resep-ID-gemma-4-E2B-it.
What this model is for
Give it a dish title or a list of ingredients in Bahasa Indonesia, get back a recipe in the standard Indonesian home-cook format:
Bahan-bahan:
- 500 gr ayam fillet
- 5 siung bawang merah
- 3 siung bawang putih
- ...
Cara membuat:
1. Goreng ayam hingga matang...
6. Sajikan hangat.
What it does better than the base Gemma 4 E4B and the e2b release
Trained on 183K cleaned Indonesian recipes (~3× more data than the e2b release).
| google/gemma-4-E4B-it (stock) | resep-ID-gemma-4-E2B-it (prior release) | This model (E4B) | |
|---|---|---|---|
| Final eval loss | n/a | 1.26 | 1.09 |
| Format compliance (Bahan + Langkah) | inconsistent | high | 100% (50/50 on held-out test) |
| Recipe length vs real recipes | rambles | sometimes too short | realistic (avg ~16 ingredients, len_ratio 1.07) |
| Inference artifacts (Unicode fractions, fake unit abbreviations) | n/a | required no_repeat_ngram_size=6 workaround; some still slipped through |
zero (with the decode params below) |
| Indonesian recipe vocabulary | uses unnatural phrasing | natural | natural, with home-cook touches (koreksi rasa, geprek, Sajikan hangat) |
| Common dishes | misses key ingredients | better | better still on common, similar on long-tail |
What it does NOT do well
Be honest about what to expect:
- Long-tail / sophisticated dishes: when asked for something elaborate (e.g. Beef Wellington, very regional specialties), the model retreats to a simpler, safer dish using the same ingredients. The training data is dominated by home-cook recipes, so the model trends there.
- Special diet modifiers (MPASI baby food, DEBM low-carb, etc.): often ignored — the model gives a normal recipe.
- "Saya punya X, Y, enaknya dimasak apa?" prompts: model picks a sensible dish from the ingredients, but it may not be the same dish as a particular reference. Both can be valid uses of the same ingredients.
For these cases the base Gemma 4 isn't better either — they need either a much larger model or a curated specialty dataset.
⚠️ Critical inference setting (different from e2b release)
Use no_repeat_ngram_size=0 and repetition_penalty=1.10.
The e2b release used no_repeat_ngram_size=6 to break bumbu-list
mode-collapse. On this larger e4b model + the cleaned 183K corpus, that same
setting causes the kind of artifacts we were trying to avoid: it forces the
model to substitute Unicode fractions, invent unit abbreviations, and morph
valid words when it can't repeat a 6-token window. A 50-sample eval validated
that disabling the n-gram block (with the repetition penalty bumped slightly)
removes every artifact pattern.
How to use
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "junwatu/resep-ID-chat-gemma-4-E4B-it"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
)
messages = [{
"role": "user",
"content": (
'Tulis resep masakan Indonesia berjudul: "Tumis Kangkung Tempe".\n'
"Format jawaban:\n"
"Bahan:\n- (daftar bahan, satu per baris)\n\n"
"Langkah:\n1. (langkah pertama)\n2. (langkah kedua)\n...\n"
"Gunakan Bahasa Indonesia."
),
}]
inputs = tok.apply_chat_template(
messages, add_generation_prompt=True,
return_tensors="pt", return_dict=True,
).to(model.device)
out = model.generate(
**inputs,
max_new_tokens=1280,
do_sample=False,
repetition_penalty=1.10, # was 1.05 in the e2b release
no_repeat_ngram_size=0, # was 6 in the e2b release
pad_token_id=tok.eos_token_id,
)
print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Two generate() arguments differ from the e2b release. Re-using the e2b
defaults on this model produces visible artifacts.
Training summary
- Base:
google/gemma-4-E4B-it(≈8B effective params; vision + audio towers frozen during training) - Data: 183,218 cleaned Indonesian home recipes
TRL
prompt+completionchat format - Method: Supervised fine-tune, 1 epoch, full FT
- Hyperparameters: LR
1e-5(cosine), per-device batch 2, grad-accum 8 (effective batch 16), seq-len 2048, weight-decay 0, warmup-ratio 0.03 - Compute: AMD Instinct MI300X (192 GB HBM3, ROCm 7.2, PyTorch 2.11.0 rocm7.2 native wheel), bf16, SDPA attention
- Wall-time: 9 h 41 min for 11,452 optimizer steps
- Final eval_loss: 1.0909 (vs 20K-validation best 1.2103, e2b release final 1.26)
- Best-checkpoint policy:
load_best_model_at_end=True→checkpoint-11200weights are what's saved here
Stack pins (these matter — the rocm6.2 wheel has a bf16-backward NaN bug on Gemma 4):
| Component | Version |
|---|---|
torch |
2.11.0+rocm7.2 |
transformers |
5.8.0 |
trl |
1.3.0 |
peft |
0.19.1 |
accelerate |
1.13.0 |
datasets |
4.8.5 |
huggingface_hub |
1.14.0 |
Limitations & disclosures
- Single-epoch budget run. Quality could be higher with more compute and more curated long-tail / regional recipes.
- Plausible but not authoritative. Use as a starting point, not as a definitive cookbook for any specific dish.
- Decode params matter. Re-using the e2b inference settings on this
model will produce the same Unicode-fraction / fake-unit artifacts the e2b
release was famous for. Always set
no_repeat_ngram_size=0andrepetition_penalty=1.10(or read them fromNO_REPEAT_NGRAM/REPETITION_PENALTYenv vars if using the project'spre_eval.hf_generate). - License: inherits the Gemma Terms of Use from the base model.
Acknowledgements
- Base model: google/gemma-4-E4B-it
- Dataset: Indonesian home recipe corpus, cleaned and curated for SFT
- Compute: AMD Instinct MI300X
- Prior release for comparison:
junwatu/resep-ID-gemma-4-E2B-it
- Downloads last month
- 1