mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
fix(vae): read the scale factor off the autoencoder instance
get_vae_scale_factor knew the ratio only for the pipeline and VAE class names in its table and fell back to 8 for everything else. A repo that subclasses a video autoencoder misses the table, so the request size was rounded to a smaller multiple than the pipeline uses and the latent preview unpack failed on heights that are not a multiple of 32. diffusers video autoencoders carry spatial_compression_ratio on the instance; use it before the default.
This commit is contained in:
@@ -49,6 +49,8 @@ def get_vae_scale_factor(model: DiffusionPipeline | None = None):
|
||||
vae_scale_factor = model.pipe.vae_scale_factor
|
||||
elif hasattr(model, 'config') and hasattr(model.config, 'vae_scale_factor'):
|
||||
vae_scale_factor = model.config.vae_scale_factor
|
||||
elif hasattr(model, 'vae') and hasattr(model.vae, 'spatial_compression_ratio'):
|
||||
vae_scale_factor = model.vae.spatial_compression_ratio # video autoencoders carry the ratio on the instance, which also covers subclasses the name table misses
|
||||
else:
|
||||
# log.warning(f'VAE: cls={model.__class__.__name__ if model else "None"} scale=unknown')
|
||||
vae_scale_factor = 8
|
||||
|
||||
Reference in New Issue
Block a user