han145 commited on
Commit
c23bd9a
·
verified ·
1 Parent(s): 89244e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -12,7 +12,7 @@ model_id = "Qwen/Qwen2.5-0.5B-Instruct"
12
  tokenizer = AutoTokenizer.from_pretrained(model_id)
13
  model = AutoModelForCausalLM.from_pretrained(
14
  model_id,
15
- torch_dtype=torch.float32,
16
  device_map="cpu",
17
  )
18
 
@@ -55,7 +55,8 @@ def stream_response(message, history):
55
  partial_text = ""
56
  for new_text in streamer:
57
  partial_text += new_text
58
- clean_display_text = re.sub(r'[\n\-\*""""#]', '', partial_text)
 
59
  yield clean_display_text
60
 
61
  # 4. 界面设置
 
12
  tokenizer = AutoTokenizer.from_pretrained(model_id)
13
  model = AutoModelForCausalLM.from_pretrained(
14
  model_id,
15
+ dtype=torch.float32,
16
  device_map="cpu",
17
  )
18
 
 
55
  partial_text = ""
56
  for new_text in streamer:
57
  partial_text += new_text
58
+ clean_display_text = re.sub(r'[
59
+ \-\*""""#]', '', partial_text)
60
  yield clean_display_text
61
 
62
  # 4. 界面设置