Quantumbraid's picture
download
raw
520 Bytes
from diffusers import AutoencoderKL
def load_vae(vae_path, dtype):
try:
vae = AutoencoderKL.from_pretrained(
vae_path,
torch_dtype=dtype,
)
except Exception as e:
try:
vae = AutoencoderKL.from_pretrained(
vae_path,
subfolder="vae",
torch_dtype=dtype,
)
except Exception as e:
raise ValueError(f"Failed to load VAE from {vae_path}: {e}")
vae.to(dtype)
return vae

Xet Storage Details

Size:
520 Bytes
·
Xet hash:
4bd7d6ce2ffd4192f6f339a2989872eb50a3e5c2dee36361c6c3f545850ddeab

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.