fix(api): load pretrained VAE from original path
This commit is contained in:
parent
4fd50984f0
commit
e7da2cf8a6
|
@ -381,11 +381,11 @@ def convert_diffusion_diffusers(
|
||||||
|
|
||||||
if replace_vae is not None:
|
if replace_vae is not None:
|
||||||
vae_path = path.join(conversion.model_path, replace_vae)
|
vae_path = path.join(conversion.model_path, replace_vae)
|
||||||
vae_file = check_ext(replace_vae, RESOLVE_FORMATS)
|
vae_file = check_ext(vae_path, RESOLVE_FORMATS)
|
||||||
if vae_file[0]:
|
if vae_file[0]:
|
||||||
pipeline.vae = AutoencoderKL.from_single_file(vae_path)
|
pipeline.vae = AutoencoderKL.from_single_file(vae_path)
|
||||||
else:
|
else:
|
||||||
pipeline.vae = AutoencoderKL.from_pretrained(vae_path)
|
pipeline.vae = AutoencoderKL.from_pretrained(replace_vae)
|
||||||
|
|
||||||
if is_torch_2_0:
|
if is_torch_2_0:
|
||||||
pipeline.unet.set_attn_processor(AttnProcessor())
|
pipeline.unet.set_attn_processor(AttnProcessor())
|
||||||
|
|
|
@ -69,8 +69,8 @@ def convert_diffusion_diffusers_xl(
|
||||||
logger.debug("loading VAE from single tensor file: %s", vae_path)
|
logger.debug("loading VAE from single tensor file: %s", vae_path)
|
||||||
pipeline.vae = AutoencoderKL.from_single_file(vae_path)
|
pipeline.vae = AutoencoderKL.from_single_file(vae_path)
|
||||||
else:
|
else:
|
||||||
logger.debug("loading pretrained VAE from path: %s", vae_path)
|
logger.debug("loading pretrained VAE from path: %s", replace_vae)
|
||||||
pipeline.vae = AutoencoderKL.from_pretrained(vae_path)
|
pipeline.vae = AutoencoderKL.from_pretrained(replace_vae)
|
||||||
|
|
||||||
if path.exists(temp_path):
|
if path.exists(temp_path):
|
||||||
logger.debug("torch model already exists for %s: %s", source, temp_path)
|
logger.debug("torch model already exists for %s: %s", source, temp_path)
|
||||||
|
|
Loading…
Reference in New Issue