beyoru commited on
Commit
d27e4f7
·
verified ·
1 Parent(s): 678b978

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -31,7 +31,7 @@ row_texts = df.apply(lambda row: " | ".join(row.astype(str)), axis=1)
31
  row_embeddings = embedding_model.encode(row_texts.tolist(), convert_to_tensor=True)
32
 
33
  # Load mô hình Qwen và tokenizer cho việc tạo phản hồi
34
- fc_model = AutoModelForCausalLM.from_pretrained('Qwen/Qwen2.5-3B-Instruct', torch_dtype=torch.float16, device_map="auto")
35
  fc_tokenizer = AutoTokenizer.from_pretrained('Qwen/Qwen2.5-3B-Instruct')
36
 
37
  # --------------------------
@@ -108,7 +108,7 @@ Bạn đã sẵn sàng phân tích và đưa ra báo cáo!
108
  ]
109
 
110
  response_template = fc_tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
111
- response_inputs = fc_tokenizer(response_template, return_tensors="pt").to(fc_model.device)
112
 
113
  # Dùng TextIteratorStreamer để stream phản hồi
114
  streamer = TextIteratorStreamer(fc_tokenizer, skip_prompt=True, skip_special_tokens=True)
 
31
  row_embeddings = embedding_model.encode(row_texts.tolist(), convert_to_tensor=True)
32
 
33
  # Load mô hình Qwen và tokenizer cho việc tạo phản hồi
34
+ fc_model = AutoModelForCausalLM.from_pretrained('Qwen/Qwen2.5-3B-Instruct', torch_dtype=torch.float16)
35
  fc_tokenizer = AutoTokenizer.from_pretrained('Qwen/Qwen2.5-3B-Instruct')
36
 
37
  # --------------------------
 
108
  ]
109
 
110
  response_template = fc_tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
111
+ response_inputs = fc_tokenizer(response_template, return_tensors="pt")
112
 
113
  # Dùng TextIteratorStreamer để stream phản hồi
114
  streamer = TextIteratorStreamer(fc_tokenizer, skip_prompt=True, skip_special_tokens=True)