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 StableAudioAttnProcessor2_0: r""" Processor for implementing scaled dot-product attention (enabled by default if you're using PyTorch 2.0). This is used in the Stable Audio model. It applies rotary embedding on query and key vector, and allows MHA, GQA or MQA. """ def __init__(self): ...
class_definition
155,848
161,016
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
800
class HunyuanAttnProcessor2_0: r""" Processor for implementing scaled dot-product attention (enabled by default if you're using PyTorch 2.0). This is used in the HunyuanDiT model. It applies a s normalization layer and rotary embedding on query and key vector. """ def __init__(self): if not...
class_definition
161,019
164,910
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
801
class FusedHunyuanAttnProcessor2_0: r""" Processor for implementing scaled dot-product attention (enabled by default if you're using PyTorch 2.0) with fused projection layers. This is used in the HunyuanDiT model. It applies a s normalization layer and rotary embedding on query and key vector. """ ...
class_definition
164,913
169,073
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
802
class PAGHunyuanAttnProcessor2_0: r""" Processor for implementing scaled dot-product attention (enabled by default if you're using PyTorch 2.0). This is used in the HunyuanDiT model. It applies a normalization layer and rotary embedding on query and key vector. This variant of the processor employs [Per...
class_definition
169,076
173,976
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
803
class PAGCFGHunyuanAttnProcessor2_0: r""" Processor for implementing scaled dot-product attention (enabled by default if you're using PyTorch 2.0). This is used in the HunyuanDiT model. It applies a normalization layer and rotary embedding on query and key vector. This variant of the processor employs [...
class_definition
173,979
178,988
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
804
class LuminaAttnProcessor2_0: r""" Processor for implementing scaled dot-product attention (enabled by default if you're using PyTorch 2.0). This is used in the LuminaNextDiT model. It applies a s normalization layer and rotary embedding on query and key vector. """ def __init__(self): if n...
class_definition
178,991
182,665
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
805
class FusedAttnProcessor2_0: r""" Processor for implementing scaled dot-product attention (enabled by default if you're using PyTorch 2.0). It uses fused projection layers. For self-attention modules, all projection matrices (i.e., query, key, value) are fused. For cross-attention modules, key and value...
class_definition
182,668
187,083
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
806
class CustomDiffusionXFormersAttnProcessor(nn.Module): r""" Processor for implementing memory efficient attention using xFormers for the Custom Diffusion method. Args: train_kv (`bool`, defaults to `True`): Whether to newly train the key and value matrices corresponding to the text features. ...
class_definition
187,086
192,112
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
807
class CustomDiffusionAttnProcessor2_0(nn.Module): r""" Processor for implementing attention for the Custom Diffusion method using PyTorch 2.0’s memory-efficient scaled dot-product attention. Args: train_kv (`bool`, defaults to `True`): Whether to newly train the key and value matric...
class_definition
192,115
196,983
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
808
class SlicedAttnProcessor: r""" Processor for implementing sliced attention. Args: slice_size (`int`, *optional*): The number of steps to compute attention. Uses as many slices as `attention_head_dim // slice_size`, and `attention_head_dim` must be a multiple of the `slice_s...
class_definition
196,986
200,151
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
809
class SlicedAttnAddedKVProcessor: r""" Processor for implementing sliced attention with extra learnable key and value matrices for the text encoder. Args: slice_size (`int`, *optional*): The number of steps to compute attention. Uses as many slices as `attention_head_dim // slice_size`,...
class_definition
200,154
203,793
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
810
class SpatialNorm(nn.Module): """ Spatially conditioned normalization as defined in https://arxiv.org/abs/2209.09002. Args: f_channels (`int`): The number of channels for input to group normalization layer, and output of the spatial norm layer. zq_channels (`int`): T...
class_definition
203,796
204,884
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
811
class IPAdapterAttnProcessor(nn.Module): r""" Attention processor for Multiple IP-Adapters. Args: hidden_size (`int`): The hidden size of the attention layer. cross_attention_dim (`int`): The number of channels in the `encoder_hidden_states`. num_tokens (`int...
class_definition
204,887
214,003
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
812
class IPAdapterAttnProcessor2_0(torch.nn.Module): r""" Attention processor for IP-Adapter for PyTorch 2.0. Args: hidden_size (`int`): The hidden size of the attention layer. cross_attention_dim (`int`): The number of channels in the `encoder_hidden_states`. n...
class_definition
214,006
224,945
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
813
class IPAdapterXFormersAttnProcessor(torch.nn.Module): r""" Attention processor for IP-Adapter using xFormers. Args: hidden_size (`int`): The hidden size of the attention layer. cross_attention_dim (`int`): The number of channels in the `encoder_hidden_states`. ...
class_definition
224,948
236,018
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
814
class SD3IPAdapterJointAttnProcessor2_0(torch.nn.Module): """ Attention processor for IP-Adapter used typically in processing the SD3-like self-attention projections, with additional image-based information and timestep embeddings. Args: hidden_size (`int`): The number of hidden cha...
class_definition
236,021
242,929
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
815
class PAGIdentitySelfAttnProcessor2_0: r""" Processor for implementing PAG using scaled dot-product attention (enabled by default if you're using PyTorch 2.0). PAG reference: https://arxiv.org/abs/2403.17377 """ def __init__(self): if not hasattr(F, "scaled_dot_product_attention"): ...
class_definition
242,932
246,962
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
816
class PAGCFGIdentitySelfAttnProcessor2_0: r""" Processor for implementing PAG using scaled dot-product attention (enabled by default if you're using PyTorch 2.0). PAG reference: https://arxiv.org/abs/2403.17377 """ def __init__(self): if not hasattr(F, "scaled_dot_product_attention"): ...
class_definition
246,965
251,128
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
817
class SanaMultiscaleAttnProcessor2_0: r""" Processor for implementing multiscale quadratic attention. """ def __call__(self, attn: SanaMultiscaleLinearAttention, hidden_states: torch.Tensor) -> torch.Tensor: height, width = hidden_states.shape[-2:] if height * width > attn.attention_hea...
class_definition
251,131
253,361
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
818
class LoRAAttnProcessor: r""" Processor for implementing attention with LoRA. """ def __init__(self): pass
class_definition
253,364
253,495
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
819
class LoRAAttnProcessor2_0: r""" Processor for implementing attention with LoRA (enabled by default if you're using PyTorch 2.0). """ def __init__(self): pass
class_definition
253,498
253,681
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
820
class LoRAXFormersAttnProcessor: r""" Processor for implementing attention with LoRA using xFormers. """ def __init__(self): pass
class_definition
253,684
253,838
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
821
class LoRAAttnAddedKVProcessor: r""" Processor for implementing attention with LoRA with extra learnable key and value matrices for the text encoder. """ def __init__(self): pass
class_definition
253,841
254,044
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
822
class FluxSingleAttnProcessor2_0(FluxAttnProcessor2_0): r""" Processor for implementing scaled dot-product attention (enabled by default if you're using PyTorch 2.0). """ def __init__(self): deprecation_message = "`FluxSingleAttnProcessor2_0` is deprecated and will be removed in a future versio...
class_definition
254,047
254,519
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
823
class SanaLinearAttnProcessor2_0: r""" Processor for implementing scaled dot-product linear attention. """ def __call__( self, attn: Attention, hidden_states: torch.Tensor, encoder_hidden_states: Optional[torch.Tensor] = None, attention_mask: Optional[torch.Tenso...
class_definition
254,522
256,123
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
824
class PAGCFGSanaLinearAttnProcessor2_0: r""" Processor for implementing scaled dot-product linear attention. """ def __call__( self, attn: Attention, hidden_states: torch.Tensor, encoder_hidden_states: Optional[torch.Tensor] = None, attention_mask: Optional[torch...
class_definition
256,126
258,181
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
825
class PAGIdentitySanaLinearAttnProcessor2_0: r""" Processor for implementing scaled dot-product linear attention. """ def __call__( self, attn: Attention, hidden_states: torch.Tensor, encoder_hidden_states: Optional[torch.Tensor] = None, attention_mask: Optional[...
class_definition
258,184
260,271
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_processor.py
null
826
class ControlNetOutput(ControlNetOutput): def __init__(self, *args, **kwargs): deprecation_message = "Importing `ControlNetOutput` from `diffusers.models.controlnet` is deprecated and this will be removed in a future version. Please use `from diffusers.models.controlnets.controlnet import ControlNetOutput`,...
class_definition
826
1,293
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet.py
null
827
class ControlNetModel(ControlNetModel): def __init__( self, in_channels: int = 4, conditioning_channels: int = 3, flip_sin_to_cos: bool = True, freq_shift: int = 0, down_block_types: Tuple[str, ...] = ( "CrossAttnDownBlock2D", "CrossAttnDownBlo...
class_definition
1,296
5,228
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet.py
null
828
class ControlNetConditioningEmbedding(ControlNetConditioningEmbedding): def __init__(self, *args, **kwargs): deprecation_message = "Importing `ControlNetConditioningEmbedding` from `diffusers.models.controlnet` is deprecated and this will be removed in a future version. Please use `from diffusers.models.con...
class_definition
5,231
5,773
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet.py
null
829
class FlaxModelMixin(PushToHubMixin): r""" Base class for all Flax models. [`FlaxModelMixin`] 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 [`~FlaxModelMixin...
class_definition
1,466
26,953
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/modeling_flax_utils.py
null
830
class SD3ControlNetOutput(SD3ControlNetOutput): def __init__(self, *args, **kwargs): deprecation_message = "Importing `SD3ControlNetOutput` from `diffusers.models.controlnet_sd3` is deprecated and this will be removed in a future version. Please use `from diffusers.models.controlnets.controlnet_sd3 import S...
class_definition
862
1,356
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet_sd3.py
null
831
class SD3ControlNetModel(SD3ControlNetModel): def __init__( self, sample_size: int = 128, patch_size: int = 2, in_channels: int = 16, num_layers: int = 18, attention_head_dim: int = 64, num_attention_heads: int = 18, joint_attention_dim: int = 4096, ...
class_definition
1,359
2,859
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet_sd3.py
null
832
class SD3MultiControlNetModel(SD3MultiControlNetModel): def __init__(self, *args, **kwargs): deprecation_message = "Importing `SD3MultiControlNetModel` from `diffusers.models.controlnet_sd3` is deprecated and this will be removed in a future version. Please use `from diffusers.models.controlnets.controlnet_...
class_definition
2,862
3,376
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet_sd3.py
null
833
class FP32SiLU(nn.Module): r""" SiLU activation function with input upcasted to torch.float32. """ def __init__(self): super().__init__() def forward(self, inputs: torch.Tensor) -> torch.Tensor: return F.silu(inputs.float(), inplace=False).to(inputs.dtype)
class_definition
1,393
1,687
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/activations.py
null
834
class GELU(nn.Module): r""" GELU activation function with tanh approximation support with `approximate="tanh"`. Parameters: dim_in (`int`): The number of channels in the input. dim_out (`int`): The number of channels in the output. approximate (`str`, *optional*, defaults to `"none"...
class_definition
1,690
2,887
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/activations.py
null
835
class GEGLU(nn.Module): r""" A [variant](https://arxiv.org/abs/2002.05202) of the gated linear unit activation function. Parameters: dim_in (`int`): The number of channels in the input. dim_out (`int`): The number of channels in the output. bias (`bool`, defaults to True): Whether t...
class_definition
2,890
4,544
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/activations.py
null
836
class SwiGLU(nn.Module): r""" A [variant](https://arxiv.org/abs/2002.05202) of the gated linear unit activation function. It's similar to `GEGLU` but uses SiLU / Swish instead of GeLU. Parameters: dim_in (`int`): The number of channels in the input. dim_out (`int`): The number of channe...
class_definition
4,547
5,375
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/activations.py
null
837
class ApproximateGELU(nn.Module): r""" The approximate form of the Gaussian Error Linear Unit (GELU). For more details, see section 2 of this [paper](https://arxiv.org/abs/1606.08415). Parameters: dim_in (`int`): The number of channels in the input. dim_out (`int`): The number of channe...
class_definition
5,378
6,089
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/activations.py
null
838
class LinearActivation(nn.Module): def __init__(self, dim_in: int, dim_out: int, bias: bool = True, activation: str = "silu"): super().__init__() self.proj = nn.Linear(dim_in, dim_out, bias=bias) self.activation = get_activation(activation) def forward(self, hidden_states): hid...
class_definition
6,092
6,495
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/activations.py
null
839
class MultiAdapter(ModelMixin): r""" MultiAdapter is a wrapper model that contains multiple adapter models and merges their outputs according to user-assigned weighting. This model inherits from [`ModelMixin`]. Check the superclass documentation for common methods such as downloading or saving. ...
class_definition
879
11,115
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/adapter.py
null
840
class T2IAdapter(ModelMixin, ConfigMixin): r""" A simple ResNet-like model that accepts images containing control signals such as keyposes and depth. The model generates multiple feature maps that are used as additional conditioning in [`UNet2DConditionModel`]. The model's architecture follows the origi...
class_definition
11,118
14,674
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/adapter.py
null
841
class FullAdapter(nn.Module): r""" See [`T2IAdapter`] for more information. """ def __init__( self, in_channels: int = 3, channels: List[int] = [320, 640, 1280, 1280], num_res_blocks: int = 2, downscale_factor: int = 8, ): super().__init__() ...
class_definition
14,694
16,356
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/adapter.py
null
842
class FullAdapterXL(nn.Module): r""" See [`T2IAdapter`] for more information. """ def __init__( self, in_channels: int = 3, channels: List[int] = [320, 640, 1280, 1280], num_res_blocks: int = 2, downscale_factor: int = 16, ): super().__init__() ...
class_definition
16,359
18,092
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/adapter.py
null
843
class AdapterBlock(nn.Module): r""" An AdapterBlock is a helper model that contains multiple ResNet-like blocks. It is used in the `FullAdapter` and `FullAdapterXL` models. Args: in_channels (`int`): Number of channels of AdapterBlock's input. out_channels (`int`): ...
class_definition
18,095
19,773
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/adapter.py
null
844
class AdapterResnetBlock(nn.Module): r""" An `AdapterResnetBlock` is a helper model that implements a ResNet-like block. Args: channels (`int`): Number of channels of AdapterResnetBlock's input and output. """ def __init__(self, channels: int): super().__init__() ...
class_definition
19,776
20,629
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/adapter.py
null
845
class LightAdapter(nn.Module): r""" See [`T2IAdapter`] for more information. """ def __init__( self, in_channels: int = 3, channels: List[int] = [320, 640, 1280], num_res_blocks: int = 4, downscale_factor: int = 8, ): super().__init__() in_ch...
class_definition
20,650
22,049
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/adapter.py
null
846
class LightAdapterBlock(nn.Module): r""" A `LightAdapterBlock` is a helper model that contains multiple `LightAdapterResnetBlocks`. It is used in the `LightAdapter` model. Args: in_channels (`int`): Number of channels of LightAdapterBlock's input. out_channels (`int`): ...
class_definition
22,052
23,688
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/adapter.py
null
847
class LightAdapterResnetBlock(nn.Module): """ A `LightAdapterResnetBlock` is a helper model that implements a ResNet-like block with a slightly different architecture than `AdapterResnetBlock`. Args: channels (`int`): Number of channels of LightAdapterResnetBlock's input and output....
class_definition
23,691
24,619
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/adapter.py
null
848
class SparseControlNetOutput(SparseControlNetOutput): def __init__(self, *args, **kwargs): deprecation_message = "Importing `SparseControlNetOutput` from `diffusers.models.controlnet_sparsectrl` is deprecated and this will be removed in a future version. Please use `from diffusers.models.controlnets.control...
class_definition
938
1,468
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet_sparsectrl.py
null
849
class SparseControlNetConditioningEmbedding(SparseControlNetConditioningEmbedding): def __init__(self, *args, **kwargs): deprecation_message = "Importing `SparseControlNetConditioningEmbedding` from `diffusers.models.controlnet_sparsectrl` is deprecated and this will be removed in a future version. Please u...
class_definition
1,471
2,098
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet_sparsectrl.py
null
850
class SparseControlNetModel(SparseControlNetModel): def __init__( self, in_channels: int = 4, conditioning_channels: int = 4, flip_sin_to_cos: bool = True, freq_shift: int = 0, down_block_types: Tuple[str, ...] = ( "CrossAttnDownBlockMotion", "...
class_definition
2,101
5,903
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/controlnet_sparsectrl.py
null
851
class FlaxAttention(nn.Module): r""" A Flax multi-head attention module as described in: https://arxiv.org/abs/1706.03762 Parameters: query_dim (:obj:`int`): Input hidden states dimension heads (:obj:`int`, *optional*, defaults to 8): Number of heads dim_head...
class_definition
4,896
10,607
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_flax.py
null
852
class FlaxBasicTransformerBlock(nn.Module): r""" A Flax transformer block layer with `GLU` (Gated Linear Unit) activation function as described in: https://arxiv.org/abs/1706.03762 Parameters: dim (:obj:`int`): Inner hidden states dimension n_heads (:obj:`int`): ...
class_definition
10,610
13,912
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_flax.py
null
853
class FlaxTransformer2DModel(nn.Module): r""" A Spatial Transformer layer with Gated Linear Unit (GLU) activation function as described in: https://arxiv.org/pdf/1506.02025.pdf Parameters: in_channels (:obj:`int`): Input number of channels n_heads (:obj:`int`): ...
class_definition
13,915
18,016
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_flax.py
null
854
class FlaxFeedForward(nn.Module): r""" Flax module that encapsulates two Linear layers separated by a non-linearity. It is the counterpart of PyTorch's [`FeedForward`] class, with the following simplifications: - The activation function is currently hardcoded to a gated linear unit from: https://arx...
class_definition
18,019
19,316
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_flax.py
null
855
class FlaxGEGLU(nn.Module): r""" Flax implementation of a Linear layer followed by the variant of the gated linear unit activation function from https://arxiv.org/abs/2002.05202. Parameters: dim (:obj:`int`): Input hidden states dimension dropout (:obj:`float`, *optional*, d...
class_definition
19,319
20,323
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/attention_flax.py
null
856
class FlaxUpsample2D(nn.Module): out_channels: int dtype: jnp.dtype = jnp.float32 def setup(self): self.conv = nn.Conv( self.out_channels, kernel_size=(3, 3), strides=(1, 1), padding=((1, 1), (1, 1)), dtype=self.dtype, ) def _...
class_definition
667
1,324
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/resnet_flax.py
null
857
class FlaxDownsample2D(nn.Module): out_channels: int dtype: jnp.dtype = jnp.float32 def setup(self): self.conv = nn.Conv( self.out_channels, kernel_size=(3, 3), strides=(2, 2), padding=((1, 1), (1, 1)), # padding="VALID", dtype=self.dtype...
class_definition
1,327
1,917
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/resnet_flax.py
null
858
class FlaxResnetBlock2D(nn.Module): in_channels: int out_channels: int = None dropout_prob: float = 0.0 use_nin_shortcut: bool = None dtype: jnp.dtype = jnp.float32 def setup(self): out_channels = self.in_channels if self.out_channels is None else self.out_channels self.norm1 =...
class_definition
1,920
4,020
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/resnet_flax.py
null
859
class PatchEmbed(nn.Module): """ 2D Image to Patch Embedding with support for SD3 cropping. Args: height (`int`, defaults to `224`): The height of the image. width (`int`, defaults to `224`): The width of the image. patch_size (`int`, defaults to `16`): The size of the patches. ...
class_definition
16,828
22,167
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
860
class LuminaPatchEmbed(nn.Module): """ 2D Image to Patch Embedding with support for Lumina-T2X Args: patch_size (`int`, defaults to `2`): The size of the patches. in_channels (`int`, defaults to `4`): The number of input channels. embed_dim (`int`, defaults to `768`): The output dim...
class_definition
22,170
24,142
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
861
class CogVideoXPatchEmbed(nn.Module): def __init__( self, patch_size: int = 2, patch_size_t: Optional[int] = None, in_channels: int = 16, embed_dim: int = 1920, text_embed_dim: int = 4096, bias: bool = True, sample_width: int = 90, sample_heigh...
class_definition
24,145
30,265
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
862
class CogView3PlusPatchEmbed(nn.Module): def __init__( self, in_channels: int = 16, hidden_size: int = 2560, patch_size: int = 2, text_hidden_size: int = 4096, pos_embed_max_size: int = 128, ): super().__init__() self.in_channels = in_channels ...
class_definition
30,268
32,737
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
863
class FluxPosEmbed(nn.Module): # modified from https://github.com/black-forest-labs/flux/blob/c00d7c60b085fce8058b9df845e036090873f2ce/src/flux/modules/layers.py#L11 def __init__(self, theta: int, axes_dim: List[int]): super().__init__() self.theta = theta self.axes_dim = axes_dim d...
class_definition
50,167
51,329
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
864
class TimestepEmbedding(nn.Module): def __init__( self, in_channels: int, time_embed_dim: int, act_fn: str = "silu", out_dim: int = None, post_act_fn: Optional[str] = None, cond_proj_dim=None, sample_proj_bias=True, ): super().__init__() ...
class_definition
51,332
52,693
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
865
class Timesteps(nn.Module): def __init__(self, num_channels: int, flip_sin_to_cos: bool, downscale_freq_shift: float, scale: int = 1): super().__init__() self.num_channels = num_channels self.flip_sin_to_cos = flip_sin_to_cos self.downscale_freq_shift = downscale_freq_shift s...
class_definition
52,696
53,333
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
866
class GaussianFourierProjection(nn.Module): """Gaussian Fourier embeddings for noise levels.""" def __init__( self, embedding_size: int = 256, scale: float = 1.0, set_W_to_weight=True, log=True, flip_sin_to_cos=False ): super().__init__() self.weight = nn.Parameter(torch.randn(embed...
class_definition
53,336
54,361
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
867
class SinusoidalPositionalEmbedding(nn.Module): """Apply positional information to a sequence of embeddings. Takes in a sequence of embeddings with shape (batch_size, seq_length, embed_dim) and adds positional embeddings to them Args: embed_dim: (int): Dimension of the positional embedding. ...
class_definition
54,364
55,344
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
868
class ImagePositionalEmbeddings(nn.Module): """ Converts latent image classes into vector embeddings. Sums the vector embeddings with positional embeddings for the height and width of the latent space. For more details, see figure 10 of the dall-e paper: https://arxiv.org/abs/2102.12092 For VQ-dif...
class_definition
55,347
57,426
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
869
class LabelEmbedding(nn.Module): """ Embeds class labels into vector representations. Also handles label dropout for classifier-free guidance. Args: num_classes (`int`): The number of classes. hidden_size (`int`): The size of the vector embeddings. dropout_prob (`float`): The probab...
class_definition
57,429
58,841
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
870
class TextImageProjection(nn.Module): def __init__( self, text_embed_dim: int = 1024, image_embed_dim: int = 768, cross_attention_dim: int = 768, num_image_text_embeds: int = 10, ): super().__init__() self.num_image_text_embeds = num_image_text_embeds ...
class_definition
58,844
59,766
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
871
class ImageProjection(nn.Module): def __init__( self, image_embed_dim: int = 768, cross_attention_dim: int = 768, num_image_text_embeds: int = 32, ): super().__init__() self.num_image_text_embeds = num_image_text_embeds self.image_embeds = nn.Linear(image...
class_definition
59,769
60,569
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
872
class IPAdapterFullImageProjection(nn.Module): def __init__(self, image_embed_dim=1024, cross_attention_dim=1024): super().__init__() from .attention import FeedForward self.ff = FeedForward(image_embed_dim, cross_attention_dim, mult=1, activation_fn="gelu") self.norm = nn.LayerNorm...
class_definition
60,572
61,013
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
873
class IPAdapterFaceIDImageProjection(nn.Module): def __init__(self, image_embed_dim=1024, cross_attention_dim=1024, mult=1, num_tokens=1): super().__init__() from .attention import FeedForward self.num_tokens = num_tokens self.cross_attention_dim = cross_attention_dim self.f...
class_definition
61,016
61,672
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
874
class CombinedTimestepLabelEmbeddings(nn.Module): def __init__(self, num_classes, embedding_dim, class_dropout_prob=0.1): super().__init__() self.time_proj = Timesteps(num_channels=256, flip_sin_to_cos=True, downscale_freq_shift=1) self.timestep_embedder = TimestepEmbedding(in_channels=256,...
class_definition
61,675
62,491
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
875
class CombinedTimestepTextProjEmbeddings(nn.Module): def __init__(self, embedding_dim, pooled_projection_dim): super().__init__() self.time_proj = Timesteps(num_channels=256, flip_sin_to_cos=True, downscale_freq_shift=0) self.timestep_embedder = TimestepEmbedding(in_channels=256, time_embed...
class_definition
62,494
63,307
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
876
class CombinedTimestepGuidanceTextProjEmbeddings(nn.Module): def __init__(self, embedding_dim, pooled_projection_dim): super().__init__() self.time_proj = Timesteps(num_channels=256, flip_sin_to_cos=True, downscale_freq_shift=0) self.timestep_embedder = TimestepEmbedding(in_channels=256, ti...
class_definition
63,310
64,455
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
877
class CogView3CombinedTimestepSizeEmbeddings(nn.Module): def __init__(self, embedding_dim: int, condition_dim: int, pooled_projection_dim: int, timesteps_dim: int = 256): super().__init__() self.time_proj = Timesteps(num_channels=timesteps_dim, flip_sin_to_cos=True, downscale_freq_shift=0) ...
class_definition
64,458
66,124
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
878
class HunyuanDiTAttentionPool(nn.Module): # Copied from https://github.com/Tencent/HunyuanDiT/blob/cb709308d92e6c7e8d59d0dff41b74d35088db6a/hydit/modules/poolers.py#L6 def __init__(self, spacial_dim: int, embed_dim: int, num_heads: int, output_dim: int = None): super().__init__() self.positiona...
class_definition
66,127
67,825
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
879
class HunyuanCombinedTimestepTextSizeStyleEmbedding(nn.Module): def __init__( self, embedding_dim, pooled_projection_dim=1024, seq_len=256, cross_attention_dim=2048, use_style_cond_and_image_meta_size=True, ): super().__init__() self.time_proj = T...
class_definition
67,828
70,345
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
880
class LuminaCombinedTimestepCaptionEmbedding(nn.Module): def __init__(self, hidden_size=4096, cross_attention_dim=2048, frequency_embedding_size=256): super().__init__() self.time_proj = Timesteps( num_channels=frequency_embedding_size, flip_sin_to_cos=True, downscale_freq_shift=0.0 ...
class_definition
70,348
71,697
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
881
class MochiCombinedTimestepCaptionEmbedding(nn.Module): def __init__( self, embedding_dim: int, pooled_projection_dim: int, text_embed_dim: int, time_embed_dim: int = 256, num_attention_heads: int = 8, ) -> None: super().__init__() self.time_proj ...
class_definition
71,700
73,038
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
882
class TextTimeEmbedding(nn.Module): def __init__(self, encoder_dim: int, time_embed_dim: int, num_heads: int = 64): super().__init__() self.norm1 = nn.LayerNorm(encoder_dim) self.pool = AttentionPooling(num_heads, encoder_dim) self.proj = nn.Linear(encoder_dim, time_embed_dim) ...
class_definition
73,041
73,670
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
883
class TextImageTimeEmbedding(nn.Module): def __init__(self, text_embed_dim: int = 768, image_embed_dim: int = 768, time_embed_dim: int = 1536): super().__init__() self.text_proj = nn.Linear(text_embed_dim, time_embed_dim) self.text_norm = nn.LayerNorm(time_embed_dim) self.image_proj ...
class_definition
73,673
74,374
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
884
class ImageTimeEmbedding(nn.Module): def __init__(self, image_embed_dim: int = 768, time_embed_dim: int = 1536): super().__init__() self.image_proj = nn.Linear(image_embed_dim, time_embed_dim) self.image_norm = nn.LayerNorm(time_embed_dim) def forward(self, image_embeds: torch.Tensor): ...
class_definition
74,377
74,866
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
885
class ImageHintTimeEmbedding(nn.Module): def __init__(self, image_embed_dim: int = 768, time_embed_dim: int = 1536): super().__init__() self.image_proj = nn.Linear(image_embed_dim, time_embed_dim) self.image_norm = nn.LayerNorm(time_embed_dim) self.input_hint_block = nn.Sequential( ...
class_definition
74,869
76,039
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
886
class AttentionPooling(nn.Module): # Copied from https://github.com/deep-floyd/IF/blob/2f91391f27dd3c468bf174be5805b4cc92980c0b/deepfloyd_if/model/nn.py#L54 def __init__(self, num_heads, embed_dim, dtype=None): super().__init__() self.dtype = dtype self.positional_embedding = nn.Paramet...
class_definition
76,042
78,320
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
887
class MochiAttentionPool(nn.Module): def __init__( self, num_attention_heads: int, embed_dim: int, output_dim: Optional[int] = None, ) -> None: super().__init__() self.output_dim = output_dim or embed_dim self.num_attention_heads = num_attention_heads ...
class_definition
78,323
81,450
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
888
class GLIGENTextBoundingboxProjection(nn.Module): def __init__(self, positive_len, out_dim, feature_type="text-only", fourier_freqs=8): super().__init__() self.positive_len = positive_len self.out_dim = out_dim self.fourier_embedder_dim = fourier_freqs self.position_dim = fo...
class_definition
82,086
85,757
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
889
class PixArtAlphaCombinedTimestepSizeEmbeddings(nn.Module): """ For PixArt-Alpha. Reference: https://github.com/PixArt-alpha/PixArt-alpha/blob/0f55e922376d8b797edd44d25d0e7464b260dcab/diffusion/model/nets/PixArtMS.py#L164C9-L168C29 """ def __init__(self, embedding_dim, size_emb_dim, use_additi...
class_definition
85,760
87,656
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
890
class PixArtAlphaTextProjection(nn.Module): """ Projects caption embeddings. Also handles dropout for classifier-free guidance. Adapted from https://github.com/PixArt-alpha/PixArt-alpha/blob/master/diffusion/model/nets/PixArt_blocks.py """ def __init__(self, in_features, hidden_size, out_features=...
class_definition
87,659
88,819
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
891
class IPAdapterPlusImageProjectionBlock(nn.Module): def __init__( self, embed_dims: int = 768, dim_head: int = 64, heads: int = 16, ffn_ratio: float = 4, ) -> None: super().__init__() from .attention import FeedForward self.ln0 = nn.LayerNorm(embe...
class_definition
88,822
89,881
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
892
class IPAdapterPlusImageProjection(nn.Module): """Resampler of IP-Adapter Plus. Args: embed_dims (int): The feature dimension. Defaults to 768. output_dims (int): The number of output channels, that is the same number of the channels in the `unet.config.cross_attention_dim`. Default...
class_definition
89,884
91,907
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
893
class IPAdapterFaceIDPlusImageProjection(nn.Module): """FacePerceiverResampler of IP-Adapter Plus. Args: embed_dims (int): The feature dimension. Defaults to 768. output_dims (int): The number of output channels, that is the same number of the channels in the `unet.config.cross_atte...
class_definition
91,910
94,912
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
894
class IPAdapterTimeImageProjectionBlock(nn.Module): """Block for IPAdapterTimeImageProjection. Args: hidden_dim (`int`, defaults to 1280): The number of hidden channels. dim_head (`int`, defaults to 64): The number of head channels. heads (`int`, defaults to 20):...
class_definition
94,915
98,351
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
895
class IPAdapterTimeImageProjection(nn.Module): """Resampler of SD3 IP-Adapter with timestep embedding. Args: embed_dim (`int`, defaults to 1152): The feature dimension. output_dim (`int`, defaults to 2432): The number of output channels. hidden_dim (`int`, defaul...
class_definition
98,456
101,572
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
896
class MultiIPAdapterImageProjection(nn.Module): def __init__(self, IPAdapterImageProjectionLayers: Union[List[nn.Module], Tuple[nn.Module]]): super().__init__() self.image_projection_layers = nn.ModuleList(IPAdapterImageProjectionLayers) def forward(self, image_embeds: List[torch.Tensor]): ...
class_definition
101,575
103,574
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/embeddings.py
null
897
class ResnetBlockCondNorm2D(nn.Module): r""" A Resnet block that use normalization layer that incorporate conditioning information. Parameters: in_channels (`int`): The number of channels in the input. out_channels (`int`, *optional*, default to be `None`): The number of output ...
class_definition
1,305
8,134
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/resnet.py
null
898
class ResnetBlock2D(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`. dr...
class_definition
8,137
16,939
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/models/resnet.py
null
899