Better detect when no model is loaded

This commit is contained in:
oobabooga 2023-04-16 17:35:54 -03:00
parent c8ad960018
commit 27f3a78834
2 changed files with 3 additions and 3 deletions

View File

@ -120,7 +120,7 @@ def extract_message_from_reply(reply, state):
def chatbot_wrapper(text, state, regenerate=False, _continue=False): def chatbot_wrapper(text, state, regenerate=False, _continue=False):
if shared.model_name == 'None': if shared.model_name == 'None' or shared.model is None:
print("No model is loaded! Select one in the Model tab.") print("No model is loaded! Select one in the Model tab.")
yield shared.history['visible'] yield shared.history['visible']
return return
@ -198,7 +198,7 @@ def chatbot_wrapper(text, state, regenerate=False, _continue=False):
def impersonate_wrapper(text, state): def impersonate_wrapper(text, state):
if shared.model_name == 'None': if shared.model_name == 'None' or shared.model is None:
print("No model is loaded! Select one in the Model tab.") print("No model is loaded! Select one in the Model tab.")
yield '' yield ''
return return

View File

@ -125,7 +125,7 @@ def stop_everything_event():
def generate_reply(question, state, eos_token=None, stopping_strings=[]): def generate_reply(question, state, eos_token=None, stopping_strings=[]):
if shared.model_name == 'None': if shared.model_name == 'None' or shared.model is None:
print("No model is loaded! Select one in the Model tab.") print("No model is loaded! Select one in the Model tab.")
yield formatted_outputs(question, shared.model_name) yield formatted_outputs(question, shared.model_name)
return return