Skip to content

Commit 85df59d

Browse files
committed
add INFERENCE_TRUNCATED_RETURN_EOS
1 parent 8af1650 commit 85df59d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

paddlenlp/rl/utils/infer_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import copy
1818
import inspect
19+
import os
1920
from contextlib import contextmanager
2021

2122
import paddle
@@ -93,7 +94,8 @@ def predict(self, input_ids: paddle.Tensor = None, repeat_num=1, **kwargs):
9394
for row in input_ids:
9495
row_ids = process_row(row, remove_value=self.tokenizer.pad_token_id, remove_side="left").tolist()
9596
input_ids_list.append(row_ids)
96-
97+
# NOTE(gongenlei): The output of the ultra-long truncation does not return an eos_token
98+
os.environ["INFERENCE_TRUNCATED_RETURN_EOS"] = "0"
9799
if self.config.dynamic_insert:
98100
outputs = self.predict_dy_insert(
99101
input_ids=input_ids_list,

0 commit comments

Comments
 (0)