Spaces:
Sleeping
Sleeping
Commit
·
d29211b
1
Parent(s):
f6a2a35
add
Browse files
app.py
CHANGED
|
@@ -10,7 +10,9 @@ def load_model(model_name="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B"):
|
|
| 10 |
model=model_name,
|
| 11 |
device_map="auto",
|
| 12 |
torch_dtype=torch.float16,
|
| 13 |
-
trust_remote_code=True
|
|
|
|
|
|
|
| 14 |
)
|
| 15 |
return pipe
|
| 16 |
|
|
@@ -53,7 +55,14 @@ def main():
|
|
| 53 |
prompt = f"Human: {user_input}\n\nAssistant:"
|
| 54 |
|
| 55 |
# 모델 생성
|
| 56 |
-
response = pipe(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
bot_text = response[0]["generated_text"]
|
| 58 |
|
| 59 |
# Assistant 응답만 추출
|
|
|
|
| 10 |
model=model_name,
|
| 11 |
device_map="auto",
|
| 12 |
torch_dtype=torch.float16,
|
| 13 |
+
trust_remote_code=True,
|
| 14 |
+
truncation=True,
|
| 15 |
+
max_new_tokens=512
|
| 16 |
)
|
| 17 |
return pipe
|
| 18 |
|
|
|
|
| 55 |
prompt = f"Human: {user_input}\n\nAssistant:"
|
| 56 |
|
| 57 |
# 모델 생성
|
| 58 |
+
response = pipe(
|
| 59 |
+
prompt,
|
| 60 |
+
max_length=2048,
|
| 61 |
+
temperature=0.7,
|
| 62 |
+
do_sample=True,
|
| 63 |
+
truncation=True,
|
| 64 |
+
max_new_tokens=512
|
| 65 |
+
)
|
| 66 |
bot_text = response[0]["generated_text"]
|
| 67 |
|
| 68 |
# Assistant 응답만 추출
|