Spaces:
Runtime error
Runtime error
Update app-backup2.py
Browse files- app-backup2.py +15 -4
app-backup2.py
CHANGED
|
@@ -318,14 +318,25 @@ Step_n: xxx""",
|
|
| 318 |
do_sample=True,
|
| 319 |
temperature=0.7,
|
| 320 |
top_p=0.9,
|
|
|
|
|
|
|
| 321 |
)
|
| 322 |
|
|
|
|
|
|
|
|
|
|
| 323 |
# ๋์ฝ๋ฉ
|
| 324 |
-
response = processor.decode(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
|
| 326 |
-
#
|
| 327 |
-
if "
|
| 328 |
-
response = response
|
|
|
|
|
|
|
| 329 |
|
| 330 |
return response
|
| 331 |
|
|
|
|
| 318 |
do_sample=True,
|
| 319 |
temperature=0.7,
|
| 320 |
top_p=0.9,
|
| 321 |
+
pad_token_id=processor.tokenizer.pad_token_id,
|
| 322 |
+
eos_token_id=processor.tokenizer.eos_token_id,
|
| 323 |
)
|
| 324 |
|
| 325 |
+
# ์
๋ ฅ ํ ํฐ ์ ๊ฑฐํ์ฌ ์ถ๋ ฅ๋ง ์ถ์ถ
|
| 326 |
+
generated_tokens = outputs[0][inputs.input_ids.shape[1]:]
|
| 327 |
+
|
| 328 |
# ๋์ฝ๋ฉ
|
| 329 |
+
response = processor.decode(generated_tokens, skip_special_tokens=True).strip()
|
| 330 |
+
|
| 331 |
+
# ํ๋กฌํํธ ์ ๊ฑฐ ๋ฐ ์ ๋ฆฌ
|
| 332 |
+
# ์ด๋ฏธ ์
๋ ฅ ํ ํฐ์ ์ ๊ฑฐํ์ผ๋ฏ๋ก ์ถ๊ฐ ์ ๋ฆฌ๋ง ์ํ
|
| 333 |
+
response = response.strip()
|
| 334 |
|
| 335 |
+
# ํน์ ๋จ์์๋ ๋ถํ์ํ ํ
์คํธ ์ ๊ฑฐ
|
| 336 |
+
if response.startswith("model\n"):
|
| 337 |
+
response = response[6:].strip()
|
| 338 |
+
elif response.startswith("model"):
|
| 339 |
+
response = response[5:].strip()
|
| 340 |
|
| 341 |
return response
|
| 342 |
|