Stop the bot from talking for you in chat mode

This commit is contained in:
oobabooga 2023-03-23 21:38:20 -03:00 committed by GitHub
parent 9bf6ecf9e2
commit 4578e88ffd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 62 deletions

View file

@ -45,11 +45,11 @@ class RWKVModel:
token_stop = token_stop
)
return context+self.pipeline.generate(context, token_count=token_count, args=args, callback=callback)
return self.pipeline.generate(context, token_count=token_count, args=args, callback=callback)
def generate_with_streaming(self, **kwargs):
with Iteratorize(self.generate, kwargs, callback=None) as generator:
reply = kwargs['context']
reply = ''
for token in generator:
reply += token
yield reply