Commit
·
516f550
1
Parent(s):
3b328e0
- max_new_tokens=1024
Browse files+ max_new_tokens=10240
and test
- handler.py +10 -4
handler.py
CHANGED
|
@@ -28,7 +28,7 @@ class EndpointHandler:
|
|
| 28 |
bos_token_id=1,
|
| 29 |
do_sample=True,
|
| 30 |
temperature=0.7,
|
| 31 |
-
max_new_tokens=
|
| 32 |
)
|
| 33 |
|
| 34 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
|
|
@@ -87,9 +87,15 @@ class EndpointHandler:
|
|
| 87 |
return_dict_in_generate=True,
|
| 88 |
output_scores=True
|
| 89 |
)
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
def postprocess(self, output: str) -> Dict[str, str]:
|
| 94 |
return {"output": output.strip()}
|
| 95 |
|
|
|
|
| 28 |
bos_token_id=1,
|
| 29 |
do_sample=True,
|
| 30 |
temperature=0.7,
|
| 31 |
+
max_new_tokens=10240
|
| 32 |
)
|
| 33 |
|
| 34 |
def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
|
|
|
|
| 87 |
return_dict_in_generate=True,
|
| 88 |
output_scores=True
|
| 89 |
)
|
| 90 |
+
# 🧠 打印 debug 信息
|
| 91 |
+
generated_ids = output.sequences[0]
|
| 92 |
+
print("📍生成的 token ids:", generated_ids.tolist())
|
| 93 |
+
raw_text = self.tokenizer.decode(generated_ids, skip_special_tokens=False)
|
| 94 |
+
clean_text = self.tokenizer.decode(generated_ids, skip_special_tokens=True)
|
| 95 |
+
print("🧾 带特殊符号的输出:", raw_text)
|
| 96 |
+
print("✅ 去掉特殊符号的输出:", clean_text)
|
| 97 |
+
|
| 98 |
+
return clean_text # 返回干净版本
|
| 99 |
def postprocess(self, output: str) -> Dict[str, str]:
|
| 100 |
return {"output": output.strip()}
|
| 101 |
|