I need to initialize AutoencoderKL with the same configuration as in…
- User
I need to initialize AutoencoderKL with the same configuration as in StableDiffusion3Pipeline that I've saved into
"path/to/saved_pretrained/"So I need to somehow load the config file but with random initialization
Assistant
Based on the provided context and the diffusers repository code, here's how you can initialize an AutoencoderKL with the same configuration as a saved StableDiffusion3 model but with random weights:
pythonfrom diffusers import AutoencoderKL # First load just the config from the saved pipeline config_dict = AutoencoderKL.load_config("path/to/saved_pretrained/", subfolder="vae") # Initialize a new AutoencoderKL with the loaded config but random weights vae = AutoencoderKL.from_config(config_dict)This approach will:
- Load only the configuration file from the saved VAE without loading the weights
- Create a new AutoencoderKL instance with the same architecture/configuration but randomly initialized weights
The
from_configmethod is inherited from theConfigMixinclass and allows initializing models with a specific configuration while avoiding loading pretrained weights.This is particularly useful when you want to maintain the same model architecture but start training from scratch with random initialization.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.