text stringlengths 41 89.8k | type stringclasses 1
value | start int64 79 258k | end int64 342 260k | depth int64 0 0 | filepath stringlengths 81 164 | parent_class null | class_index int64 0 1.38k |
|---|---|---|---|---|---|---|---|
class Conv1dBlock(nn.Module):
"""
Conv1d --> GroupNorm --> Mish
Parameters:
inp_channels (`int`): Number of input channels.
out_channels (`int`): Number of output channels.
kernel_size (`int` or `tuple`): Size of the convolving kernel.
n_groups (`int`, default `8`): Number o... | class_definition | 17,304 | 18,559 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/resnet.py | null | 900 |
class ResidualTemporalBlock1D(nn.Module):
"""
Residual 1D block with temporal convolutions.
Parameters:
inp_channels (`int`): Number of input channels.
out_channels (`int`): Number of output channels.
embed_dim (`int`): Embedding dimension.
kernel_size (`int` or `tuple`): Si... | class_definition | 18,575 | 20,174 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/resnet.py | null | 901 |
class TemporalConvLayer(nn.Module):
"""
Temporal convolutional layer that can be used for video (sequence of images) input Code mostly copied from:
https://github.com/modelscope/modelscope/blob/1509fdb973e5871f37148a4b5e5964cafd43e64d/modelscope/models/multi_modal/video_synthesis/unet_sd.py#L1016
Param... | class_definition | 20,177 | 22,760 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/resnet.py | null | 902 |
class TemporalResnetBlock(nn.Module):
r"""
A Resnet block.
Parameters:
in_channels (`int`): The number of channels in the input.
out_channels (`int`, *optional*, default to be `None`):
The number of output channels for the first conv2d layer. If None, same as `in_channels`.
... | class_definition | 22,763 | 25,822 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/resnet.py | null | 903 |
class SpatioTemporalResBlock(nn.Module):
r"""
A SpatioTemporal Resnet block.
Parameters:
in_channels (`int`): The number of channels in the input.
out_channels (`int`, *optional*, default to be `None`):
The number of output channels for the first conv2d layer. If None, same as `... | class_definition | 25,841 | 29,221 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/resnet.py | null | 904 |
class AlphaBlender(nn.Module):
r"""
A module to blend spatial and temporal features.
Parameters:
alpha (`float`): The initial value of the blending factor.
merge_strategy (`str`, *optional*, defaults to `learned_with_images`):
The merge strategy to use for the temporal mixing.
... | class_definition | 29,224 | 32,240 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/resnet.py | null | 905 |
class ModelMixin(torch.nn.Module, PushToHubMixin):
r"""
Base class for all models.
[`ModelMixin`] takes care of storing the model configuration and provides methods for loading, downloading and
saving models.
- **config_name** ([`str`]) -- Filename to save a model to when calling [`~models.Mod... | class_definition | 4,150 | 69,712 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/modeling_utils.py | null | 906 |
class LegacyModelMixin(ModelMixin):
r"""
A subclass of `ModelMixin` to resolve class mapping from legacy classes (like `Transformer2DModel`) to more
pipeline-specific classes (like `DiTTransformer2DModel`).
"""
@classmethod
@validate_hf_hub_args
def from_pretrained(cls, pretrained_model_nam... | class_definition | 69,715 | 71,639 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/modeling_utils.py | null | 907 |
class FlaxTimestepEmbedding(nn.Module):
r"""
Time step Embedding Module. Learns embeddings for input time steps.
Args:
time_embed_dim (`int`, *optional*, defaults to `32`):
Time step embedding dimension.
dtype (`jnp.dtype`, *optional*, defaults to `jnp.float32`):
The... | class_definition | 2,831 | 3,532 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings_flax.py | null | 908 |
class FlaxTimesteps(nn.Module):
r"""
Wrapper Module for sinusoidal Time step Embeddings as described in https://arxiv.org/abs/2006.11239
Args:
dim (`int`, *optional*, defaults to `32`):
Time step embedding dimension.
flip_sin_to_cos (`bool`, *optional*, defaults to `False`):
... | class_definition | 3,535 | 4,352 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings_flax.py | null | 909 |
class PatchedLoraProjection(torch.nn.Module):
def __init__(self, regular_linear_layer, lora_scale=1, network_alpha=None, rank=4, dtype=None):
deprecation_message = "Use of `PatchedLoraProjection` is deprecated. Please switch to PEFT backend by installing PEFT: `pip install peft`."
deprecate("Patched... | class_definition | 3,139 | 6,937 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/lora.py | null | 910 |
class LoRALinearLayer(nn.Module):
r"""
A linear layer that is used with LoRA.
Parameters:
in_features (`int`):
Number of input features.
out_features (`int`):
Number of output features.
rank (`int`, `optional`, defaults to 4):
The rank of the LoRA... | class_definition | 6,940 | 9,471 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/lora.py | null | 911 |
class LoRAConv2dLayer(nn.Module):
r"""
A convolutional layer that is used with LoRA.
Parameters:
in_features (`int`):
Number of input features.
out_features (`int`):
Number of output features.
rank (`int`, `optional`, defaults to 4):
The rank of t... | class_definition | 9,474 | 12,402 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/lora.py | null | 912 |
class LoRACompatibleConv(nn.Conv2d):
"""
A convolutional layer that can be used with LoRA.
"""
def __init__(self, *args, lora_layer: Optional[LoRAConv2dLayer] = None, **kwargs):
deprecation_message = "Use of `LoRACompatibleConv` is deprecated. Please switch to PEFT backend by installing PEFT: `... | class_definition | 12,405 | 15,880 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/lora.py | null | 913 |
class LoRACompatibleLinear(nn.Linear):
"""
A Linear layer that can be used with LoRA.
"""
def __init__(self, *args, lora_layer: Optional[LoRALinearLayer] = None, **kwargs):
deprecation_message = "Use of `LoRACompatibleLinear` is deprecated. Please switch to PEFT backend by installing PEFT: `pip... | class_definition | 15,883 | 18,828 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/lora.py | null | 914 |
class FlaxDecoderOutput(BaseOutput):
"""
Output of decoding method.
Args:
sample (`jnp.ndarray` of shape `(batch_size, num_channels, height, width)`):
The decoded output sample from the last layer of the model.
dtype (`jnp.dtype`, *optional*, defaults to `jnp.float32`):
... | class_definition | 1,070 | 1,457 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 915 |
class FlaxAutoencoderKLOutput(BaseOutput):
"""
Output of AutoencoderKL encoding method.
Args:
latent_dist (`FlaxDiagonalGaussianDistribution`):
Encoded outputs of `Encoder` represented as the mean and logvar of `FlaxDiagonalGaussianDistribution`.
`FlaxDiagonalGaussianDistrib... | class_definition | 1,483 | 1,921 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 916 |
class FlaxUpsample2D(nn.Module):
"""
Flax implementation of 2D Upsample layer
Args:
in_channels (`int`):
Input channels
dtype (:obj:`jnp.dtype`, *optional*, defaults to jnp.float32):
Parameters `dtype`
"""
in_channels: int
dtype: jnp.dtype = jnp.float32
... | class_definition | 1,924 | 2,810 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 917 |
class FlaxDownsample2D(nn.Module):
"""
Flax implementation of 2D Downsample layer
Args:
in_channels (`int`):
Input channels
dtype (:obj:`jnp.dtype`, *optional*, defaults to jnp.float32):
Parameters `dtype`
"""
in_channels: int
dtype: jnp.dtype = jnp.floa... | class_definition | 2,813 | 3,601 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 918 |
class FlaxResnetBlock2D(nn.Module):
"""
Flax implementation of 2D Resnet Block.
Args:
in_channels (`int`):
Input channels
out_channels (`int`):
Output channels
dropout (:obj:`float`, *optional*, defaults to 0.0):
Dropout rate
groups (:obj:... | class_definition | 3,604 | 6,163 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 919 |
class FlaxAttentionBlock(nn.Module):
r"""
Flax Convolutional based multi-head attention block for diffusion-based VAE.
Parameters:
channels (:obj:`int`):
Input channels
num_head_channels (:obj:`int`, *optional*, defaults to `None`):
Number of attention heads
... | class_definition | 6,166 | 8,938 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 920 |
class FlaxDownEncoderBlock2D(nn.Module):
r"""
Flax Resnet blocks-based Encoder block for diffusion-based VAE.
Parameters:
in_channels (:obj:`int`):
Input channels
out_channels (:obj:`int`):
Output channels
dropout (:obj:`float`, *optional*, defaults to 0.0):
... | class_definition | 8,941 | 10,849 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 921 |
class FlaxUpDecoderBlock2D(nn.Module):
r"""
Flax Resnet blocks-based Decoder block for diffusion-based VAE.
Parameters:
in_channels (:obj:`int`):
Input channels
out_channels (:obj:`int`):
Output channels
dropout (:obj:`float`, *optional*, defaults to 0.0):
... | class_definition | 10,852 | 12,742 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 922 |
class FlaxUNetMidBlock2D(nn.Module):
r"""
Flax Unet Mid-Block module.
Parameters:
in_channels (:obj:`int`):
Input channels
dropout (:obj:`float`, *optional*, defaults to 0.0):
Dropout rate
num_layers (:obj:`int`, *optional*, defaults to 1):
Number... | class_definition | 12,745 | 15,194 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 923 |
class FlaxEncoder(nn.Module):
r"""
Flax Implementation of VAE Encoder.
This model is a Flax Linen [flax.linen.Module](https://flax.readthedocs.io/en/latest/flax.linen.html#module)
subclass. Use it as a regular Flax linen Module and refer to the Flax documentation for all matter related to
general u... | class_definition | 15,197 | 19,452 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 924 |
class FlaxDecoder(nn.Module):
r"""
Flax Implementation of VAE Decoder.
This model is a Flax Linen [flax.linen.Module](https://flax.readthedocs.io/en/latest/flax.linen.html#module)
subclass. Use it as a regular Flax linen Module and refer to the Flax documentation for all matter related to
general u... | class_definition | 19,455 | 23,720 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 925 |
class FlaxDiagonalGaussianDistribution(object):
def __init__(self, parameters, deterministic=False):
# Last axis to account for channels-last
self.mean, self.logvar = jnp.split(parameters, 2, axis=-1)
self.logvar = jnp.clip(self.logvar, -30.0, 20.0)
self.deterministic = deterministic... | class_definition | 23,723 | 25,039 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 926 |
class FlaxAutoencoderKL(nn.Module, FlaxModelMixin, ConfigMixin):
r"""
Flax implementation of a VAE model with KL loss for decoding latent representations.
This model inherits from [`FlaxModelMixin`]. Check the superclass documentation for it's generic methods
implemented for all models (such as downloa... | class_definition | 25,067 | 31,941 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vae_flax.py | null | 927 |
class AdaLayerNorm(nn.Module):
r"""
Norm layer modified to incorporate timestep embeddings.
Parameters:
embedding_dim (`int`): The size of each embedding vector.
num_embeddings (`int`, *optional*): The size of the embeddings dictionary.
output_dim (`int`, *optional*):
norm_e... | class_definition | 923 | 2,824 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 928 |
class FP32LayerNorm(nn.LayerNorm):
def forward(self, inputs: torch.Tensor) -> torch.Tensor:
origin_dtype = inputs.dtype
return F.layer_norm(
inputs.float(),
self.normalized_shape,
self.weight.float() if self.weight is not None else None,
self.bias.floa... | class_definition | 2,827 | 3,235 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 929 |
class SD35AdaLayerNormZeroX(nn.Module):
r"""
Norm layer adaptive layer norm zero (AdaLN-Zero).
Parameters:
embedding_dim (`int`): The size of each embedding vector.
num_embeddings (`int`): The size of the embeddings dictionary.
"""
def __init__(self, embedding_dim: int, norm_type: ... | class_definition | 3,238 | 4,682 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 930 |
class AdaLayerNormZero(nn.Module):
r"""
Norm layer adaptive layer norm zero (adaLN-Zero).
Parameters:
embedding_dim (`int`): The size of each embedding vector.
num_embeddings (`int`): The size of the embeddings dictionary.
"""
def __init__(self, embedding_dim: int, num_embeddings: ... | class_definition | 4,685 | 6,527 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 931 |
class AdaLayerNormZeroSingle(nn.Module):
r"""
Norm layer adaptive layer norm zero (adaLN-Zero).
Parameters:
embedding_dim (`int`): The size of each embedding vector.
num_embeddings (`int`): The size of the embeddings dictionary.
"""
def __init__(self, embedding_dim: int, norm_type=... | class_definition | 6,530 | 7,704 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 932 |
class LuminaRMSNormZero(nn.Module):
"""
Norm layer adaptive RMS normalization zero.
Parameters:
embedding_dim (`int`): The size of each embedding vector.
"""
def __init__(self, embedding_dim: int, norm_eps: float, norm_elementwise_affine: bool):
super().__init__()
self.silu... | class_definition | 7,707 | 8,734 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 933 |
class AdaLayerNormSingle(nn.Module):
r"""
Norm layer adaptive layer norm single (adaLN-single).
As proposed in PixArt-Alpha (see: https://arxiv.org/abs/2310.00426; Section 2.3).
Parameters:
embedding_dim (`int`): The size of each embedding vector.
use_additional_conditions (`bool`): To... | class_definition | 8,737 | 10,162 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 934 |
class AdaGroupNorm(nn.Module):
r"""
GroupNorm layer modified to incorporate timestep embeddings.
Parameters:
embedding_dim (`int`): The size of each embedding vector.
num_embeddings (`int`): The size of the embeddings dictionary.
num_groups (`int`): The number of groups to separate ... | class_definition | 10,165 | 11,459 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 935 |
class AdaLayerNormContinuous(nn.Module):
def __init__(
self,
embedding_dim: int,
conditioning_embedding_dim: int,
# NOTE: It is a bit weird that the norm layer can be configured to have scale and shift parameters
# because the output is immediately scaled and shifted by the p... | class_definition | 11,462 | 13,053 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 936 |
class LuminaLayerNormContinuous(nn.Module):
def __init__(
self,
embedding_dim: int,
conditioning_embedding_dim: int,
# NOTE: It is a bit weird that the norm layer can be configured to have scale and shift parameters
# because the output is immediately scaled and shifted by th... | class_definition | 13,056 | 14,919 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 937 |
class CogView3PlusAdaLayerNormZeroTextImage(nn.Module):
r"""
Norm layer adaptive layer norm zero (adaLN-Zero).
Parameters:
embedding_dim (`int`): The size of each embedding vector.
num_embeddings (`int`): The size of the embeddings dictionary.
"""
def __init__(self, embedding_dim: ... | class_definition | 14,922 | 16,474 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 938 |
class CogVideoXLayerNormZero(nn.Module):
def __init__(
self,
conditioning_dim: int,
embedding_dim: int,
elementwise_affine: bool = True,
eps: float = 1e-5,
bias: bool = True,
) -> None:
super().__init__()
self.silu = nn.SiLU()
self.linear ... | class_definition | 16,477 | 17,525 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 939 |
class LayerNorm(nn.Module):
def __init__(self, dim, eps: float = 1e-5, elementwise_affine: bool = True, bias: bool = True):
super().__init__()
self.eps = eps
if isinstance(dim, numbers.Integral):
dim = (dim,)
self.dim = torch.Size(dim)
... | class_definition | 17,746 | 18,433 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 940 |
class RMSNorm(nn.Module):
def __init__(self, dim, eps: float, elementwise_affine: bool = True, bias: bool = False):
super().__init__()
self.eps = eps
self.elementwise_affine = elementwise_affine
if isinstance(dim, numbers.Integral):
dim = (dim,)
self.dim = torc... | class_definition | 18,436 | 20,275 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 941 |
class MochiRMSNorm(nn.Module):
def __init__(self, dim, eps: float, elementwise_affine: bool = True):
super().__init__()
self.eps = eps
if isinstance(dim, numbers.Integral):
dim = (dim,)
self.dim = torch.Size(dim)
if elementwise_affine:
self.weight ... | class_definition | 20,473 | 21,281 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 942 |
class GlobalResponseNorm(nn.Module):
# Taken from https://github.com/facebookresearch/ConvNeXt-V2/blob/3608f67cc1dae164790c5d0aead7bf2d73d9719b/models/utils.py#L105
def __init__(self, dim):
super().__init__()
self.gamma = nn.Parameter(torch.zeros(1, 1, 1, dim))
self.beta = nn.Parameter(t... | class_definition | 21,284 | 21,824 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 943 |
class LpNorm(nn.Module):
def __init__(self, p: int = 2, dim: int = -1, eps: float = 1e-12):
super().__init__()
self.p = p
self.dim = dim
self.eps = eps
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
return F.normalize(hidden_states, p=self.p, dim=self.d... | class_definition | 21,827 | 22,164 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/normalization.py | null | 944 |
class VQEncoderOutput(VQEncoderOutput):
def __init__(self, *args, **kwargs):
deprecation_message = "Importing `VQEncoderOutput` from `diffusers.models.vq_model` is deprecated and this will be removed in a future version. Please use `from diffusers.models.autoencoders.vq_model import VQEncoderOutput`, instea... | class_definition | 698 | 1,129 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vq_model.py | null | 945 |
class VQModel(VQModel):
def __init__(self, *args, **kwargs):
deprecation_message = "Importing `VQModel` from `diffusers.models.vq_model` is deprecated and this will be removed in a future version. Please use `from diffusers.models.autoencoders.vq_model import VQModel`, instead."
deprecate("VQModel",... | class_definition | 1,132 | 1,523 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/vq_model.py | null | 946 |
class FluxControlNetOutput(FluxControlNetOutput):
def __init__(self, *args, **kwargs):
deprecation_message = "Importing `FluxControlNetOutput` from `diffusers.models.controlnet_flux` is deprecated and this will be removed in a future version. Please use `from diffusers.models.controlnets.controlnet_flux imp... | class_definition | 896 | 1,398 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet_flux.py | null | 947 |
class FluxControlNetModel(FluxControlNetModel):
def __init__(
self,
patch_size: int = 1,
in_channels: int = 64,
num_layers: int = 19,
num_single_layers: int = 38,
attention_head_dim: int = 128,
num_attention_heads: int = 24,
joint_attention_dim: int = ... | class_definition | 1,401 | 2,916 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet_flux.py | null | 948 |
class FluxMultiControlNetModel(FluxMultiControlNetModel):
def __init__(self, *args, **kwargs):
deprecation_message = "Importing `FluxMultiControlNetModel` from `diffusers.models.controlnet_flux` is deprecated and this will be removed in a future version. Please use `from diffusers.models.controlnets.control... | class_definition | 2,919 | 3,441 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet_flux.py | null | 949 |
class DownResnetBlock1D(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: Optional[int] = None,
num_layers: int = 1,
conv_shortcut: bool = False,
temb_channels: int = 32,
groups: int = 32,
groups_out: Optional[int] = None,
non_lin... | class_definition | 858 | 2,999 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 950 |
class UpResnetBlock1D(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: Optional[int] = None,
num_layers: int = 1,
temb_channels: int = 32,
groups: int = 32,
groups_out: Optional[int] = None,
non_linearity: Optional[str] = None,
t... | class_definition | 3,002 | 5,253 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 951 |
class ValueFunctionMidBlock1D(nn.Module):
def __init__(self, in_channels: int, out_channels: int, embed_dim: int):
super().__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.embed_dim = embed_dim
self.res1 = ResidualTemporalBlock1D(in_channels, i... | class_definition | 5,256 | 6,075 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 952 |
class MidResTemporalBlock1D(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: int,
embed_dim: int,
num_layers: int = 1,
add_downsample: bool = False,
add_upsample: bool = False,
non_linearity: Optional[str] = None,
):
super().... | class_definition | 6,078 | 7,827 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 953 |
class OutConv1DBlock(nn.Module):
def __init__(self, num_groups_out: int, out_channels: int, embed_dim: int, act_fn: str):
super().__init__()
self.final_conv1d_1 = nn.Conv1d(embed_dim, embed_dim, 5, padding=2)
self.final_conv1d_gn = nn.GroupNorm(num_groups_out, embed_dim)
self.final_c... | class_definition | 7,830 | 8,734 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 954 |
class OutValueFunctionBlock(nn.Module):
def __init__(self, fc_dim: int, embed_dim: int, act_fn: str = "mish"):
super().__init__()
self.final_block = nn.ModuleList(
[
nn.Linear(fc_dim + embed_dim, fc_dim // 2),
get_activation(act_fn),
nn.Lin... | class_definition | 8,737 | 9,444 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 955 |
class Downsample1d(nn.Module):
def __init__(self, kernel: str = "linear", pad_mode: str = "reflect"):
super().__init__()
self.pad_mode = pad_mode
kernel_1d = torch.tensor(_kernels[kernel])
self.pad = kernel_1d.shape[0] // 2 - 1
self.register_buffer("kernel", kernel_1d)
d... | class_definition | 10,000 | 10,839 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 956 |
class Upsample1d(nn.Module):
def __init__(self, kernel: str = "linear", pad_mode: str = "reflect"):
super().__init__()
self.pad_mode = pad_mode
kernel_1d = torch.tensor(_kernels[kernel]) * 2
self.pad = kernel_1d.shape[0] // 2 - 1
self.register_buffer("kernel", kernel_1d)
... | class_definition | 10,842 | 11,767 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 957 |
class SelfAttention1d(nn.Module):
def __init__(self, in_channels: int, n_head: int = 1, dropout_rate: float = 0.0):
super().__init__()
self.channels = in_channels
self.group_norm = nn.GroupNorm(1, num_channels=in_channels)
self.num_heads = n_head
self.query = nn.Linear(self.... | class_definition | 11,770 | 14,128 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 958 |
class ResConvBlock(nn.Module):
def __init__(self, in_channels: int, mid_channels: int, out_channels: int, is_last: bool = False):
super().__init__()
self.is_last = is_last
self.has_conv_skip = in_channels != out_channels
if self.has_conv_skip:
self.conv_skip = nn.Conv1d(... | class_definition | 14,131 | 15,439 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 959 |
class UNetMidBlock1D(nn.Module):
def __init__(self, mid_channels: int, in_channels: int, out_channels: Optional[int] = None):
super().__init__()
out_channels = in_channels if out_channels is None else out_channels
# there is always at least one resnet
self.down = Downsample1d("cubi... | class_definition | 15,442 | 17,152 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 960 |
class AttnDownBlock1D(nn.Module):
def __init__(self, out_channels: int, in_channels: int, mid_channels: Optional[int] = None):
super().__init__()
mid_channels = out_channels if mid_channels is None else mid_channels
self.down = Downsample1d("cubic")
resnets = [
ResConvBl... | class_definition | 17,155 | 18,353 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 961 |
class DownBlock1D(nn.Module):
def __init__(self, out_channels: int, in_channels: int, mid_channels: Optional[int] = None):
super().__init__()
mid_channels = out_channels if mid_channels is None else mid_channels
self.down = Downsample1d("cubic")
resnets = [
ResConvBlock(... | class_definition | 18,356 | 19,200 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 962 |
class DownBlock1DNoSkip(nn.Module):
def __init__(self, out_channels: int, in_channels: int, mid_channels: Optional[int] = None):
super().__init__()
mid_channels = out_channels if mid_channels is None else mid_channels
resnets = [
ResConvBlock(in_channels, mid_channels, mid_chann... | class_definition | 19,203 | 20,025 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 963 |
class AttnUpBlock1D(nn.Module):
def __init__(self, in_channels: int, out_channels: int, mid_channels: Optional[int] = None):
super().__init__()
mid_channels = out_channels if mid_channels is None else mid_channels
resnets = [
ResConvBlock(2 * in_channels, mid_channels, mid_chann... | class_definition | 20,028 | 21,435 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 964 |
class UpBlock1D(nn.Module):
def __init__(self, in_channels: int, out_channels: int, mid_channels: Optional[int] = None):
super().__init__()
mid_channels = in_channels if mid_channels is None else mid_channels
resnets = [
ResConvBlock(2 * in_channels, mid_channels, mid_channels),... | class_definition | 21,438 | 22,490 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 965 |
class UpBlock1DNoSkip(nn.Module):
def __init__(self, in_channels: int, out_channels: int, mid_channels: Optional[int] = None):
super().__init__()
mid_channels = in_channels if mid_channels is None else mid_channels
resnets = [
ResConvBlock(2 * in_channels, mid_channels, mid_chan... | class_definition | 22,493 | 23,472 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_1d_blocks.py | null | 966 |
class UNet2DConditionOutput(BaseOutput):
"""
The output of [`UNet2DConditionModel`].
Args:
sample (`torch.Tensor` of shape `(batch_size, num_channels, height, width)`):
The hidden states output conditioned on `encoder_hidden_states` input. Output of last layer of model.
"""
sam... | class_definition | 1,831 | 2,175 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_2d_condition.py | null | 967 |
class UNet2DConditionModel(
ModelMixin, ConfigMixin, FromOriginalModelMixin, UNet2DConditionLoadersMixin, PeftAdapterMixin
):
r"""
A 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`]. Ch... | class_definition | 2,178 | 67,069 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_2d_condition.py | null | 968 |
class SDCascadeLayerNorm(nn.LayerNorm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def forward(self, x):
x = x.permute(0, 2, 3, 1)
x = super().forward(x)
return x.permute(0, 3, 1, 2) | class_definition | 1,121 | 1,372 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_stable_cascade.py | null | 969 |
class SDCascadeTimestepBlock(nn.Module):
def __init__(self, c, c_timestep, conds=[]):
super().__init__()
self.mapper = nn.Linear(c_timestep, c * 2)
self.conds = conds
for cname in conds:
setattr(self, f"mapper_{cname}", nn.Linear(c_timestep, c * 2))
def forward(self... | class_definition | 1,375 | 2,020 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_stable_cascade.py | null | 970 |
class SDCascadeResBlock(nn.Module):
def __init__(self, c, c_skip=0, kernel_size=3, dropout=0.0):
super().__init__()
self.depthwise = nn.Conv2d(c, c, kernel_size=kernel_size, padding=kernel_size // 2, groups=c)
self.norm = SDCascadeLayerNorm(c, elementwise_affine=False, eps=1e-6)
self... | class_definition | 2,023 | 2,825 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_stable_cascade.py | null | 971 |
class GlobalResponseNorm(nn.Module):
def __init__(self, dim):
super().__init__()
self.gamma = nn.Parameter(torch.zeros(1, 1, 1, dim))
self.beta = nn.Parameter(torch.zeros(1, 1, 1, dim))
def forward(self, x):
agg_norm = torch.norm(x, p=2, dim=(1, 2), keepdim=True)
stand_d... | class_definition | 2,950 | 3,400 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_stable_cascade.py | null | 972 |
class SDCascadeAttnBlock(nn.Module):
def __init__(self, c, c_cond, nhead, self_attn=True, dropout=0.0):
super().__init__()
self.self_attn = self_attn
self.norm = SDCascadeLayerNorm(c, elementwise_affine=False, eps=1e-6)
self.attention = Attention(query_dim=c, heads=nhead, dim_head=c... | class_definition | 3,403 | 4,177 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_stable_cascade.py | null | 973 |
class UpDownBlock2d(nn.Module):
def __init__(self, in_channels, out_channels, mode, enabled=True):
super().__init__()
if mode not in ["up", "down"]:
raise ValueError(f"{mode} not supported")
interpolation = (
nn.Upsample(scale_factor=2 if mode == "up" else 0.5, mode="... | class_definition | 4,180 | 4,875 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_stable_cascade.py | null | 974 |
class StableCascadeUNetOutput(BaseOutput):
sample: torch.Tensor = None | class_definition | 4,889 | 4,963 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_stable_cascade.py | null | 975 |
class StableCascadeUNet(ModelMixin, ConfigMixin, FromOriginalModelMixin):
_supports_gradient_checkpointing = True
@register_to_config
def __init__(
self,
in_channels: int = 16,
out_channels: int = 16,
timestep_ratio_embedding_dim: int = 64,
patch_size: int = 1,
... | class_definition | 4,966 | 28,343 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_stable_cascade.py | null | 976 |
class DownBlockMotion(DownBlockMotion):
def __init__(self, *args, **kwargs):
deprecation_message = "Importing `DownBlockMotion` from `diffusers.models.unets.unet_3d_blocks` is deprecated and this will be removed in a future version. Please use `from diffusers.models.unets.unet_motion_model import DownBlockM... | class_definition | 1,381 | 1,826 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 977 |
class CrossAttnDownBlockMotion(CrossAttnDownBlockMotion):
def __init__(self, *args, **kwargs):
deprecation_message = "Importing `CrossAttnDownBlockMotion` from `diffusers.models.unets.unet_3d_blocks` is deprecated and this will be removed in a future version. Please use `from diffusers.models.unets.unet_mot... | class_definition | 1,829 | 2,319 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 978 |
class UpBlockMotion(UpBlockMotion):
def __init__(self, *args, **kwargs):
deprecation_message = "Importing `UpBlockMotion` from `diffusers.models.unets.unet_3d_blocks` is deprecated and this will be removed in a future version. Please use `from diffusers.models.unets.unet_motion_model import UpBlockMotion` i... | class_definition | 2,322 | 2,757 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 979 |
class CrossAttnUpBlockMotion(CrossAttnUpBlockMotion):
def __init__(self, *args, **kwargs):
deprecation_message = "Importing `CrossAttnUpBlockMotion` from `diffusers.models.unets.unet_3d_blocks` is deprecated and this will be removed in a future version. Please use `from diffusers.models.unets.unet_motion_mo... | class_definition | 2,760 | 3,240 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 980 |
class UNetMidBlockCrossAttnMotion(UNetMidBlockCrossAttnMotion):
def __init__(self, *args, **kwargs):
deprecation_message = "Importing `UNetMidBlockCrossAttnMotion` from `diffusers.models.unets.unet_3d_blocks` is deprecated and this will be removed in a future version. Please use `from diffusers.models.unets... | class_definition | 3,243 | 3,748 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 981 |
class UNetMidBlock3DCrossAttn(nn.Module):
def __init__(
self,
in_channels: int,
temb_channels: int,
dropout: float = 0.0,
num_layers: int = 1,
resnet_eps: float = 1e-6,
resnet_time_scale_shift: str = "default",
resnet_act_fn: str = "swish",
res... | class_definition | 11,135 | 16,052 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 982 |
class CrossAttnDownBlock3D(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: int,
temb_channels: int,
dropout: float = 0.0,
num_layers: int = 1,
resnet_eps: float = 1e-6,
resnet_time_scale_shift: str = "default",
resnet_act_fn: st... | class_definition | 16,055 | 21,147 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 983 |
class DownBlock3D(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: int,
temb_channels: int,
dropout: float = 0.0,
num_layers: int = 1,
resnet_eps: float = 1e-6,
resnet_time_scale_shift: str = "default",
resnet_act_fn: str = "swis... | class_definition | 21,150 | 23,970 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 984 |
class CrossAttnUpBlock3D(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: int,
prev_output_channel: int,
temb_channels: int,
dropout: float = 0.0,
num_layers: int = 1,
resnet_eps: float = 1e-6,
resnet_time_scale_shift: str = "def... | class_definition | 23,973 | 29,829 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 985 |
class UpBlock3D(nn.Module):
def __init__(
self,
in_channels: int,
prev_output_channel: int,
out_channels: int,
temb_channels: int,
dropout: float = 0.0,
num_layers: int = 1,
resnet_eps: float = 1e-6,
resnet_time_scale_shift: str = "default",
... | class_definition | 29,832 | 33,415 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 986 |
class MidBlockTemporalDecoder(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: int,
attention_head_dim: int = 512,
num_layers: int = 1,
upcast_attention: bool = False,
):
super().__init__()
resnets = []
attentions = []
... | class_definition | 33,418 | 35,318 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 987 |
class UpBlockTemporalDecoder(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: int,
num_layers: int = 1,
add_upsample: bool = True,
):
super().__init__()
resnets = []
for i in range(num_layers):
input_channels = in_channel... | class_definition | 35,321 | 36,837 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 988 |
class UNetMidBlockSpatioTemporal(nn.Module):
def __init__(
self,
in_channels: int,
temb_channels: int,
num_layers: int = 1,
transformer_layers_per_block: Union[int, Tuple[int]] = 1,
num_attention_heads: int = 1,
cross_attention_dim: int = 1280,
):
... | class_definition | 36,840 | 40,688 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 989 |
class DownBlockSpatioTemporal(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: int,
temb_channels: int,
num_layers: int = 1,
add_downsample: bool = True,
):
super().__init__()
resnets = []
for i in range(num_layers):
... | class_definition | 40,691 | 43,552 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 990 |
class CrossAttnDownBlockSpatioTemporal(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: int,
temb_channels: int,
num_layers: int = 1,
transformer_layers_per_block: Union[int, Tuple[int]] = 1,
num_attention_heads: int = 1,
cross_attention... | class_definition | 43,555 | 47,877 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 991 |
class UpBlockSpatioTemporal(nn.Module):
def __init__(
self,
in_channels: int,
prev_output_channel: int,
out_channels: int,
temb_channels: int,
resolution_idx: Optional[int] = None,
num_layers: int = 1,
resnet_eps: float = 1e-6,
add_upsample: bo... | class_definition | 47,880 | 50,984 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 992 |
class CrossAttnUpBlockSpatioTemporal(nn.Module):
def __init__(
self,
in_channels: int,
out_channels: int,
prev_output_channel: int,
temb_channels: int,
resolution_idx: Optional[int] = None,
num_layers: int = 1,
transformer_layers_per_block: Union[int, ... | class_definition | 50,987 | 55,486 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_3d_blocks.py | null | 993 |
class UVit2DModel(ModelMixin, ConfigMixin, PeftAdapterMixin):
_supports_gradient_checkpointing = True
@register_to_config
def __init__(
self,
# global config
hidden_size: int = 1024,
use_bias: bool = False,
hidden_dropout: float = 0.0,
# conditioning dimensio... | class_definition | 1,313 | 11,396 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/uvit_2d.py | null | 994 |
class UVit2DConvEmbed(nn.Module):
def __init__(self, in_channels, block_out_channels, vocab_size, elementwise_affine, eps, bias):
super().__init__()
self.embeddings = nn.Embedding(vocab_size, in_channels)
self.layer_norm = RMSNorm(in_channels, eps, elementwise_affine)
self.conv = nn.... | class_definition | 11,399 | 12,037 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/uvit_2d.py | null | 995 |
class UVitBlock(nn.Module):
def __init__(
self,
channels,
num_res_blocks: int,
hidden_size,
hidden_dropout,
ln_elementwise_affine,
layer_norm_eps,
use_bias,
block_num_heads,
attention_dropout,
downsample: bool,
upsample:... | class_definition | 12,040 | 14,995 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/uvit_2d.py | null | 996 |
class ConvNextBlock(nn.Module):
def __init__(
self, channels, layer_norm_eps, ln_elementwise_affine, use_bias, hidden_dropout, hidden_size, res_ffn_factor=4
):
super().__init__()
self.depthwise = nn.Conv2d(
channels,
channels,
kernel_size=3,
... | class_definition | 14,998 | 16,524 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/uvit_2d.py | null | 997 |
class ConvMlmLayer(nn.Module):
def __init__(
self,
block_out_channels: int,
in_channels: int,
use_bias: bool,
ln_elementwise_affine: bool,
layer_norm_eps: float,
codebook_size: int,
):
super().__init__()
self.conv1 = nn.Conv2d(block_out_cha... | class_definition | 16,527 | 17,320 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/uvit_2d.py | null | 998 |
class UNetMotionOutput(BaseOutput):
"""
The output of [`UNetMotionOutput`].
Args:
sample (`torch.Tensor` of shape `(batch_size, num_channels, num_frames, height, width)`):
The hidden states output conditioned on `encoder_hidden_states` input. Output of last layer of model.
"""
... | class_definition | 1,898 | 2,238 | 0 | /Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/unets/unet_motion_model.py | null | 999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.