jedeland commited on
Commit
6051851
·
1 Parent(s): 8f22122
Files changed (1) hide show
  1. lora.py +5 -6
lora.py CHANGED
@@ -8,7 +8,7 @@ from unsloth import FastLanguageModel
8
 
9
  load_in_4bit = True
10
 
11
- peft_model_id = "ID2223JR/lora_model"
12
 
13
  model, tokenizer = FastLanguageModel.from_pretrained(
14
  model_name=peft_model_id,
@@ -51,10 +51,6 @@ def submit_to_model():
51
  ingredients_list.clear()
52
 
53
  messages = [
54
- {
55
- "role": "system",
56
- "content": "You are a world-renowned chef, celebrated for your expertise in creating delectable dishes from diverse cuisines. You have a vast knowledge of ingredients, cooking techniques, and dietary preferences. Your role is to suggest personalized recipes based on the ingredients available, dietary restrictions, or specific meal requests. Please provide clear, step-by-step instructions and any useful tips to enhance the dish's flavor or presentation. Begin by introducing the recipe and why it’s a great choice.",
57
- },
58
  {"role": "user", "content": prompt},
59
  ]
60
  inputs = tokenizer.apply_chat_template(
@@ -74,6 +70,8 @@ def submit_to_model():
74
  content = ""
75
  for text in text_streamer:
76
  print(text)
 
 
77
  content += text
78
  yield content
79
 
@@ -90,8 +88,9 @@ def app():
90
  add_button = gr.Button("Add Ingredient", interactive=False)
91
  output = gr.Textbox(label="Ingredients List", lines=10, interactive=False)
92
 
 
 
93
  with gr.Row():
94
- submit_button = gr.Button("Submit")
95
  model_output = gr.Textbox(
96
  label="Recipe Suggestion", lines=10, interactive=False
97
  )
 
8
 
9
  load_in_4bit = True
10
 
11
+ peft_model_id = "ID2223JR/recipe_model"
12
 
13
  model, tokenizer = FastLanguageModel.from_pretrained(
14
  model_name=peft_model_id,
 
51
  ingredients_list.clear()
52
 
53
  messages = [
 
 
 
 
54
  {"role": "user", "content": prompt},
55
  ]
56
  inputs = tokenizer.apply_chat_template(
 
70
  content = ""
71
  for text in text_streamer:
72
  print(text)
73
+ if text.endswith("<|eot_id|>"):
74
+ text = text.replace("<|eot_id|>", "")
75
  content += text
76
  yield content
77
 
 
88
  add_button = gr.Button("Add Ingredient", interactive=False)
89
  output = gr.Textbox(label="Ingredients List", lines=10, interactive=False)
90
 
91
+ submit_button = gr.Button("Give me a meal!")
92
+
93
  with gr.Row():
 
94
  model_output = gr.Textbox(
95
  label="Recipe Suggestion", lines=10, interactive=False
96
  )