From 3d48933f274ca571c88bb225b22950b6efb75324 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 6 Aug 2023 18:58:59 -0700 Subject: [PATCH] Remove ancient deprecation warnings --- modules/shared.py | 62 +++++++++++++++++------------------------------ 1 file changed, 22 insertions(+), 40 deletions(-) diff --git a/modules/shared.py b/modules/shared.py index be5be109..c2f5e0f2 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -6,34 +6,29 @@ import yaml from modules.logging_colors import logger -generation_lock = None + +# Model variables model = None tokenizer = None -is_seq2seq = False model_name = "None" -lora_names = [] +is_seq2seq = False model_dirty_from_training = False +lora_names = [] -# Chat variables +# Generation variables stop_everything = False +generation_lock = None processing_message = '*Is typing...*' +input_params = [] +reload_inputs = [] -# UI elements (buttons, sliders, HTML, etc) +# UI variables gradio = {} - -# For keeping the values of UI elements on page reload persistent_interface_state = {} - -input_params = [] # Generation input parameters -reload_inputs = [] # Parameters for reloading the chat interface - -# For restarting the interface need_restart = False - -# To prevent the persistent chat history from being loaded when -# a session JSON file is being loaded in chat mode session_is_loading = False +# UI defaults settings = { 'dark_theme': True, 'autoload_model': False, @@ -148,8 +143,6 @@ parser.add_argument('--warmup_autotune', action='store_true', help='(triton) Ena parser.add_argument('--fused_mlp', action='store_true', help='(triton) Enable fused mlp.') # AutoGPTQ -parser.add_argument('--gptq-for-llama', action='store_true', help='DEPRECATED') -parser.add_argument('--autogptq', action='store_true', help='DEPRECATED') parser.add_argument('--triton', action='store_true', help='Use triton.') parser.add_argument('--no_inject_fused_attention', action='store_true', help='Do not use fused attention (lowers VRAM requirements).') parser.add_argument('--no_inject_fused_mlp', action='store_true', help='Triton mode only: Do not use fused MLP (lowers VRAM requirements).') @@ -196,14 +189,6 @@ parser.add_argument('--multimodal-pipeline', type=str, default=None, help='The m args = parser.parse_args() args_defaults = parser.parse_args([]) -# Deprecation warnings -if args.autogptq: - logger.warning('--autogptq has been deprecated and will be removed soon. Use --loader autogptq instead.') - args.loader = 'autogptq' -if args.gptq_for_llama: - logger.warning('--gptq-for-llama has been deprecated and will be removed soon. Use --loader gptq-for-llama instead.') - args.loader = 'gptq-for-llama' - # Security warnings if args.trust_remote_code: logger.warning("trust_remote_code is enabled. This is dangerous.") @@ -231,10 +216,6 @@ def fix_loader_name(name): return 'ExLlama_HF' -if args.loader is not None: - args.loader = fix_loader_name(args.loader) - - def add_extension(name): if args.extensions is None: args.extensions = [name] @@ -242,15 +223,6 @@ def add_extension(name): args.extensions.append(name) -# Activating the API extension -if args.api or args.public_api: - add_extension('api') - -# Activating the multimodal extension -if args.multimodal_pipeline is not None: - add_extension('multimodal') - - def is_chat(): return args.chat @@ -264,14 +236,24 @@ def get_mode(): return 'default' -# Loading model-specific settings +args.loader = fix_loader_name(args.loader) + +# Activate the API extension +if args.api or args.public_api: + add_extension('api') + +# Activate the multimodal extension +if args.multimodal_pipeline is not None: + add_extension('multimodal') + +# Load model-specific settings with Path(f'{args.model_dir}/config.yaml') as p: if p.exists(): model_config = yaml.safe_load(open(p, 'r').read()) else: model_config = {} -# Applying user-defined model settings +# Load custom model-specific settings with Path(f'{args.model_dir}/config-user.yaml') as p: if p.exists(): user_config = yaml.safe_load(open(p, 'r').read())