Manually strip and decode tokens if not using a pipeline

This commit is contained in:
Gnome Ann 2021-08-20 11:15:32 -04:00
parent 7717168676
commit f986c65a4e
1 changed files with 4 additions and 0 deletions

View File

@ -1109,6 +1109,10 @@ def generate(txt, min, max):
set_aibusy(0) set_aibusy(0)
return return
# Need to manually strip and decode tokens if we're not using a pipeline
if(vars.hascuda and vars.breakmodel):
genout = [{"generated_text": tokenizer.decode(tokens[len(gen_in[0])-len(tokens):])} for tokens in genout]
if(len(genout) == 1): if(len(genout) == 1):
genresult(genout[0]["generated_text"]) genresult(genout[0]["generated_text"])
else: else: