From fbeadef1308a551aead705024df86c51242e7e62 Mon Sep 17 00:00:00 2001 From: C43H66N12O12S2 <36072735+C43H66N12O12S2@users.noreply.github.com> Date: Mon, 12 Sep 2022 16:26:42 +0300 Subject: [PATCH 1/2] webui.py channels last support --- webui.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 From 8c995be44d64b291ad6f51655fde5445ff94c1ff Mon Sep 17 00:00:00 2001 From: C43H66N12O12S2 <36072735+C43H66N12O12S2@users.noreply.github.com> Date: Mon, 12 Sep 2022 16:27:23 +0300 Subject: [PATCH 2/2] Add cmd option for channels last --- modules/shared.py | 1 + 1 file changed, 1 insertion(+) 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()