From 45b7e53565ee0151cdbe2aa5760cfdf05f696d5c Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 20 Mar 2023 20:36:02 -0300 Subject: [PATCH] Only catch proper Exceptions in the text generation function --- modules/text_generation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/text_generation.py b/modules/text_generation.py index a70d490c..84752b39 100644 --- a/modules/text_generation.py +++ b/modules/text_generation.py @@ -111,7 +111,7 @@ def generate_reply(question, max_new_tokens, do_sample, temperature, top_p, typi # No need to generate 8 tokens at a time. for reply in shared.model.generate_with_streaming(context=question, token_count=max_new_tokens, temperature=temperature, top_p=top_p, top_k=top_k): yield formatted_outputs(reply, shared.model_name) - except: + except Exception: traceback.print_exc() finally: t1 = time.time() @@ -246,7 +246,7 @@ def generate_reply(question, max_new_tokens, do_sample, temperature, top_p, typi yield formatted_outputs(reply, shared.model_name) - except: + except Exception: traceback.print_exc() finally: t1 = time.time()