hsuwill000 commited on
Commit
7f4a0a3
·
verified ·
1 Parent(s): 21f391c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -8,12 +8,16 @@ model_id = "hsuwill000/DeepSeek-R1-Distill-Qwen-1.5B-openvino"
8
  print("Loading model...")
9
  model = OVModelForCausalLM.from_pretrained(model_id, device_map="auto")
10
  print("Loading tokenizer...")
11
- tokenizer = AutoTokenizer.from_pretrained(model_id)
 
 
 
 
12
 
13
  def respond(prompt, history):
14
  # 構建聊天模板
15
  messages = [
16
- {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant. Think internally, but do not generate thoughts explicitly in the output."},
17
  {"role": "user", "content": prompt}
18
  ]
19
  text = tokenizer.apply_chat_template(
@@ -30,7 +34,7 @@ def respond(prompt, history):
30
  # 生成回應
31
  generated_ids = model.generate(
32
  **model_inputs,
33
- max_new_tokens=512
34
  )
35
  print("Generated IDs:", generated_ids)
36
 
 
8
  print("Loading model...")
9
  model = OVModelForCausalLM.from_pretrained(model_id, device_map="auto")
10
  print("Loading tokenizer...")
11
+ tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=True,)
12
+
13
+
14
+ torch.set_num_threads(2)
15
+
16
 
17
  def respond(prompt, history):
18
  # 構建聊天模板
19
  messages = [
20
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
21
  {"role": "user", "content": prompt}
22
  ]
23
  text = tokenizer.apply_chat_template(
 
34
  # 生成回應
35
  generated_ids = model.generate(
36
  **model_inputs,
37
+ max_new_tokens=2048
38
  )
39
  print("Generated IDs:", generated_ids)
40