Unify the 3 interface modes (#3554)
This commit is contained in:
parent
bf70c19603
commit
a1a9ec895d
29 changed files with 660 additions and 714 deletions
|
@ -19,8 +19,6 @@ lora_names = []
|
|||
stop_everything = False
|
||||
generation_lock = None
|
||||
processing_message = '*Is typing...*'
|
||||
input_params = []
|
||||
reload_inputs = []
|
||||
|
||||
# UI variables
|
||||
gradio = {}
|
||||
|
@ -45,7 +43,6 @@ settings = {
|
|||
'greeting': '',
|
||||
'turn_template': '',
|
||||
'custom_stopping_strings': '',
|
||||
'stop_at_newline': False,
|
||||
'add_bos_token': True,
|
||||
'ban_eos_token': False,
|
||||
'skip_special_tokens': True,
|
||||
|
@ -57,11 +54,7 @@ settings = {
|
|||
'chat_style': 'TheEncrypted777',
|
||||
'instruction_template': 'None',
|
||||
'chat-instruct_command': 'Continue the chat dialogue below. Write a single reply for the character "<|character|>".\n\n<|prompt|>',
|
||||
'chat_generation_attempts': 1,
|
||||
'chat_generation_attempts_min': 1,
|
||||
'chat_generation_attempts_max': 10,
|
||||
'default_extensions': [],
|
||||
'chat_default_extensions': ['gallery'],
|
||||
'default_extensions': ['gallery'],
|
||||
'preset': 'simple-1',
|
||||
'prompt': 'QA',
|
||||
}
|
||||
|
@ -81,8 +74,8 @@ def str2bool(v):
|
|||
parser = argparse.ArgumentParser(formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=54))
|
||||
|
||||
# Basic settings
|
||||
parser.add_argument('--notebook', action='store_true', help='Launch the web UI in notebook mode, where the output is written to the same text box as the input.')
|
||||
parser.add_argument('--chat', action='store_true', help='Launch the web UI in chat mode with a style similar to the Character.AI website.')
|
||||
parser.add_argument('--notebook', action='store_true', help='DEPRECATED')
|
||||
parser.add_argument('--chat', action='store_true', help='DEPRECATED')
|
||||
parser.add_argument('--multi-user', action='store_true', help='Multi-user mode. Chat histories are not saved or automatically loaded. WARNING: this is highly experimental.')
|
||||
parser.add_argument('--character', type=str, help='The name of the character to load in chat mode by default.')
|
||||
parser.add_argument('--model', type=str, help='Name of the model to load by default.')
|
||||
|
@ -187,6 +180,11 @@ parser.add_argument('--multimodal-pipeline', type=str, default=None, help='The m
|
|||
args = parser.parse_args()
|
||||
args_defaults = parser.parse_args([])
|
||||
|
||||
# Deprecation warnings
|
||||
for k in ['chat', 'notebook']:
|
||||
if getattr(args, k):
|
||||
logger.warning(f'--{k} has been deprecated and will be removed soon. Please remove that flag.')
|
||||
|
||||
# Security warnings
|
||||
if args.trust_remote_code:
|
||||
logger.warning("trust_remote_code is enabled. This is dangerous.")
|
||||
|
@ -227,16 +225,7 @@ def add_extension(name):
|
|||
|
||||
|
||||
def is_chat():
|
||||
return args.chat
|
||||
|
||||
|
||||
def get_mode():
|
||||
if args.chat:
|
||||
return 'chat'
|
||||
elif args.notebook:
|
||||
return 'notebook'
|
||||
else:
|
||||
return 'default'
|
||||
return True
|
||||
|
||||
|
||||
args.loader = fix_loader_name(args.loader)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue