class_docstr: A conditional 3D 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).
  
  Parameters:
      sample_size (`int` or `Tuple[int, int]`, *optional*, defaults to `None`):
          Height and width of input/output sample.
      in_channels (`int`, *optional*, defaults to 4): The number of channels in the input sample.
      out_channels (`int`, *optional*, defaults to 4): The number of channels in the output.
      down_block_types (`Tuple[str]`, *optional*, defaults to `("CrossAttnDownBlock2D", "CrossAttnDownBlock2D", "CrossAttnDownBlock2D", "DownBlock2D")`):
          The tuple of downsample blocks to use.
      up_block_types (`Tuple[str]`, *optional*, defaults to `("UpBlock2D", "CrossAttnUpBlock2D", "CrossAttnUpBlock2D", "CrossAttnUpBlock2D")`):
          The tuple of upsample blocks to use.
      block_out_channels (`Tuple[int]`, *optional*, defaults to `(320, 640, 1280, 1280)`):
          The tuple of output channels for each block.
      layers_per_block (`int`, *optional*, defaults to 2): The number of layers per block.
      downsample_padding (`int`, *optional*, defaults to 1): The padding to use for the downsampling convolution.
      mid_block_scale_factor (`float`, *optional*, defaults to 1.0): The scale factor to use for the mid block.
      act_fn (`str`, *optional*, defaults to `"silu"`): The activation function to use.
      norm_num_groups (`int`, *optional*, defaults to 32): The number of groups to use for the normalization.
          If `None`, normalization and activation layers is skipped in post-processing.
      norm_eps (`float`, *optional*, defaults to 1e-5): The epsilon to use for the normalization.
      cross_attention_dim (`int`, *optional*, defaults to 1280): The dimension of the cross attention features.
      attention_head_dim (`int`, *optional*, defaults to 8): The dimension of the attention heads.
      num_attention_heads (`int`, *optional*): The number of attention heads.
