Skip to content

Commit c536da4

Browse files
nlpfollowernlpfollowerJack-Khuu
authored and
vmpuri
committed
Increment start_pos by encoded size in generate (#1462)
* Add encoded size to start_pos * Only in chat mode --------- Co-authored-by: nlpfollower <[email protected]> Co-authored-by: Jack-Khuu <[email protected]>
1 parent f514b35 commit c536da4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

torchchat/generate.py

+2
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,8 @@ def callback(x, *, done_generating=False):
11921192
max_seq_length=max_seq_length,
11931193
attention_backend=self.builder_args.attention_backend,
11941194
)
1195+
if generator_args.chat_mode:
1196+
start_pos += encoded.size(0)
11951197
for token_tensor, metrics in generator_func:
11961198
if token_tensor is not None:
11971199
start_pos += token_tensor.size(0)

0 commit comments

Comments
 (0)