Skip to content

Commit 86286e0

Browse files
authored
Fix position_ids for infra (#9841)
1 parent 55db2ff commit 86286e0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

llm/predict/predictor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,16 +221,14 @@ def _preprocess(self, source):
221221
source = [source] if isinstance(source, str) else source
222222
source = [self.tokenizer.apply_chat_template(sentence, tokenize=False) for sentence in source]
223223

224-
return_position_ids = False
225224
return_attention_mask = False
226225
if len(source) > 1:
227-
return_position_ids = True
228226
return_attention_mask = True
229227
tokenized_source = self.tokenizer(
230228
source,
231229
max_length=self.config.src_length,
232230
truncation=True,
233-
return_position_ids=True if not isinstance(self.tokenizer, ChatGLMTokenizer) else return_position_ids,
231+
return_position_ids=True if not isinstance(self.tokenizer, ChatGLMTokenizer) else False,
234232
return_attention_mask=return_attention_mask,
235233
truncation_side="left",
236234
return_tensors=self.return_tensors,

0 commit comments

Comments
 (0)