Upload deepseek-ai_DeepSeek-R1-0528_1.py with huggingface_hub
Browse files
deepseek-ai_DeepSeek-R1-0528_1.py
CHANGED
@@ -15,7 +15,7 @@ try:
|
|
15 |
messages = [
|
16 |
{"role": "user", "content": "Who are you?"},
|
17 |
]
|
18 |
-
inputs =
|
19 |
messages,
|
20 |
add_generation_prompt=True,
|
21 |
tokenize=True,
|
@@ -24,7 +24,7 @@ try:
|
|
24 |
).to(model.device)
|
25 |
|
26 |
outputs = model.generate(**inputs, max_new_tokens=40)
|
27 |
-
print(
|
28 |
with open('deepseek-ai_DeepSeek-R1-0528_1.txt', 'w') as f:
|
29 |
f.write('Everything was good in deepseek-ai_DeepSeek-R1-0528_1.txt')
|
30 |
except Exception as e:
|
|
|
15 |
messages = [
|
16 |
{"role": "user", "content": "Who are you?"},
|
17 |
]
|
18 |
+
inputs = tokenizer.apply_chat_template(
|
19 |
messages,
|
20 |
add_generation_prompt=True,
|
21 |
tokenize=True,
|
|
|
24 |
).to(model.device)
|
25 |
|
26 |
outputs = model.generate(**inputs, max_new_tokens=40)
|
27 |
+
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
|
28 |
with open('deepseek-ai_DeepSeek-R1-0528_1.txt', 'w') as f:
|
29 |
f.write('Everything was good in deepseek-ai_DeepSeek-R1-0528_1.txt')
|
30 |
except Exception as e:
|