Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,8 @@ from threading import Thread
|
|
| 7 |
|
| 8 |
# Loading the tokenizer and model from Hugging Face's model hub.
|
| 9 |
if torch.cuda.is_available():
|
| 10 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
| 11 |
-
model = AutoModelForCausalLM.from_pretrained("
|
| 12 |
|
| 13 |
|
| 14 |
# Defining a custom stopping criteria class for the model's text generation.
|
|
@@ -41,8 +41,8 @@ def predict(message, history):
|
|
| 41 |
do_sample=True,
|
| 42 |
top_p=0.95,
|
| 43 |
top_k=50,
|
| 44 |
-
temperature=0.
|
| 45 |
-
repetition_penalty=1.
|
| 46 |
num_beams=1,
|
| 47 |
stopping_criteria=StoppingCriteriaList([stop])
|
| 48 |
)
|
|
@@ -58,7 +58,7 @@ def predict(message, history):
|
|
| 58 |
|
| 59 |
# Setting up the Gradio chat interface.
|
| 60 |
gr.ChatInterface(predict,
|
| 61 |
-
title="
|
| 62 |
description="Warning. All answers are generated and may contain inaccurate information.",
|
| 63 |
examples=['How do you cook fish?', 'Who is the president of the United States?']
|
| 64 |
).launch() # Launching the web interface.
|
|
|
|
| 7 |
|
| 8 |
# Loading the tokenizer and model from Hugging Face's model hub.
|
| 9 |
if torch.cuda.is_available():
|
| 10 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen1.5-7B-Chat")
|
| 11 |
+
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen1.5-7B-Chat", torch_dtype=torch.float16, device_map="auto")
|
| 12 |
|
| 13 |
|
| 14 |
# Defining a custom stopping criteria class for the model's text generation.
|
|
|
|
| 41 |
do_sample=True,
|
| 42 |
top_p=0.95,
|
| 43 |
top_k=50,
|
| 44 |
+
temperature=0.7,
|
| 45 |
+
repetition_penalty=1.0,
|
| 46 |
num_beams=1,
|
| 47 |
stopping_criteria=StoppingCriteriaList([stop])
|
| 48 |
)
|
|
|
|
| 58 |
|
| 59 |
# Setting up the Gradio chat interface.
|
| 60 |
gr.ChatInterface(predict,
|
| 61 |
+
title="Qwen1.5 7B Chat Demo",
|
| 62 |
description="Warning. All answers are generated and may contain inaccurate information.",
|
| 63 |
examples=['How do you cook fish?', 'Who is the president of the United States?']
|
| 64 |
).launch() # Launching the web interface.
|