diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-03-12 05:55:15 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-12 05:55:15 +0000 |
commit | adf723a9b2a8e83c71219a33a914f5dcd01d88f8 (patch) | |
tree | 9406471fc6430fbc43d2dfebb3c7ca1ad8206f80 /modules/sd_vae_approx.py | |
parent | ddc503d14c23c9e370642448023a0dd565be098c (diff) | |
parent | d25c4b13e4be0c89401637c769e3634e7ee456a7 (diff) | |
download | stable-diffusion-webui-gfx803-adf723a9b2a8e83c71219a33a914f5dcd01d88f8.tar.gz stable-diffusion-webui-gfx803-adf723a9b2a8e83c71219a33a914f5dcd01d88f8.tar.bz2 stable-diffusion-webui-gfx803-adf723a9b2a8e83c71219a33a914f5dcd01d88f8.zip |
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.py | 5 |
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)
|