class_docstr_tok: ["A","conditional","3D","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",")",".","Parameters",":","sample_size","(","`","int","`","or","`","Tuple","[","int",",","int","]","`",",","*","optional","*",",","defaults","to","`","None","`",")",":","Height","and","width","of","input\/output","sample",".","in_channels","(","`","int","`",",","*","optional","*",",","defaults","to","4",")",":","The","number","of","channels","in","the","input","sample",".","out_channels","(","`","int","`",",","*","optional","*",",","defaults","to","4",")",":","The","number","of","channels","in","the","output",".","down_block_types","(","`","Tuple","[","str","]","`",",","*","optional","*",",","defaults","to","`","(","``","CrossAttnDownBlock2D","''",",","``","CrossAttnDownBlock2D","''",",","``","CrossAttnDownBlock2D","''",",","``","DownBlock2D","''",")","`",")",":","The","tuple","of","downsample","blocks","to","use",".","up_block_types","(","`","Tuple","[","str","]","`",",","*","optional","*",",","defaults","to","`","(","``","UpBlock2D","''",",","``","CrossAttnUpBlock2D","''",",","``","CrossAttnUpBlock2D","''",",","``","CrossAttnUpBlock2D","''",")","`",")",":","The","tuple","of","upsample","blocks","to","use",".","block_out_channels","(","`","Tuple","[","int","]","`",",","*","optional","*",",","defaults","to","`","(","320",",","640",",","1280",",","1280",")","`",")",":","The","tuple","of","output","channels","for","each","block",".","layers_per_block","(","`","int","`",",","*","optional","*",",","defaults","to","2",")",":","The","number","of","layers","per","block",".","downsample_padding","(","`","int","`",",","*","optional","*",",","defaults","to","1",")",":","The","padding","to","use","for","the","downsampling","convolution",".","mid_block_scale_factor","(","`","float","`",",","*","optional","*",",","defaults","to","1.0",")",":","The","scale","factor","to","use","for","the","mid","block",".","act_fn","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","silu","''","`",")",":","The","activation","function","to","use",".","norm_num_groups","(","`","int","`",",","*","optional","*",",","defaults","to","32",")",":","The","number","of","groups","to","use","for","the","normalization",".","If","`","None","`",",","normalization","and","activation","layers","is","skipped","in","post-processing",".","norm_eps","(","`","float","`",",","*","optional","*",",","defaults","to","1e-5",")",":","The","epsilon","to","use","for","the","normalization",".","cross_attention_dim","(","`","int","`",",","*","optional","*",",","defaults","to","1280",")",":","The","dimension","of","the","cross","attention","features",".","attention_head_dim","(","`","int","`",",","*","optional","*",",","defaults","to","8",")",":","The","dimension","of","the","attention","heads",".","num_attention_heads","(","`","int","`",",","*","optional","*",")",":","The","number","of","attention","heads","."]
docstr: Enables the FreeU mechanism from https://arxiv.org/abs/2309.11497.
  
  The suffixes after the scaling factors represent the stage blocks where they are being applied.
  
  Please refer to the [official repository](https://github.com/ChenyangSi/FreeU) for combinations of values that
  are known to work well for different pipelines such as Stable Diffusion v1, v2, and Stable Diffusion XL.
  
  Args:
      s1 (`float`):
          Scaling factor for stage 1 to attenuate the contributions of the skip features. This is done to
          mitigate the "oversmoothing effect" in the enhanced denoising process.
      s2 (`float`):
          Scaling factor for stage 2 to attenuate the contributions of the skip features. This is done to
          mitigate the "oversmoothing effect" in the enhanced denoising process.
      b1 (`float`): Scaling factor for stage 1 to amplify the contributions of backbone features.
      b2 (`float`): Scaling factor for stage 2 to amplify the contributions of backbone features.
docstr_tok: ["Enables","the","FreeU","mechanism","from","https",":","\/\/arxiv.org\/abs\/2309.11497",".","The","suffixes","after","the","scaling","factors","represent","the","stage","blocks","where","they","are","being","applied",".","Please","refer","to","the","[","official","repository","]","(","https",":","\/\/github.com\/ChenyangSi\/FreeU",")","for","combinations","of","values","that","are","known","to","work","well","for","different","pipelines","such","as","Stable","Diffusion","v1",",","v2",",","and","Stable","Diffusion","XL",".","Args",":","s1","(","`","float","`",")",":","Scaling","factor","for","stage","1","to","attenuate","the","contributions","of","the","skip","features",".","This","is","done","to","mitigate","the","``","oversmoothing","effect","''","in","the","enhanced","denoising","process",".","s2","(","`","float","`",")",":","Scaling","factor","for","stage","2","to","attenuate","the","contributions","of","the","skip","features",".","This","is","done","to","mitigate","the","``","oversmoothing","effect","''","in","the","enhanced","denoising","process",".","b1","(","`","float","`",")",":","Scaling","factor","for","stage","1","to","amplify","the","contributions","of","backbone","features",".","b2","(","`","float","`",")",":","Scaling","factor","for","stage","2","to","amplify","the","contributions","of","backbone","features","."]
code: def enable_freeu(self, s1, s2, b1, b2):
      r"""Enables the FreeU mechanism from https://arxiv.org/abs/2309.11497.
  
      The suffixes after the scaling factors represent the stage blocks where they are being applied.
  
      Please refer to the [official repository](https://github.com/ChenyangSi/FreeU) for combinations of values that
      are known to work well for different pipelines such as Stable Diffusion v1, v2, and Stable Diffusion XL.
  
      Args:
          s1 (`float`):
              Scaling factor for stage 1 to attenuate the contributions of the skip features. This is done to
              mitigate the "oversmoothing effect" in the enhanced denoising process.
          s2 (`float`):
              Scaling factor for stage 2 to attenuate the contributions of the skip features. This is done to
              mitigate the "oversmoothing effect" in the enhanced denoising process.
          b1 (`float`): Scaling factor for stage 1 to amplify the contributions of backbone features.
          b2 (`float`): Scaling factor for stage 2 to amplify the contributions of backbone features.
      """
      for i, upsample_block in enumerate(self.up_blocks):
          setattr(upsample_block, "s1", s1)
          setattr(upsample_block, "s2", s2)
          setattr(upsample_block, "b1", b1)
          setattr(upsample_block, "b2", b2)
  
imports: from dataclasses import dataclass
  from typing import Any, Dict, List, 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 BaseOutput, 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_3d_blocks import CrossAttnDownBlock3D, CrossAttnUpBlock3D, DownBlock3D, UNetMidBlock3DCrossAttn, UpBlock3D, get_down_block, get_up_block
label_desc: Use image node_id 9 for calling the UNet3DConditionModel obj's underlying member method code with example usage: obj.enable_freeu(s1, s2, b1, b2) without return types