hsuwill000 commited on
Commit
a7464e5
·
verified ·
1 Parent(s): f7b39eb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -15,7 +15,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_id, use_fast=True,)
15
  def respond(prompt, history):
16
  # 構建聊天模板
17
  messages = [
18
- {"role": "system", "content": "使用中文,直接回答用戶的問題,盡量簡潔在1024 token內。"},
19
  {"role": "user", "content": prompt}
20
  ]
21
  text = tokenizer.apply_chat_template(
@@ -32,7 +32,7 @@ def respond(prompt, history):
32
  # 生成回應
33
  generated_ids = model.generate(
34
  **model_inputs,
35
- max_new_tokens=2048,
36
  temperature=0.7, # 降低隨機性
37
  top_p=0.9, # 限制生成的多樣性
38
  do_sample=True # 啟用採樣
 
15
  def respond(prompt, history):
16
  # 構建聊天模板
17
  messages = [
18
+ {"role": "system", "content": "使用中文。"},
19
  {"role": "user", "content": prompt}
20
  ]
21
  text = tokenizer.apply_chat_template(
 
32
  # 生成回應
33
  generated_ids = model.generate(
34
  **model_inputs,
35
+ max_new_tokens=4096,
36
  temperature=0.7, # 降低隨機性
37
  top_p=0.9, # 限制生成的多樣性
38
  do_sample=True # 啟用採樣