From f673f4a4ca2ec4634cd8a3c58897df51f61285c4 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Thu, 4 May 2023 15:56:06 -0300 Subject: [PATCH] Change --verbose behavior --- modules/text_generation.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/text_generation.py b/modules/text_generation.py index 2a994a6a..ae6cf8be 100644 --- a/modules/text_generation.py +++ b/modules/text_generation.py @@ -191,11 +191,12 @@ def generate_reply(question, state, eos_token=None, stopping_strings=[]): if not shared.is_chat(): question = apply_extensions('input', question) + if shared.args.verbose: + print(f'\n\n{question}\n--------------------\n') + # If the model is not on transformers, handle it separately and end this # function call earlier. if shared.model_type in ['rwkv', 'llamacpp']: - if shared.args.verbose: - print(f'\n\n{question}\n--------------------\n') try: if shared.args.no_stream: @@ -229,8 +230,6 @@ def generate_reply(question, state, eos_token=None, stopping_strings=[]): input_ids = encode(question, add_bos_token=state['add_bos_token'], truncation_length=get_max_prompt_length(state)) output = input_ids[0] cuda = not any((shared.args.cpu, shared.args.deepspeed, shared.args.flexgen)) - if shared.args.verbose: - print(f'\n\n{decode(input_ids[0], False)}\n--------------------\n') # Find the eos tokens eos_token_ids = [shared.tokenizer.eos_token_id] if shared.tokenizer.eos_token_id is not None else []