Views
No views yet
| Property | Value |
|---|---|
| Base model | Qwen/Qwen3-0.6B |
| Training data | RecipeNLG (70k samples) |
| Fine-tune method | LoRA (r=64, alpha=128) |
| Epochs | 2 |
| Training loss | 0.86 |
| Framework | Unsloth + TRL |
1from unsloth import FastLanguageModel
2import torch
3
4model, tokenizer = FastLanguageModel.from_pretrained(
5 model_name = "Aniq-63/qwen3-0.6B-recipe-finetuned",
6 max_seq_length = 1024,
7 load_in_4bit = True,
8)
9
10FastLanguageModel.for_inference(model)
11
12@torch.inference_mode()
13def generate_recipe(ingredients: str) -> str:
14 messages = [
15 {
16 "role": "system",
17 "content": (
18 "You are a professional chef assistant. "
19 "When given a list of ingredients, generate a complete recipe with "
20 "a title, structured ingredient list with quantities, and clear "
21 "step-by-step directions."
22 )
23 },
24 {
25 "role": "user",
26 "content": ingredients
27 }
28 ]
29 prompt = tokenizer.apply_chat_template(
30 messages,
31 tokenize=False,
32 add_generation_prompt=True,
33 enable_thinking=False,
34 )
35 inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
36 outputs = model.generate(
37 **inputs,
38 max_new_tokens = 400,
39 temperature = 0.7,
40 top_p = 0.9,
41 do_sample = True,
42 use_cache = False,
43 )
44 new_tokens = outputs[0][inputs["input_ids"].shape[1]:]
45 return tokenizer.decode(new_tokens, skip_special_tokens=True)
46
47print(generate_recipe("chicken, garlic, onion, olive oil, tomato"))1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model = AutoModelForCausalLM.from_pretrained(
5 "Aniq-63/qwen3-0.6B-recipe-finetuned",
6 torch_dtype = torch.float16,
7 device_map = "auto",
8)
9tokenizer = AutoTokenizer.from_pretrained("Aniq-63/qwen3-recipe-chef")
10
11messages = [
12 {
13 "role": "system",
14 "content": (
15 "You are a professional chef assistant. "
16 "When given a list of ingredients, generate a complete recipe with "
17 "a title, structured ingredient list with quantities, and clear "
18 "step-by-step directions."
19 )
20 },
21 {
22 "role": "user",
23 "content": "chicken, garlic, onion, olive oil, tomato"
24 }
25]
26
27prompt = tokenizer.apply_chat_template(
28 messages,
29 tokenize=False,
30 add_generation_prompt=True,
31)
32
33inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
34
35outputs = model.generate(
36 **inputs,
37 max_new_tokens = 400,
38 temperature = 0.7,
39 top_p = 0.9,
40 do_sample = True,
41)
42
43new_tokens = outputs[0][inputs["input_ids"].shape[1]:]
44print(tokenizer.decode(new_tokens, skip_special_tokens=True))