Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
|
30 |
|
31 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
32 |
|
33 |
-
model_id = "
|
34 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
35 |
model = AutoModelForCausalLM.from_pretrained(
|
36 |
model_id,
|
@@ -58,7 +58,7 @@ def generate(
|
|
58 |
gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|
59 |
input_ids = input_ids.to(model.device)
|
60 |
|
61 |
-
streamer = TextIteratorStreamer(tokenizer, timeout=
|
62 |
generate_kwargs = dict(
|
63 |
{"input_ids": input_ids},
|
64 |
streamer=streamer,
|
|
|
30 |
|
31 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
32 |
|
33 |
+
model_id = "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B"
|
34 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
35 |
model = AutoModelForCausalLM.from_pretrained(
|
36 |
model_id,
|
|
|
58 |
gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|
59 |
input_ids = input_ids.to(model.device)
|
60 |
|
61 |
+
streamer = TextIteratorStreamer(tokenizer, timeout=20.0, skip_prompt=True, skip_special_tokens=True)
|
62 |
generate_kwargs = dict(
|
63 |
{"input_ids": input_ids},
|
64 |
streamer=streamer,
|