From 81087207bc62026a3e6941553bf98f2da8c799d0 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Wed, 24 Aug 2022 00:38:53 +0300 Subject: [PATCH] --no-half commandline option to disable .half() --- webui.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webui.py b/webui.py index e1dc2c0f..7aec795b 100644 --- a/webui.py +++ b/webui.py @@ -46,6 +46,7 @@ parser.add_argument("--ckpt", type=str, default="models/ldm/stable-diffusion-v1/ parser.add_argument("--precision", type=str, help="evaluate at this precision", choices=["full", "autocast"], default="autocast") parser.add_argument("--gfpgan-dir", type=str, help="GFPGAN directory", default='./GFPGAN') parser.add_argument("--no-verify-input", action='store_true', help="do not verify input to check if it's too long") +parser.add_argument("--no-half", action='store_true', help="do not switch the model to 16-bit floats") opt = parser.parse_args() GFPGAN_dir = opt.gfpgan_dir @@ -144,7 +145,7 @@ config = OmegaConf.load("configs/stable-diffusion/v1-inference.yaml") model = load_model_from_config(config, "models/ldm/stable-diffusion-v1/model.ckpt") device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu") -model = model.half().to(device) +model = (model if opt.no_half else model.half()).to(device) def image_grid(imgs, batch_size, round_down=False):