Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
35 |
fc_tokenizer = AutoTokenizer.from_pretrained('Qwen/Qwen2.5-3B-Instruct')
|
36 |
|
37 |
# --------------------------
|
@@ -79,7 +79,7 @@ def generate_response(user_query: str):
|
|
79 |
]
|
80 |
|
81 |
response_template = fc_tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
82 |
-
response_inputs = fc_tokenizer(response_template, return_tensors="pt")
|
83 |
|
84 |
# Dùng TextIteratorStreamer để stream phản hồi
|
85 |
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 |
# --------------------------
|
|
|
79 |
]
|
80 |
|
81 |
response_template = fc_tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
82 |
+
response_inputs = fc_tokenizer(response_template, return_tensors="pt")
|
83 |
|
84 |
# Dùng TextIteratorStreamer để stream phản hồi
|
85 |
streamer = TextIteratorStreamer(fc_tokenizer, skip_prompt=True, skip_special_tokens=True)
|