File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -484,7 +484,7 @@ async def predict(
484
484
stop_words_ids = [tokenizer .encode (s )
485
485
for s in stop_words ] if stop_words else None
486
486
487
- delay_token_num = max ([len (x ) for x in stop_words ])
487
+ delay_token_num = max ([len (x ) for x in stop_words ]) if stop_words_ids else 0
488
488
response_generator = model .chat_stream (tokenizer ,
489
489
query ,
490
490
history = history ,
@@ -493,8 +493,8 @@ async def predict(
493
493
** gen_kwargs )
494
494
for _new_response in response_generator :
495
495
if len (_new_response ) <= delay_token_num :
496
- continue
497
- new_response = _new_response [:- delay_token_num ]
496
+ continue
497
+ new_response = _new_response [:- delay_token_num ] if delay_token_num else _new_response
498
498
499
499
if len (new_response ) == current_length :
500
500
continue
You can’t perform that action at this time.
0 commit comments