class_docstr: A modified conditional 2D UNet model that takes a noisy sample, conditional state, and a timestep and returns a
  sample shaped output.
  
  This model inherits from [`ModelMixin`]. Check the superclass documentation for it's generic methods implemented
  for all models (such as downloading or saving).
docstr: Freeze the weights of just the UNet2DConditionModel, and leave the motion modules
  unfrozen for fine tuning.
docstr_tok: ["Freeze","the","weights","of","just","the","UNet2DConditionModel",",","and","leave","the","motion","modules","unfrozen","for","fine","tuning","."]
code: def freeze_unet2d_params(self) -> None:
      """Freeze the weights of just the UNet2DConditionModel, and leave the motion modules
      unfrozen for fine tuning.
      """
      # Freeze everything
      for param in self.parameters():
          param.requires_grad = False
  
      # Unfreeze Motion Modules
      for down_block in self.down_blocks:
          motion_modules = down_block.motion_modules
          for param in motion_modules.parameters():
              param.requires_grad = True
  
      for up_block in self.up_blocks:
          motion_modules = up_block.motion_modules
          for param in motion_modules.parameters():
              param.requires_grad = True
  
      if hasattr(self.mid_block, "motion_modules"):
          motion_modules = self.mid_block.motion_modules
          for param in motion_modules.parameters():
              param.requires_grad = True
  
imports: from typing import Any, Dict, Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.utils.checkpoint
  from ..configuration_utils import ConfigMixin, register_to_config
  from ..loaders import UNet2DConditionLoadersMixin
  from ..utils import logging
  from .attention_processor import ADDED_KV_ATTENTION_PROCESSORS, CROSS_ATTENTION_PROCESSORS, AttentionProcessor, AttnAddedKVProcessor, AttnProcessor
  from .embeddings import TimestepEmbedding, Timesteps
  from .modeling_utils import ModelMixin
  from .transformer_temporal import TransformerTemporalModel
  from .unet_2d_blocks import UNetMidBlock2DCrossAttn
  from .unet_2d_condition import UNet2DConditionModel
  from .unet_3d_blocks import CrossAttnDownBlockMotion, CrossAttnUpBlockMotion, DownBlockMotion, UNetMidBlockCrossAttnMotion, UpBlockMotion, get_down_block, get_up_block
  from .unet_3d_condition import UNet3DConditionOutput
label_desc: Use image node_id 3 for calling the UNetMotionModel obj's underlying member method code with example usage: obj.freeze_unet2d_params() without return types