Jodaro commited on
Commit
192caec
·
verified ·
1 Parent(s): b5a58c5

Fix model loading (remove hf_model, set model_type)

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -8,7 +8,7 @@ print("Loading model...")
8
  model = AutoModelForCausalLM.from_pretrained(
9
  MODEL_REPO,
10
  model_file=MODEL_FILE,
11
- hf_model=MODEL_REPO,
12
  gpu_layers=0,
13
  context_length=4096,
14
  )
@@ -18,11 +18,13 @@ def respond(message, history):
18
  for user_msg, bot_msg in history:
19
  prompt += f"<|im_start|>user\n{user_msg}\n<|im_end|>\n"
20
  prompt += f"<|im_start|>assistant\n{bot_msg}\n<|im_end|>\n"
 
21
  prompt += f"<|im_start|>user\n{message}\n<|im_end|>\n<|im_start|>assistant\n"
 
22
  output = model(prompt, max_new_tokens=512, temperature=0.7, top_p=0.9)
23
  return output
24
 
25
  iface = gr.ChatInterface(respond)
26
 
27
  if __name__ == "__main__":
28
- iface.launch()
 
8
  model = AutoModelForCausalLM.from_pretrained(
9
  MODEL_REPO,
10
  model_file=MODEL_FILE,
11
+ model_type="llama",
12
  gpu_layers=0,
13
  context_length=4096,
14
  )
 
18
  for user_msg, bot_msg in history:
19
  prompt += f"<|im_start|>user\n{user_msg}\n<|im_end|>\n"
20
  prompt += f"<|im_start|>assistant\n{bot_msg}\n<|im_end|>\n"
21
+
22
  prompt += f"<|im_start|>user\n{message}\n<|im_end|>\n<|im_start|>assistant\n"
23
+
24
  output = model(prompt, max_new_tokens=512, temperature=0.7, top_p=0.9)
25
  return output
26
 
27
  iface = gr.ChatInterface(respond)
28
 
29
  if __name__ == "__main__":
30
+ iface.launch()