(
self,
in_dim: int,
out_dim: int,
num_res_blocks: int,
dropout: float = 0.0,
upsample_mode: Optional[str] = None,
non_linearity: str = "silu",
)
| 725 | """ |
| 726 | |
| 727 | def __init__( |
| 728 | self, |
| 729 | in_dim: int, |
| 730 | out_dim: int, |
| 731 | num_res_blocks: int, |
| 732 | dropout: float = 0.0, |
| 733 | upsample_mode: Optional[str] = None, |
| 734 | non_linearity: str = "silu", |
| 735 | ): |
| 736 | super().__init__() |
| 737 | self.in_dim = in_dim |
| 738 | self.out_dim = out_dim |
| 739 | |
| 740 | # Create layers list |
| 741 | resnets = [] |
| 742 | # Add residual blocks and attention if needed |
| 743 | current_dim = in_dim |
| 744 | for _ in range(num_res_blocks + 1): |
| 745 | resnets.append(WanResidualBlock(current_dim, out_dim, dropout, non_linearity)) |
| 746 | current_dim = out_dim |
| 747 | |
| 748 | self.resnets = nn.ModuleList(resnets) |
| 749 | |
| 750 | # Add upsampling layer if needed |
| 751 | self.upsamplers = None |
| 752 | if upsample_mode is not None: |
| 753 | self.upsamplers = nn.ModuleList([WanResample(out_dim, mode=upsample_mode)]) |
| 754 | |
| 755 | self.gradient_checkpointing = False |
| 756 | |
| 757 | def forward(self, x, feat_cache=None, feat_idx=[0], first_chunk=None): |
| 758 | """ |
nothing calls this directly
no test coverage detected