Change --verbose behavior

This commit is contained in:
oobabooga 2023-05-04 15:56:06 -03:00
parent 97a6a50d98
commit f673f4a4ca

View File

@ -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 []