support val set in streaming mode

Former-commit-id: faed15b58ed00b1e09bb091e7eee48f5ef7c508b
This commit is contained in:
hiyouga
2023-08-09 23:00:26 +08:00
parent 972bfa700a
commit 467d571206
10 changed files with 58 additions and 50 deletions

View File

@@ -97,7 +97,7 @@ class Template:
sep_ids = self._convert_inputs_to_ids(tokenizer, context=self.sep)
encoded_pairs = []
for turn_idx, (query, resp) in enumerate(history):
if turn_idx == 0:
if turn_idx == 0 and prefix:
prefix_ids = self._convert_inputs_to_ids(tokenizer, context=prefix) + eos_ids + sep_ids
else:
prefix_ids = sep_ids