Make exllama stoppable

This commit is contained in:
oobabooga 2023-06-16 22:03:23 -03:00
parent 7f06d551a3
commit b27f83c0e9

View File

@ -79,7 +79,7 @@ class ExllamaModel:
for i in range(state['max_new_tokens']): for i in range(state['max_new_tokens']):
token = generator.gen_single_token() token = generator.gen_single_token()
yield (generator.tokenizer.decode(generator.sequence[0][initial_len:])) yield (generator.tokenizer.decode(generator.sequence[0][initial_len:]))
if token.item() == generator.tokenizer.eos_token_id: if token.item() == generator.tokenizer.eos_token_id or shared.stop_everything:
break break
def encode(self, string, **kwargs): def encode(self, string, **kwargs):