MCPcopy Create free account
hub / github.com/360CVGroup/FancyVideo / create_vae_diffusers_config

Function create_vae_diffusers_config

fancyvideo/utils/convert_from_ckpt.py:284–305  ·  view source on GitHub ↗

Creates a config for the diffusers based on the config of the LDM model.

(original_config, image_size: int)

Source from the content-addressed store, hash-verified

282
283
284def create_vae_diffusers_config(original_config, image_size: int):
285 """
286 Creates a config for the diffusers based on the config of the LDM model.
287 """
288 vae_params = original_config.model.params.first_stage_config.params.ddconfig
289 _ = original_config.model.params.first_stage_config.params.embed_dim
290
291 block_out_channels = [vae_params.ch * mult for mult in vae_params.ch_mult]
292 down_block_types = ["DownEncoderBlock2D"] * len(block_out_channels)
293 up_block_types = ["UpDecoderBlock2D"] * len(block_out_channels)
294
295 config = {
296 "sample_size": image_size,
297 "in_channels": vae_params.in_channels,
298 "out_channels": vae_params.out_ch,
299 "down_block_types": tuple(down_block_types),
300 "up_block_types": tuple(up_block_types),
301 "block_out_channels": tuple(block_out_channels),
302 "latent_channels": vae_params.z_channels,
303 "layers_per_block": vae_params.num_res_blocks,
304 }
305 return config
306
307
308def create_diffusers_schedular(original_config):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected