MCPcopy Create free account
hub / github.com/huggingface/diffusers / get_mid_block

Function get_mid_block

src/diffusers/models/unets/unet_1d_blocks.py:670–691  ·  view source on GitHub ↗
(
    mid_block_type: str,
    num_layers: int,
    in_channels: int,
    mid_channels: int,
    out_channels: int,
    embed_dim: int,
    add_downsample: bool,
)

Source from the content-addressed store, hash-verified

668
669
670def get_mid_block(
671 mid_block_type: str,
672 num_layers: int,
673 in_channels: int,
674 mid_channels: int,
675 out_channels: int,
676 embed_dim: int,
677 add_downsample: bool,
678) -> MidBlockType:
679 if mid_block_type == "MidResTemporalBlock1D":
680 return MidResTemporalBlock1D(
681 num_layers=num_layers,
682 in_channels=in_channels,
683 out_channels=out_channels,
684 embed_dim=embed_dim,
685 add_downsample=add_downsample,
686 )
687 elif mid_block_type == "ValueFunctionMidBlock1D":
688 return ValueFunctionMidBlock1D(in_channels=in_channels, out_channels=out_channels, embed_dim=embed_dim)
689 elif mid_block_type == "UNetMidBlock1D":
690 return UNetMidBlock1D(in_channels=in_channels, mid_channels=mid_channels, out_channels=out_channels)
691 raise ValueError(f"{mid_block_type} does not exist.")
692
693
694def get_out_block(

Callers 2

__init__Method · 0.70
__init__Method · 0.70

Calls 3

UNetMidBlock1DClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…