from typing import List

from mflux.models.common.weights.mapping.weight_mapping import WeightMapping, WeightTarget
from mflux.models.common.weights.mapping.weight_transforms import WeightTransforms


class SeedVR2WeightMapping(WeightMapping):
    @staticmethod
    def get_transformer_mapping() -> List[WeightTarget]:
        num_blocks = 32
        return [
            WeightTarget(
                to_pattern="vid_in.proj.weight",
                from_pattern=["vid_in.proj.weight"],
            ),
            WeightTarget(
                to_pattern="vid_in.proj.bias",
                from_pattern=["vid_in.proj.bias"],
            ),
            WeightTarget(
                to_pattern="txt_in.weight",
                from_pattern=["txt_in.weight"],
            ),
            WeightTarget(
                to_pattern="txt_in.bias",
                from_pattern=["txt_in.bias"],
            ),
            WeightTarget(
                to_pattern="emb_in.proj_in.weight",
                from_pattern=["emb_in.proj_in.weight"],
            ),
            WeightTarget(
                to_pattern="emb_in.proj_in.bias",
                from_pattern=["emb_in.proj_in.bias"],
            ),
            WeightTarget(
                to_pattern="emb_in.proj_hid.weight",
                from_pattern=["emb_in.proj_hid.weight"],
            ),
            WeightTarget(
                to_pattern="emb_in.proj_hid.bias",
                from_pattern=["emb_in.proj_hid.bias"],
            ),
            WeightTarget(
                to_pattern="emb_in.proj_out.weight",
                from_pattern=["emb_in.proj_out.weight"],
            ),
            WeightTarget(
                to_pattern="emb_in.proj_out.bias",
                from_pattern=["emb_in.proj_out.bias"],
            ),
            WeightTarget(
                to_pattern="blocks.{block}.attn.proj_qkv_vid.weight",
                from_pattern=[
                    "blocks.{block}.attn.proj_qkv.vid.weight",
                    "blocks.{block}.attn.proj_qkv.all.weight",
                ],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.attn.proj_qkv_txt.weight",
                from_pattern=[
                    "blocks.{block}.attn.proj_qkv.txt.weight",
                    "blocks.{block}.attn.proj_qkv.all.weight",
                ],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.attn.norm_q_vid.weight",
                from_pattern=[
                    "blocks.{block}.attn.norm_q.vid.weight",
                    "blocks.{block}.attn.norm_q.all.weight",
                ],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.attn.norm_q_txt.weight",
                from_pattern=[
                    "blocks.{block}.attn.norm_q.txt.weight",
                    "blocks.{block}.attn.norm_q.all.weight",
                ],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.attn.norm_k_vid.weight",
                from_pattern=[
                    "blocks.{block}.attn.norm_k.vid.weight",
                    "blocks.{block}.attn.norm_k.all.weight",
                ],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.attn.norm_k_txt.weight",
                from_pattern=[
                    "blocks.{block}.attn.norm_k.txt.weight",
                    "blocks.{block}.attn.norm_k.all.weight",
                ],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.attn.proj_out_vid.weight",
                from_pattern=[
                    "blocks.{block}.attn.proj_out.vid.weight",
                    "blocks.{block}.attn.proj_out.all.weight",
                ],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.attn.proj_out_vid.bias",
                from_pattern=[
                    "blocks.{block}.attn.proj_out.vid.bias",
                    "blocks.{block}.attn.proj_out.all.bias",
                ],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.attn.proj_out_txt.weight",
                from_pattern=[
                    "blocks.{block}.attn.proj_out.txt.weight",
                    "blocks.{block}.attn.proj_out.all.weight",
                ],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.attn.proj_out_txt.bias",
                from_pattern=[
                    "blocks.{block}.attn.proj_out.txt.bias",
                    "blocks.{block}.attn.proj_out.all.bias",
                ],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.attn.rope.freqs",
                from_pattern=["blocks.{block}.attn.rope.rope.freqs"],
                max_blocks=num_blocks,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.mlp.vid.proj_in.weight",
                from_pattern=["blocks.{block}.mlp.vid.proj_in.weight"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.mlp.vid.proj_in_gate.weight",
                from_pattern=["blocks.{block}.mlp.vid.proj_in_gate.weight"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.mlp.vid.proj_out.weight",
                from_pattern=["blocks.{block}.mlp.vid.proj_out.weight"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.mlp.txt.proj_in.weight",
                from_pattern=["blocks.{block}.mlp.txt.proj_in.weight"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.mlp.txt.proj_in_gate.weight",
                from_pattern=["blocks.{block}.mlp.txt.proj_in_gate.weight"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.mlp.txt.proj_out.weight",
                from_pattern=["blocks.{block}.mlp.txt.proj_out.weight"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.mlp.all.proj_in.weight",
                from_pattern=["blocks.{block}.mlp.all.proj_in.weight"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.mlp.all.proj_in_gate.weight",
                from_pattern=["blocks.{block}.mlp.all.proj_in_gate.weight"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.mlp.all.proj_out.weight",
                from_pattern=["blocks.{block}.mlp.all.proj_out.weight"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_vid.attn_shift",
                from_pattern=["blocks.{block}.ada.vid.attn_shift"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_vid.attn_scale",
                from_pattern=["blocks.{block}.ada.vid.attn_scale"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_vid.attn_gate",
                from_pattern=["blocks.{block}.ada.vid.attn_gate"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_vid.mlp_shift",
                from_pattern=["blocks.{block}.ada.vid.mlp_shift"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_vid.mlp_scale",
                from_pattern=["blocks.{block}.ada.vid.mlp_scale"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_vid.mlp_gate",
                from_pattern=["blocks.{block}.ada.vid.mlp_gate"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_txt.attn_shift",
                from_pattern=["blocks.{block}.ada.txt.attn_shift"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_txt.attn_scale",
                from_pattern=["blocks.{block}.ada.txt.attn_scale"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_txt.attn_gate",
                from_pattern=["blocks.{block}.ada.txt.attn_gate"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_txt.mlp_shift",
                from_pattern=["blocks.{block}.ada.txt.mlp_shift"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_txt.mlp_scale",
                from_pattern=["blocks.{block}.ada.txt.mlp_scale"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_txt.mlp_gate",
                from_pattern=["blocks.{block}.ada.txt.mlp_gate"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_all.attn_shift",
                from_pattern=["blocks.{block}.ada.all.attn_shift"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_all.attn_scale",
                from_pattern=["blocks.{block}.ada.all.attn_scale"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_all.attn_gate",
                from_pattern=["blocks.{block}.ada.all.attn_gate"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_all.mlp_shift",
                from_pattern=["blocks.{block}.ada.all.mlp_shift"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_all.mlp_scale",
                from_pattern=["blocks.{block}.ada.all.mlp_scale"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="blocks.{block}.ada.params_all.mlp_gate",
                from_pattern=["blocks.{block}.ada.all.mlp_gate"],
                max_blocks=num_blocks,
                required=False,
            ),
            WeightTarget(
                to_pattern="vid_out_norm.weight",
                from_pattern=["vid_out_norm.weight"],
            ),
            WeightTarget(
                to_pattern="out_shift",
                from_pattern=["vid_out_ada.out_shift"],
            ),
            WeightTarget(
                to_pattern="out_scale",
                from_pattern=["vid_out_ada.out_scale"],
            ),
            WeightTarget(
                to_pattern="vid_out.proj.weight",
                from_pattern=["vid_out.proj.weight"],
            ),
            WeightTarget(
                to_pattern="vid_out.proj.bias",
                from_pattern=["vid_out.proj.bias"],
            ),
        ]

    @staticmethod
    def get_vae_mapping() -> List[WeightTarget]:
        return [
            WeightTarget(
                to_pattern="encoder.conv_in.weight",
                from_pattern=["encoder.conv_in.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="encoder.conv_in.bias",
                from_pattern=["encoder.conv_in.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.resnets.{res}.conv1.weight",
                from_pattern=["encoder.down_blocks.{block}.resnets.{res}.conv1.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.resnets.{res}.conv1.bias",
                from_pattern=["encoder.down_blocks.{block}.resnets.{res}.conv1.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.resnets.{res}.conv2.weight",
                from_pattern=["encoder.down_blocks.{block}.resnets.{res}.conv2.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.resnets.{res}.conv2.bias",
                from_pattern=["encoder.down_blocks.{block}.resnets.{res}.conv2.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.resnets.{res}.norm1.weight",
                from_pattern=["encoder.down_blocks.{block}.resnets.{res}.norm1.weight"],
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.resnets.{res}.norm1.bias",
                from_pattern=["encoder.down_blocks.{block}.resnets.{res}.norm1.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.resnets.{res}.norm2.weight",
                from_pattern=["encoder.down_blocks.{block}.resnets.{res}.norm2.weight"],
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.resnets.{res}.norm2.bias",
                from_pattern=["encoder.down_blocks.{block}.resnets.{res}.norm2.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.resnets.{res}.conv_shortcut.weight",
                from_pattern=["encoder.down_blocks.{block}.resnets.{res}.conv_shortcut.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
                required=False,
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.resnets.{res}.conv_shortcut.bias",
                from_pattern=["encoder.down_blocks.{block}.resnets.{res}.conv_shortcut.bias"],
                required=False,
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.downsamplers.0.conv.weight",
                from_pattern=["encoder.down_blocks.{block}.downsamplers.0.conv.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
                required=False,
            ),
            WeightTarget(
                to_pattern="encoder.down_blocks.{block}.downsamplers.0.conv.bias",
                from_pattern=["encoder.down_blocks.{block}.downsamplers.0.conv.bias"],
                required=False,
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.resnets.{i}.conv1.weight",
                from_pattern=["encoder.mid_block.resnets.{i}.conv1.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.resnets.{i}.conv1.bias",
                from_pattern=["encoder.mid_block.resnets.{i}.conv1.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.resnets.{i}.conv2.weight",
                from_pattern=["encoder.mid_block.resnets.{i}.conv2.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.resnets.{i}.conv2.bias",
                from_pattern=["encoder.mid_block.resnets.{i}.conv2.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.resnets.{i}.norm1.weight",
                from_pattern=["encoder.mid_block.resnets.{i}.norm1.weight"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.resnets.{i}.norm1.bias",
                from_pattern=["encoder.mid_block.resnets.{i}.norm1.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.resnets.{i}.norm2.weight",
                from_pattern=["encoder.mid_block.resnets.{i}.norm2.weight"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.resnets.{i}.norm2.bias",
                from_pattern=["encoder.mid_block.resnets.{i}.norm2.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.attentions.0.group_norm.weight",
                from_pattern=["encoder.mid_block.attentions.0.group_norm.weight"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.attentions.0.group_norm.bias",
                from_pattern=["encoder.mid_block.attentions.0.group_norm.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.attentions.0.to_q.weight",
                from_pattern=["encoder.mid_block.attentions.0.to_q.weight"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.attentions.0.to_q.bias",
                from_pattern=["encoder.mid_block.attentions.0.to_q.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.attentions.0.to_k.weight",
                from_pattern=["encoder.mid_block.attentions.0.to_k.weight"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.attentions.0.to_k.bias",
                from_pattern=["encoder.mid_block.attentions.0.to_k.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.attentions.0.to_v.weight",
                from_pattern=["encoder.mid_block.attentions.0.to_v.weight"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.attentions.0.to_v.bias",
                from_pattern=["encoder.mid_block.attentions.0.to_v.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.attentions.0.to_out.0.weight",
                from_pattern=["encoder.mid_block.attentions.0.to_out.0.weight"],
            ),
            WeightTarget(
                to_pattern="encoder.mid_block.attentions.0.to_out.0.bias",
                from_pattern=["encoder.mid_block.attentions.0.to_out.0.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.conv_norm_out.weight",
                from_pattern=["encoder.conv_norm_out.weight"],
            ),
            WeightTarget(
                to_pattern="encoder.conv_norm_out.bias",
                from_pattern=["encoder.conv_norm_out.bias"],
            ),
            WeightTarget(
                to_pattern="encoder.conv_out.weight",
                from_pattern=["encoder.conv_out.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="encoder.conv_out.bias",
                from_pattern=["encoder.conv_out.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.conv_in.weight",
                from_pattern=["decoder.conv_in.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="decoder.conv_in.bias",
                from_pattern=["decoder.conv_in.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.resnets.{i}.conv1.weight",
                from_pattern=["decoder.mid_block.resnets.{i}.conv1.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.resnets.{i}.conv1.bias",
                from_pattern=["decoder.mid_block.resnets.{i}.conv1.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.resnets.{i}.conv2.weight",
                from_pattern=["decoder.mid_block.resnets.{i}.conv2.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.resnets.{i}.conv2.bias",
                from_pattern=["decoder.mid_block.resnets.{i}.conv2.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.resnets.{i}.norm1.weight",
                from_pattern=["decoder.mid_block.resnets.{i}.norm1.weight"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.resnets.{i}.norm1.bias",
                from_pattern=["decoder.mid_block.resnets.{i}.norm1.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.resnets.{i}.norm2.weight",
                from_pattern=["decoder.mid_block.resnets.{i}.norm2.weight"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.resnets.{i}.norm2.bias",
                from_pattern=["decoder.mid_block.resnets.{i}.norm2.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.attentions.0.group_norm.weight",
                from_pattern=["decoder.mid_block.attentions.0.group_norm.weight"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.attentions.0.group_norm.bias",
                from_pattern=["decoder.mid_block.attentions.0.group_norm.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.attentions.0.to_q.weight",
                from_pattern=["decoder.mid_block.attentions.0.to_q.weight"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.attentions.0.to_q.bias",
                from_pattern=["decoder.mid_block.attentions.0.to_q.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.attentions.0.to_k.weight",
                from_pattern=["decoder.mid_block.attentions.0.to_k.weight"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.attentions.0.to_k.bias",
                from_pattern=["decoder.mid_block.attentions.0.to_k.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.attentions.0.to_v.weight",
                from_pattern=["decoder.mid_block.attentions.0.to_v.weight"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.attentions.0.to_v.bias",
                from_pattern=["decoder.mid_block.attentions.0.to_v.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.attentions.0.to_out.0.weight",
                from_pattern=["decoder.mid_block.attentions.0.to_out.0.weight"],
            ),
            WeightTarget(
                to_pattern="decoder.mid_block.attentions.0.to_out.0.bias",
                from_pattern=["decoder.mid_block.attentions.0.to_out.0.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.resnets.{res}.conv1.weight",
                from_pattern=["decoder.up_blocks.{block}.resnets.{res}.conv1.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.resnets.{res}.conv1.bias",
                from_pattern=["decoder.up_blocks.{block}.resnets.{res}.conv1.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.resnets.{res}.conv2.weight",
                from_pattern=["decoder.up_blocks.{block}.resnets.{res}.conv2.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.resnets.{res}.conv2.bias",
                from_pattern=["decoder.up_blocks.{block}.resnets.{res}.conv2.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.resnets.{res}.norm1.weight",
                from_pattern=["decoder.up_blocks.{block}.resnets.{res}.norm1.weight"],
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.resnets.{res}.norm1.bias",
                from_pattern=["decoder.up_blocks.{block}.resnets.{res}.norm1.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.resnets.{res}.norm2.weight",
                from_pattern=["decoder.up_blocks.{block}.resnets.{res}.norm2.weight"],
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.resnets.{res}.norm2.bias",
                from_pattern=["decoder.up_blocks.{block}.resnets.{res}.norm2.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.resnets.{res}.conv_shortcut.weight",
                from_pattern=["decoder.up_blocks.{block}.resnets.{res}.conv_shortcut.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
                required=False,
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.resnets.{res}.conv_shortcut.bias",
                from_pattern=["decoder.up_blocks.{block}.resnets.{res}.conv_shortcut.bias"],
                required=False,
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.upsamplers.0.conv.weight",
                from_pattern=["decoder.up_blocks.{block}.upsamplers.0.conv.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
                required=False,
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.upsamplers.0.conv.bias",
                from_pattern=["decoder.up_blocks.{block}.upsamplers.0.conv.bias"],
                required=False,
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.upsamplers.0.upscale_conv.weight",
                from_pattern=["decoder.up_blocks.{block}.upsamplers.0.upscale_conv.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
                required=False,
            ),
            WeightTarget(
                to_pattern="decoder.up_blocks.{block}.upsamplers.0.upscale_conv.bias",
                from_pattern=["decoder.up_blocks.{block}.upsamplers.0.upscale_conv.bias"],
                required=False,
            ),
            WeightTarget(
                to_pattern="decoder.conv_norm_out.weight",
                from_pattern=["decoder.conv_norm_out.weight"],
            ),
            WeightTarget(
                to_pattern="decoder.conv_norm_out.bias",
                from_pattern=["decoder.conv_norm_out.bias"],
            ),
            WeightTarget(
                to_pattern="decoder.conv_out.weight",
                from_pattern=["decoder.conv_out.weight"],
                transform=WeightTransforms.transpose_conv3d_weight,
            ),
            WeightTarget(
                to_pattern="decoder.conv_out.bias",
                from_pattern=["decoder.conv_out.bias"],
            ),
        ]
