aboutsummaryrefslogtreecommitdiff
path: root/modules/sd_vae_approx.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-03-12 08:55:15 +0300
committerGitHub <noreply@github.com>2023-03-12 08:55:15 +0300
commitadf723a9b2a8e83c71219a33a914f5dcd01d88f8 (patch)
tree9406471fc6430fbc43d2dfebb3c7ca1ad8206f80 /modules/sd_vae_approx.py
parentddc503d14c23c9e370642448023a0dd565be098c (diff)
parentd25c4b13e4be0c89401637c769e3634e7ee456a7 (diff)
Merge pull request #8492 from zhanghua000/absolute-path
fix: gradio's ValueError about fetching extensions files
Diffstat (limited to 'modules/sd_vae_approx.py')
-rw-r--r--modules/sd_vae_approx.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/sd_vae_approx.py b/modules/sd_vae_approx.py
index 0027343a..e2f00468 100644
--- a/modules/sd_vae_approx.py
+++ b/modules/sd_vae_approx.py
@@ -35,8 +35,11 @@ def model():
global sd_vae_approx_model
if sd_vae_approx_model is None:
+ model_path = os.path.join(paths.models_path, "VAE-approx", "model.pt")
sd_vae_approx_model = VAEApprox()
- sd_vae_approx_model.load_state_dict(torch.load(os.path.join(paths.models_path, "VAE-approx", "model.pt"), map_location='cpu' if devices.device.type != 'cuda' else None))
+ if not os.path.exists(model_path):
+ model_path = os.path.join(paths.script_path, "models", "VAE-approx", "model.pt")
+ sd_vae_approx_model.load_state_dict(torch.load(model_path, map_location='cpu' if devices.device.type != 'cuda' else None))
sd_vae_approx_model.eval()
sd_vae_approx_model.to(devices.device, devices.dtype)