MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / setup

Method setup

diffusers/src/diffusers/models/vae_flax.py:790–825  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

788 dtype: jnp.dtype = jnp.float32
789
790 def setup(self):
791 self.encoder = FlaxEncoder(
792 in_channels=self.config.in_channels,
793 out_channels=self.config.latent_channels,
794 down_block_types=self.config.down_block_types,
795 block_out_channels=self.config.block_out_channels,
796 layers_per_block=self.config.layers_per_block,
797 act_fn=self.config.act_fn,
798 norm_num_groups=self.config.norm_num_groups,
799 double_z=True,
800 dtype=self.dtype,
801 )
802 self.decoder = FlaxDecoder(
803 in_channels=self.config.latent_channels,
804 out_channels=self.config.out_channels,
805 up_block_types=self.config.up_block_types,
806 block_out_channels=self.config.block_out_channels,
807 layers_per_block=self.config.layers_per_block,
808 norm_num_groups=self.config.norm_num_groups,
809 act_fn=self.config.act_fn,
810 dtype=self.dtype,
811 )
812 self.quant_conv = nn.Conv(
813 2 * self.config.latent_channels,
814 kernel_size=(1, 1),
815 strides=(1, 1),
816 padding="VALID",
817 dtype=self.dtype,
818 )
819 self.post_quant_conv = nn.Conv(
820 self.config.latent_channels,
821 kernel_size=(1, 1),
822 strides=(1, 1),
823 padding="VALID",
824 dtype=self.dtype,
825 )
826
827 def init_weights(self, rng: jax.Array) -> FrozenDict:
828 # init input tensors

Callers

nothing calls this directly

Calls 2

FlaxEncoderClass · 0.85
FlaxDecoderClass · 0.85

Tested by

no test coverage detected