diff --git a/modules/shared.py b/modules/shared.py index c0f712c9..720519b0 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -44,6 +44,7 @@ parser.add_argument("--hide-ui-dir-config", action='store_true', help="hide dire parser.add_argument("--ui-settings-file", type=str, help="filename to use for ui settings", default=os.path.join(script_path, 'config.json')) parser.add_argument("--gradio-debug", action='store_true', help="launch gradio with --debug option") parser.add_argument("--gradio-auth", type=str, help='set gradio authentication like "username:password"; or comma-delimit multiple like "u1:p1,u2:p2,u3:p3"', default=None) +parser.add_argument("--channelslast", action='store_true', help="Enable Channels Last Memory Type") cmd_opts = parser.parse_args() diff --git a/webui.py b/webui.py index a6d7ba6c..cc666e6f 100644 --- a/webui.py +++ b/webui.py @@ -49,7 +49,8 @@ def load_model_from_config(config, ckpt, verbose=False): if len(u) > 0 and verbose: print("unexpected keys:") print(u) - + if cmd_opts.channelslast: + model = model.to(memory_format=torch.channels_last) model.eval() return model