This commit is contained in:
Saifeddine ALOUI 2023-05-29 21:26:20 +02:00
parent 3da776d605
commit 2a6f70bd87
3 changed files with 11 additions and 8 deletions

View File

@ -369,8 +369,8 @@ class ModelProcess:
def _callback(self, text, text_type=0):
try:
print(str(text),end="", flush=True)
except:
print(str(text), end="", flush=True)
except Exception as ex:
print(".")
self.curent_text += text
detected_anti_prompt = False
@ -388,7 +388,7 @@ class ModelProcess:
# Stream the generated text to the main process
self.generation_queue.put((text,self.id, text_type))
# if stop generation is detected then stop
if self.completion_signal.is_set():
if not self.completion_signal.is_set():
return True
else:
return False

View File

@ -82,12 +82,12 @@ class GPT4ALL(LLMBinding):
verbose (bool, optional): If true, the code will spit many informations about the generation process. Defaults to False.
"""
try:
response_tokens = []
response_text = []
def local_callback(token_id, response):
decoded_token = response.decode('utf-8')
response_tokens.append( decoded_token );
decoded_word = response.decode('utf-8')
response_text.append( decoded_word )
if new_text_callback is not None:
if not new_text_callback(''.join(response_tokens)):
if not new_text_callback(decoded_word):
return False
# Do whatever you want with decoded_token here.
@ -106,7 +106,7 @@ class GPT4ALL(LLMBinding):
)
except Exception as ex:
print(ex)
return ''.join(response_tokens)
return ''.join(response_text)
@staticmethod
def get_available_models():

View File

@ -0,0 +1,3 @@
Hi there, welcome to a snippet about bindings and models selection.
In this short video we will look at bindings and models