mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04:00
Change --verbose behavior
This commit is contained in:
parent
97a6a50d98
commit
f673f4a4ca
@ -191,11 +191,12 @@ def generate_reply(question, state, eos_token=None, stopping_strings=[]):
|
|||||||
if not shared.is_chat():
|
if not shared.is_chat():
|
||||||
question = apply_extensions('input', question)
|
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
|
# If the model is not on transformers, handle it separately and end this
|
||||||
# function call earlier.
|
# function call earlier.
|
||||||
if shared.model_type in ['rwkv', 'llamacpp']:
|
if shared.model_type in ['rwkv', 'llamacpp']:
|
||||||
if shared.args.verbose:
|
|
||||||
print(f'\n\n{question}\n--------------------\n')
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if shared.args.no_stream:
|
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))
|
input_ids = encode(question, add_bos_token=state['add_bos_token'], truncation_length=get_max_prompt_length(state))
|
||||||
output = input_ids[0]
|
output = input_ids[0]
|
||||||
cuda = not any((shared.args.cpu, shared.args.deepspeed, shared.args.flexgen))
|
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
|
# Find the eos tokens
|
||||||
eos_token_ids = [shared.tokenizer.eos_token_id] if shared.tokenizer.eos_token_id is not None else []
|
eos_token_ids = [shared.tokenizer.eos_token_id] if shared.tokenizer.eos_token_id is not None else []
|
||||||
|
Loading…
Reference in New Issue
Block a user