diff --git a/README.md b/README.md index c5d6217b..b71db0d1 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ Optionally, you can use the following command-line flags: | `--no-cache` | Set `use_cache` to False while generating text. This reduces the VRAM usage a bit with a performance cost. | | `--xformers` | Use xformer's memory efficient attention. This should increase your tokens/s. | | `--sdp-attention` | Use torch 2.0's sdp attention. | -| `--trust-remote-code` | Set trust_remote_code=True while loading a model. Necessary for ChatGLM. | +| `--trust-remote-code` | Set trust_remote_code=True while loading a model. Necessary for ChatGLM and Falcon. | #### Accelerate 4-bit diff --git a/modules/AutoGPTQ_loader.py b/modules/AutoGPTQ_loader.py index 622b9f87..f60dda70 100644 --- a/modules/AutoGPTQ_loader.py +++ b/modules/AutoGPTQ_loader.py @@ -35,6 +35,7 @@ def load_quantized(model_name): 'device': "cuda:0" if not shared.args.cpu else "cpu", 'use_triton': shared.args.triton, 'use_safetensors': use_safetensors, + 'trust_remote_code': shared.args.trust_remote_code, 'max_memory': get_max_memory_dict() } diff --git a/modules/shared.py b/modules/shared.py index 88152a12..358b6d7a 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -110,7 +110,7 @@ parser.add_argument('--bf16', action='store_true', help='Load the model with bfl parser.add_argument('--no-cache', action='store_true', help='Set use_cache to False while generating text. This reduces the VRAM usage a bit at a performance cost.') parser.add_argument('--xformers', action='store_true', help="Use xformer's memory efficient attention. This should increase your tokens/s.") parser.add_argument('--sdp-attention', action='store_true', help="Use torch 2.0's sdp attention.") -parser.add_argument('--trust-remote-code', action='store_true', help="Set trust_remote_code=True while loading a model. Necessary for ChatGLM.") +parser.add_argument('--trust-remote-code', action='store_true', help="Set trust_remote_code=True while loading a model. Necessary for ChatGLM and Falcon.") # Accelerate 4-bit parser.add_argument('--load-in-4bit', action='store_true', help='Load the model with 4-bit precision (using bitsandbytes).') diff --git a/modules/ui.py b/modules/ui.py index f1058821..98cdb990 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -30,7 +30,7 @@ theme = gr.themes.Default( def list_model_elements(): - elements = ['cpu_memory', 'auto_devices', 'disk', 'cpu', 'bf16', 'load_in_8bit', 'load_in_4bit', 'compute_dtype', 'quant_type', 'use_double_quant', 'wbits', 'groupsize', 'model_type', 'pre_layer', 'threads', 'n_batch', 'no_mmap', 'mlock', 'n_gpu_layers', 'n_ctx', 'llama_cpp_seed'] + elements = ['cpu_memory', 'auto_devices', 'disk', 'cpu', 'bf16', 'load_in_8bit', 'trust_remote_code', 'load_in_4bit', 'compute_dtype', 'quant_type', 'use_double_quant', 'wbits', 'groupsize', 'model_type', 'pre_layer', 'autogptq', 'threads', 'n_batch', 'no_mmap', 'mlock', 'n_gpu_layers', 'n_ctx', 'llama_cpp_seed'] for i in range(torch.cuda.device_count()): elements.append(f'gpu_memory_{i}') diff --git a/requirements.txt b/requirements.txt index 3c8ce39f..0f1c622a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ colorama datasets +einops flexgen==0.1.7 gradio_client==0.2.5 gradio==3.31.0 diff --git a/server.py b/server.py index 15dd90da..43c084bc 100644 --- a/server.py +++ b/server.py @@ -366,7 +366,8 @@ def create_model_menus(): shared.gradio['cpu'] = gr.Checkbox(label="cpu", value=shared.args.cpu) shared.gradio['bf16'] = gr.Checkbox(label="bf16", value=shared.args.bf16) shared.gradio['load_in_8bit'] = gr.Checkbox(label="load-in-8bit", value=shared.args.load_in_8bit) - + shared.gradio['trust_remote_code'] = gr.Checkbox(label="trust-remote-code", value=shared.args.trust_remote_code, info='Make sure to inspect the .py files inside the model folder before loading it with this option enabled.') + with gr.Box(): gr.Markdown('Transformers 4-bit') with gr.Row(): @@ -391,9 +392,10 @@ def create_model_menus(): with gr.Column(): shared.gradio['wbits'] = gr.Dropdown(label="wbits", choices=["None", 1, 2, 3, 4, 8], value=shared.args.wbits if shared.args.wbits > 0 else "None") shared.gradio['groupsize'] = gr.Dropdown(label="groupsize", choices=["None", 32, 64, 128, 1024], value=shared.args.groupsize if shared.args.groupsize > 0 else "None") + shared.gradio['model_type'] = gr.Dropdown(label="model_type", choices=["None", "llama", "opt", "gptj"], value=shared.args.model_type or "None") with gr.Column(): - shared.gradio['model_type'] = gr.Dropdown(label="model_type", choices=["None", "llama", "opt", "gptj"], value=shared.args.model_type or "None") + shared.gradio['autogptq'] = gr.Checkbox(label="autogptq", value=shared.args.autogptq, info='AutoGPTQ needs to be manually installed from source. When enabled, gpu-memory should be used for CPU offloading instead of pre_layer.') shared.gradio['pre_layer'] = gr.Slider(label="pre_layer", minimum=0, maximum=100, value=shared.args.pre_layer[0] if shared.args.pre_layer is not None else 0) with gr.Box():