Update personality.py

This commit is contained in:
Saifeddine ALOUI 2024-07-29 09:48:05 +02:00 committed by GitHub
parent 148813a8fb
commit dbc2120b3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -696,10 +696,6 @@ class AIPersonality:
if debug == False:
debug = self.config.debug
if max_generation_size is None:
prompt_size = self.model.tokenize(prompt)
max_generation_size = min(self.model.config.ctx_size - len(prompt_size),self.config.max_n_predict)
pr = PromptReshaper(prompt)
prompt = pr.build(placeholders,
self.model.tokenize,
@ -707,8 +703,6 @@ class AIPersonality:
max_generation_size,
sacrifice
)
ntk = len(self.model.tokenize(prompt))
max_generation_size = min(min(self.model.config.ctx_size - ntk, max_generation_size), self.config.max_n_predict)
# TODO : add show progress
gen = self.generate(prompt, max_generation_size, temperature = temperature, top_k = top_k, top_p=top_p, repeat_penalty=repeat_penalty, repeat_last_n=repeat_last_n, callback=callback, show_progress=show_progress).strip().replace("</s>", "").replace("<s>", "")