Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,7 @@ h3 {
|
|
| 38 |
|
| 39 |
model = AutoModelForCausalLM.from_pretrained(
|
| 40 |
MODEL_ID,
|
| 41 |
-
torch_dtype=torch.
|
| 42 |
device_map="auto",
|
| 43 |
)
|
| 44 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
|
@@ -47,7 +47,7 @@ tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
|
| 47 |
def stream_chat(message: str, history: list, temperature: float, max_new_tokens: int, top_p: float, top_k: int, penalty: float):
|
| 48 |
print(f'message is - {message}')
|
| 49 |
print(f'history is - {history}')
|
| 50 |
-
conversation = [{"role": "system", "content": '
|
| 51 |
for prompt, answer in history:
|
| 52 |
conversation.extend([{"role": "user", "content": prompt}, {"role": "assistant", "content": answer}])
|
| 53 |
conversation.append({"role": "user", "content": message})
|
|
@@ -81,7 +81,7 @@ def stream_chat(message: str, history: list, temperature: float, max_new_tokens:
|
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
-
chatbot = gr.Chatbot(height=
|
| 85 |
|
| 86 |
with gr.Blocks(css=CSS) as demo:
|
| 87 |
gr.HTML(TITLE)
|
|
|
|
| 38 |
|
| 39 |
model = AutoModelForCausalLM.from_pretrained(
|
| 40 |
MODEL_ID,
|
| 41 |
+
torch_dtype=torch.bfloat16,
|
| 42 |
device_map="auto",
|
| 43 |
)
|
| 44 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
|
|
|
| 47 |
def stream_chat(message: str, history: list, temperature: float, max_new_tokens: int, top_p: float, top_k: int, penalty: float):
|
| 48 |
print(f'message is - {message}')
|
| 49 |
print(f'history is - {history}')
|
| 50 |
+
conversation = [{"role": "system", "content": 'Bạn tên là Vy Linh. Bạn là một trợ lí hữu ích.'}]
|
| 51 |
for prompt, answer in history:
|
| 52 |
conversation.extend([{"role": "user", "content": prompt}, {"role": "assistant", "content": answer}])
|
| 53 |
conversation.append({"role": "user", "content": message})
|
|
|
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
+
chatbot = gr.Chatbot(height=600)
|
| 85 |
|
| 86 |
with gr.Blocks(css=CSS) as demo:
|
| 87 |
gr.HTML(TITLE)
|