From 43a54317ee3a7ee422acd83437968a244bf2c945 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Fri, 21 Jun 2024 18:09:56 +0300 Subject: [PATCH] Fix face hires with lowvram --- CHANGELOG.md | 1 + modules/sd_models.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a8f6b344..19c778116 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,7 @@ But there's more than SD3: - fix api face-hires - fix api ip-adapter - fix memory exceptions with ROCm, thanks @Disty0! +- fix face-hires with lowvram, thanks @Disty0! - cleanup image metadata - restructure api examples: `cli/api-*` - handle theme fallback when invalid theme is specified diff --git a/modules/sd_models.py b/modules/sd_models.py index e27372492..8f04b4d22 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -764,7 +764,7 @@ def move_model(model, device=None, force=False): if model is None or device is None: return if getattr(model, 'vae', None) is not None and get_diffusers_task(model) != DiffusersTaskType.TEXT_2_IMAGE: - if device == devices.device: # force vae back to gpu if not in txt2img mode + if device == devices.device and not model.vae.device.type == "meta": # force vae back to gpu if not in txt2img mode model.vae.to(device) if hasattr(model.vae, '_hf_hook'): debug_move(f'Model move: to={device} class={model.vae.__class__} fn={sys._getframe(1).f_code.co_name}') # pylint: disable=protected-access