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 FrozenDict(OrderedDict): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) for key, value in self.items(): setattr(self, key, value) self.__frozen = True def __delitem__(self, *args, **kwargs): raise Exception(f"You cannot use ``__delitem...
class_definition
1,471
2,729
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/configuration_utils.py
null
0
class ConfigMixin: r""" Base class for all configuration classes. All configuration parameters are stored under `self.config`. Also provides the [`~ConfigMixin.from_config`] and [`~ConfigMixin.save_config`] methods for loading, downloading, and saving classes that inherit from [`ConfigMixin`]. Clas...
class_definition
2,732
29,807
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/configuration_utils.py
null
1
class LegacyConfigMixin(ConfigMixin): r""" A subclass of `ConfigMixin` to resolve class mapping from legacy classes (like `Transformer2DModel`) to more pipeline-specific classes (like `DiTTransformer2DModel`). """ @classmethod def from_config(cls, config: Union[FrozenDict, Dict[str, Any]] = Non...
class_definition
33,715
34,386
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/configuration_utils.py
null
2
class VaeImageProcessor(ConfigMixin): """ Image processor for VAE. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to downscale the image's (height, width) dimensions to multiples of `vae_scale_factor`. Can accept `height` and `width` arguments from [`image...
class_definition
2,722
32,473
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/image_processor.py
null
3
class VaeImageProcessorLDM3D(VaeImageProcessor): """ Image processor for VAE LDM3D. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to downscale the image's (height, width) dimensions to multiples of `vae_scale_factor`. vae_scale_factor (`int`, *optional*, defa...
class_definition
32,476
44,360
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/image_processor.py
null
4
class IPAdapterMaskProcessor(VaeImageProcessor): """ Image processor for IP Adapter image masks. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to downscale the image's (height, width) dimensions to multiples of `vae_scale_factor`. vae_scale_factor (`int`, *op...
class_definition
44,363
48,691
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/image_processor.py
null
5
class PixArtImageProcessor(VaeImageProcessor): """ Image processor for PixArt image resize and crop. Args: do_resize (`bool`, *optional*, defaults to `True`): Whether to downscale the image's (height, width) dimensions to multiples of `vae_scale_factor`. Can accept `height` ...
class_definition
48,694
52,715
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/image_processor.py
null
6
class VideoProcessor(VaeImageProcessor): r"""Simple video processor.""" def preprocess_video(self, video, height: Optional[int] = None, width: Optional[int] = None) -> torch.Tensor: r""" Preprocesses input video(s). Args: video (`List[PIL.Image]`, `List[List[PIL.Image]]`, `...
class_definition
800
5,401
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/video_processor.py
null
7
class SchedulerType(Enum): LINEAR = "linear" COSINE = "cosine" COSINE_WITH_RESTARTS = "cosine_with_restarts" POLYNOMIAL = "polynomial" CONSTANT = "constant" CONSTANT_WITH_WARMUP = "constant_with_warmup" PIECEWISE_CONSTANT = "piecewise_constant"
class_definition
875
1,147
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/optimization.py
null
8
class EMAModel: """ Exponential Moving Average of models weights """ def __init__( self, parameters: Iterable[torch.nn.Parameter], decay: float = 0.9999, min_decay: float = 0.0, update_after_step: int = 0, use_ema_warmup: bool = False, inv_gamma: ...
class_definition
11,693
26,213
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/training_utils.py
null
9
class PipelineCallback(ConfigMixin): """ Base class for all the official callbacks used in a pipeline. This class provides a structure for implementing custom callbacks and ensures that all callbacks have a consistent interface. Please implement the following: `tensor_inputs`: This should retur...
class_definition
134
1,945
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/callbacks.py
null
10
class MultiPipelineCallbacks: """ This class is designed to handle multiple pipeline callbacks. It accepts a list of PipelineCallback objects and provides a unified interface for calling all of them. """ def __init__(self, callbacks: List[PipelineCallback]): self.callbacks = callbacks ...
class_definition
1,948
2,790
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/callbacks.py
null
11
class SDCFGCutoffCallback(PipelineCallback): """ Callback function for Stable Diffusion Pipelines. After certain number of steps (set by `cutoff_step_ratio` or `cutoff_step_index`), this callback will disable the CFG. Note: This callback mutates the pipeline by changing the `_guidance_scale` attribute ...
class_definition
2,793
3,989
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/callbacks.py
null
12
class SDXLCFGCutoffCallback(PipelineCallback): """ Callback function for the base Stable Diffusion XL Pipelines. After certain number of steps (set by `cutoff_step_ratio` or `cutoff_step_index`), this callback will disable the CFG. Note: This callback mutates the pipeline by changing the `_guidance_sca...
class_definition
3,992
5,768
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/callbacks.py
null
13
class SDXLControlnetCFGCutoffCallback(PipelineCallback): """ Callback function for the Controlnet Stable Diffusion XL Pipelines. After certain number of steps (set by `cutoff_step_ratio` or `cutoff_step_index`), this callback will disable the CFG. Note: This callback mutates the pipeline by changing th...
class_definition
5,771
7,759
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/callbacks.py
null
14
class IPAdapterScaleCutoffCallback(PipelineCallback): """ Callback function for any pipeline that inherits `IPAdapterMixin`. After certain number of steps (set by `cutoff_step_ratio` or `cutoff_step_index`), this callback will set the IP Adapter scale to `0.0`. Note: This callback mutates the IP Adapte...
class_definition
7,762
8,748
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/callbacks.py
null
15
class ValueGuidedRLPipeline(DiffusionPipeline): r""" Pipeline for value-guided sampling from a diffusion model trained to predict sequences of states. This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods implemented for all pipelines (downloading, s...
class_definition
843
6,032
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/experimental/rl/value_guided_sampling.py
null
16
class QuantizationMethod(str, Enum): BITS_AND_BYTES = "bitsandbytes" GGUF = "gguf" TORCHAO = "torchao"
class_definition
1,208
1,322
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/quantization_config.py
null
17
class QuantizationConfigMixin: """ Mixin class for quantization config """ quant_method: QuantizationMethod _exclude_attributes_at_init = [] @classmethod def from_dict(cls, config_dict, return_unused_kwargs=False, **kwargs): """ Instantiates a [`QuantizationConfigMixin`] fr...
class_definition
1,336
5,659
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/quantization_config.py
null
18
class BitsAndBytesConfig(QuantizationConfigMixin): """ This is a wrapper class about all possible attributes and features that you can play with a model that has been loaded using `bitsandbytes`. This replaces `load_in_8bit` or `load_in_4bit`therefore both options are mutually exclusive. Currently...
class_definition
5,673
17,200
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/quantization_config.py
null
19
class GGUFQuantizationConfig(QuantizationConfigMixin): """This is a config class for GGUF Quantization techniques. Args: compute_dtype: (`torch.dtype`, defaults to `torch.float32`): This sets the computational type which might be different than the input type. For example, inputs might be ...
class_definition
17,214
18,046
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/quantization_config.py
null
20
class TorchAoConfig(QuantizationConfigMixin): """This is a config class for torchao quantization/sparsity techniques. Args: quant_type (`str`): The type of quantization we want to use, currently supporting: - **Integer quantization:** - Full function name...
class_definition
18,060
30,174
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/quantization_config.py
null
21
class DiffusersQuantizer(ABC): """ Abstract class of the HuggingFace quantizer. Supports for now quantizing HF diffusers models for inference and/or quantization. This class is used only for diffusers.models.modeling_utils.ModelMixin.from_pretrained and cannot be easily used outside the scope of that me...
class_definition
1,076
9,564
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/base.py
null
22
class DiffusersAutoQuantizer: """ The auto diffusers quantizer class that takes care of automatically instantiating to the correct `DiffusersQuantizer` given the `QuantizationConfig`. """ @classmethod def from_dict(cls, quantization_config_dict: Dict): quant_method = quantization_confi...
class_definition
1,524
5,675
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/auto.py
null
23
class GGUFQuantizer(DiffusersQuantizer): use_keep_in_fp32_modules = True def __init__(self, quantization_config, **kwargs): super().__init__(quantization_config, **kwargs) self.compute_dtype = quantization_config.compute_dtype self.pre_quantized = quantization_config.pre_quantized ...
class_definition
677
5,753
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/gguf/gguf_quantizer.py
null
24
class GGUFParameter(torch.nn.Parameter): def __new__(cls, data, requires_grad=False, quant_type=None): data = data if data is not None else torch.empty(0) self = torch.Tensor._make_subclass(cls, data, requires_grad) self.quant_type = quant_type return self def as_tensor(self): ...
class_definition
13,739
15,334
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/gguf/utils.py
null
25
class GGUFLinear(nn.Linear): def __init__( self, in_features, out_features, bias=False, compute_dtype=None, device=None, ) -> None: super().__init__(in_features, out_features, bias, device) self.compute_dtype = compute_dtype def forward(self, ...
class_definition
15,337
15,937
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/gguf/utils.py
null
26
class TorchAoHfQuantizer(DiffusersQuantizer): r""" Diffusers Quantizer for TorchAO: https://github.com/pytorch/ao/. """ requires_calibration = False required_packages = ["torchao"] def __init__(self, quantization_config, **kwargs): super().__init__(quantization_config, **kwargs) d...
class_definition
2,926
12,820
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/torchao/torchao_quantizer.py
null
27
class BnB4BitDiffusersQuantizer(DiffusersQuantizer): """ 4-bit quantization from bitsandbytes.py quantization method: before loading: converts transformer layers into Linear4bit during loading: load 16bit weight and pass to the layer object after: quantizes individual weights in Linear4bit into ...
class_definition
1,257
14,257
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/bitsandbytes/bnb_quantizer.py
null
28
class BnB8BitDiffusersQuantizer(DiffusersQuantizer): """ 8-bit quantization from bitsandbytes quantization method: before loading: converts transformer layers into Linear8bitLt during loading: load 16bit weight and pass to the layer object after: quantizes individual weights in Linear8bitLt into...
class_definition
14,260
25,821
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/quantizers/bitsandbytes/bnb_quantizer.py
null
29
class FlaxImagePipelineOutput(BaseOutput): """ Output class for image pipelines. Args: images (`List[PIL.Image.Image]` or `np.ndarray`) List of denoised PIL images of length `batch_size` or NumPy array of shape `(batch_size, height, width, num_channels)`. """ images...
class_definition
2,892
3,254
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/pipeline_flax_utils.py
null
30
class FlaxDiffusionPipeline(ConfigMixin, PushToHubMixin): r""" Base class for Flax-based pipelines. [`FlaxDiffusionPipeline`] stores all components (models, schedulers, and processors) for diffusion pipelines and provides methods for loading, downloading and saving models. It also includes methods to: ...
class_definition
3,257
27,130
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/pipeline_flax_utils.py
null
31
class AutoPipelineForText2Image(ConfigMixin): r""" [`AutoPipelineForText2Image`] is a generic pipeline class that instantiates a text-to-image pipeline class. The specific underlying pipeline class is automatically selected from either the [`~AutoPipelineForText2Image.from_pretrained`] or [`~AutoPipeli...
class_definition
10,531
25,964
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/auto_pipeline.py
null
32
class AutoPipelineForImage2Image(ConfigMixin): r""" [`AutoPipelineForImage2Image`] is a generic pipeline class that instantiates an image-to-image pipeline class. The specific underlying pipeline class is automatically selected from either the [`~AutoPipelineForImage2Image.from_pretrained`] or [`~AutoP...
class_definition
25,967
42,073
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/auto_pipeline.py
null
33
class AutoPipelineForInpainting(ConfigMixin): r""" [`AutoPipelineForInpainting`] is a generic pipeline class that instantiates an inpainting pipeline class. The specific underlying pipeline class is automatically selected from either the [`~AutoPipelineForInpainting.from_pretrained`] or [`~AutoPipeline...
class_definition
42,076
58,024
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/auto_pipeline.py
null
34
class FreeInitMixin: r"""Mixin class for FreeInit.""" def enable_free_init( self, num_iters: int = 3, use_fast_sampling: bool = False, method: str = "butterworth", order: int = 4, spatial_stop_frequency: float = 0.25, temporal_stop_frequency: float = 0.25...
class_definition
737
7,690
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/free_init_utils.py
null
35
class OnnxRuntimeModel: def __init__(self, model=None, **kwargs): logger.info("`diffusers.OnnxRuntimeModel` is experimental and might change in the future.") self.model = model self.model_save_dir = kwargs.get("model_save_dir", None) self.latest_model_name = kwargs.get("latest_model_...
class_definition
1,473
8,328
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/onnx_utils.py
null
36
class ImagePipelineOutput(BaseOutput): """ Output class for image pipelines. Args: images (`List[PIL.Image.Image]` or `np.ndarray`) List of denoised PIL images of length `batch_size` or NumPy array of shape `(batch_size, height, width, num_channels)`. """ images: Un...
class_definition
3,101
3,459
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/pipeline_utils.py
null
37
class AudioPipelineOutput(BaseOutput): """ Output class for audio pipelines. Args: audios (`np.ndarray`) List of denoised audio samples of a NumPy array of shape `(batch_size, num_channels, sample_rate)`. """ audios: np.ndarray
class_definition
3,473
3,742
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/pipeline_utils.py
null
38
class DiffusionPipeline(ConfigMixin, PushToHubMixin): r""" Base class for all pipelines. [`DiffusionPipeline`] stores all components (models, schedulers, and processors) for diffusion pipelines and provides methods for loading, downloading and saving models. It also includes methods to: - move...
class_definition
3,745
93,613
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/pipeline_utils.py
null
39
class StableDiffusionMixin: r""" Helper for DiffusionPipeline with vae and unet.(mainly for LDM such as stable diffusion) """ def enable_vae_slicing(self): r""" Enable sliced VAE decoding. When this option is enabled, the VAE will split the input tensor in slices to compute deco...
class_definition
93,616
98,430
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/pipeline_utils.py
null
40
class SplitInferenceModule(nn.Module): r""" A wrapper module class that splits inputs along a specified dimension before performing a forward pass. This module is useful when you need to perform inference on large tensors in a memory-efficient way by breaking them into smaller chunks, processing each c...
class_definition
1,277
6,502
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/free_noise_utils.py
null
41
class AnimateDiffFreeNoiseMixin: r"""Mixin class for [FreeNoise](https://arxiv.org/abs/2310.15169).""" def _enable_free_noise_in_block(self, block: Union[CrossAttnDownBlockMotion, DownBlockMotion, UpBlockMotion]): r"""Helper function to enable FreeNoise in transformer blocks.""" for motion_mod...
class_definition
6,505
29,681
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/free_noise_utils.py
null
42
class StableDiffusionGLIGENPipeline(DiffusionPipeline, StableDiffusionMixin): r""" Pipeline for text-to-image generation using Stable Diffusion with Grounded-Language-to-Image Generation (GLIGEN). This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the...
class_definition
4,078
43,386
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/stable_diffusion_gligen/pipeline_stable_diffusion_gligen.py
null
43
class StableDiffusionGLIGENTextImagePipeline(DiffusionPipeline, StableDiffusionMixin): r""" Pipeline for text-to-image generation using Stable Diffusion with Grounded-Language-to-Image Generation (GLIGEN). This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic me...
class_definition
6,195
51,977
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/stable_diffusion_gligen/pipeline_stable_diffusion_gligen_text_image.py
null
44
class StableVideoDiffusionPipelineOutput(BaseOutput): r""" Output class for Stable Video Diffusion pipeline. Args: frames (`[List[List[PIL.Image.Image]]`, `np.ndarray`, `torch.Tensor`]): List of denoised PIL images of length `batch_size` or numpy array or torch tensor of shape `(batch_s...
class_definition
5,752
6,213
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/stable_video_diffusion/pipeline_stable_video_diffusion.py
null
45
class StableVideoDiffusionPipeline(DiffusionPipeline): r""" Pipeline to generate video from an input image using Stable Video Diffusion. This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods implemented for all pipelines (downloading, saving, running...
class_definition
6,216
29,021
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/stable_video_diffusion/pipeline_stable_video_diffusion.py
null
46
class PIAPipelineOutput(BaseOutput): r""" Output class for PIAPipeline. Args: frames (`torch.Tensor`, `np.ndarray`, or List[List[PIL.Image.Image]]): Nested list of length `batch_size` with denoised PIL image sequences of length `num_frames`, NumPy array of shape `(batch_size...
class_definition
4,608
5,135
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/pia/pipeline_pia.py
null
47
class PIAPipeline( DiffusionPipeline, StableDiffusionMixin, TextualInversionLoaderMixin, IPAdapterMixin, StableDiffusionLoraLoaderMixin, FromSingleFileMixin, FreeInitMixin, ): r""" Pipeline for text-to-video generation. This model inherits from [`DiffusionPipeline`]. Check the s...
class_definition
5,138
46,411
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/pia/pipeline_pia.py
null
48
class MochiPipeline(DiffusionPipeline, Mochi1LoraLoaderMixin): r""" The mochi pipeline for text-to-video generation. Reference: https://github.com/genmoai/models Args: transformer ([`MochiTransformer3DModel`]): Conditional Transformer architecture to denoise the encoded video laten...
class_definition
6,336
35,210
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/mochi/pipeline_mochi.py
null
49
class MochiPipelineOutput(BaseOutput): r""" Output class for Mochi pipelines. Args: frames (`torch.Tensor`, `np.ndarray`, or List[List[PIL.Image.Image]]): List of video outputs - It can be a nested list of length `batch_size,` with each sub-list containing denoised PIL image...
class_definition
101
608
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/mochi/pipeline_output.py
null
50
class KolorsImg2ImgPipeline(DiffusionPipeline, StableDiffusionMixin, StableDiffusionXLLoraLoaderMixin, IPAdapterMixin): r""" Pipeline for text-to-image generation using Kolors. This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the library impleme...
class_definition
6,495
65,830
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/pipeline_kolors_img2img.py
null
51
class KolorsPipeline(DiffusionPipeline, StableDiffusionMixin, StableDiffusionXLLoraLoaderMixin, IPAdapterMixin): r""" Pipeline for text-to-image generation using Kolors. This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the library implements for...
class_definition
5,455
55,976
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/pipeline_kolors.py
null
52
class KolorsPipelineOutput(BaseOutput): """ Output class for Kolors pipelines. Args: images (`List[PIL.Image.Image]` or `np.ndarray`) List of denoised PIL images of length `batch_size` or numpy array of shape `(batch_size, height, width, num_channels)`. PIL images or numpy a...
class_definition
148
589
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/pipeline_output.py
null
53
class ChatGLMConfig(PretrainedConfig): model_type = "chatglm" def __init__( self, num_layers=28, padded_vocab_size=65024, hidden_size=4096, ffn_hidden_size=13696, kv_channels=128, num_attention_heads=32, seq_length=2048, hidden_dropout=0.0...
class_definition
1,037
3,327
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
54
class RMSNorm(torch.nn.Module): def __init__(self, normalized_shape, eps=1e-5, device=None, dtype=None, **kwargs): super().__init__() self.weight = torch.nn.Parameter(torch.empty(normalized_shape, device=device, dtype=dtype)) self.eps = eps def forward(self, hidden_states: torch.Tensor)...
class_definition
3,330
3,909
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
55
class CoreAttention(torch.nn.Module): def __init__(self, config: ChatGLMConfig, layer_number): super(CoreAttention, self).__init__() self.apply_query_key_layer_scaling = config.apply_query_key_layer_scaling self.attention_softmax_in_fp32 = config.attention_softmax_in_fp32 if self.ap...
class_definition
4,031
10,104
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
56
class SelfAttention(torch.nn.Module): """Parallel self-attention layer abstract class. Self-attention layer takes input with size [s, b, h] and returns output of the same size. """ def __init__(self, config: ChatGLMConfig, layer_number, device=None): super(SelfAttention, self).__init__() ...
class_definition
11,779
17,834
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
57
class MLP(torch.nn.Module): """MLP. MLP will take the input with h hidden state, project it to 4*h hidden dimension, perform nonlinear transformation, and project the state back into h hidden dimension. """ def __init__(self, config: ChatGLMConfig, device=None): super(MLP, self).__init__()...
class_definition
17,837
19,182
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
58
class GLMBlock(torch.nn.Module): """A single transformer layer. Transformer layer takes input with size [s, b, h] and returns an output of the same size. """ def __init__(self, config: ChatGLMConfig, layer_number, device=None): super(GLMBlock, self).__init__() self.layer_number = layer...
class_definition
19,185
21,803
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
59
class GLMTransformer(torch.nn.Module): """Transformer class.""" def __init__(self, config: ChatGLMConfig, device=None): super(GLMTransformer, self).__init__() self.fp32_residual_connection = config.fp32_residual_connection self.post_layer_norm = config.post_layer_norm # Number...
class_definition
21,806
24,692
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
60
class ChatGLMPreTrainedModel(PreTrainedModel): """ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. """ is_parallelizable = False supports_gradient_checkpointing = True config_class = ChatGLMConfig base_model_prefix...
class_definition
24,695
26,533
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
61
class Embedding(torch.nn.Module): """Language model embeddings.""" def __init__(self, config: ChatGLMConfig, device=None): super(Embedding, self).__init__() self.hidden_size = config.hidden_size # Word embeddings (parallel). self.word_embeddings = nn.Embedding( conf...
class_definition
26,610
27,582
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
62
class RotaryEmbedding(nn.Module): def __init__(self, dim, original_impl=False, device=None, dtype=None): super().__init__() inv_freq = 1.0 / (10000 ** (torch.arange(0, dim, 2, device=device).to(dtype=dtype) / dim)) self.register_buffer("inv_freq", inv_freq) self.dim = dim sel...
class_definition
27,585
29,355
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
63
class PrefixEncoder(torch.nn.Module): """ The torch.nn model to encode the prefix Input shape: (batch-size, prefix-length) Output shape: (batch-size, prefix-length, 2*layers*hidden) """ def __init__(self, config: ChatGLMConfig): super().__init__() self.prefix_projection = config.pre...
class_definition
29,358
30,645
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
64
class ChatGLMModel(ChatGLMPreTrainedModel): def __init__(self, config: ChatGLMConfig, device=None, empty_init=True): super().__init__(config) if empty_init: init_method = skip_init else: init_method = default_init init_kwargs = {} if device is not None...
class_definition
30,648
35,794
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/text_encoder.py
null
65
class SPTokenizer: def __init__(self, model_path: str): # reload tokenizer assert os.path.isfile(model_path), model_path self.sp_model = SentencePieceProcessor(model_file=model_path) # BOS / EOS token IDs self.n_words: int = self.sp_model.vocab_size() self.bos_id: in...
class_definition
952
4,128
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/tokenizer.py
null
66
class ChatGLMTokenizer(PreTrainedTokenizer): vocab_files_names = {"vocab_file": "tokenizer.model"} model_input_names = ["input_ids", "attention_mask", "position_ids"] def __init__( self, vocab_file, padding_side="left", clean_up_tokenization_spaces=False, encode_spe...
class_definition
4,131
13,427
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kolors/tokenizer.py
null
67
class AttentionStore: @staticmethod def get_empty_store(): return {"down": [], "mid": [], "up": []} def __call__(self, attn, is_cross: bool, place_in_unet: str): if self.cur_att_layer >= 0 and is_cross: if attn.shape[1] == np.prod(self.attn_res): self.step_store[...
class_definition
2,929
4,789
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/stable_diffusion_attend_and_excite/pipeline_stable_diffusion_attend_and_excite.py
null
68
class AttendExciteAttnProcessor: def __init__(self, attnstore, place_in_unet): super().__init__() self.attnstore = attnstore self.place_in_unet = place_in_unet def __call__(self, attn: Attention, hidden_states, encoder_hidden_states=None, attention_mask=None): batch_size, sequen...
class_definition
4,792
6,260
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/stable_diffusion_attend_and_excite/pipeline_stable_diffusion_attend_and_excite.py
null
69
class StableDiffusionAttendAndExcitePipeline(DiffusionPipeline, StableDiffusionMixin, TextualInversionLoaderMixin): r""" Pipeline for text-to-image generation using Stable Diffusion and Attend-and-Excite. This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic met...
class_definition
6,263
49,042
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/stable_diffusion_attend_and_excite/pipeline_stable_diffusion_attend_and_excite.py
null
70
class GaussianSmoothing(torch.nn.Module): """ Arguments: Apply gaussian smoothing on a 1d, 2d or 3d tensor. Filtering is performed seperately for each channel in the input using a depthwise convolution. channels (int, sequence): Number of channels of the input tensors. Output will ha...
class_definition
49,045
51,459
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/stable_diffusion_attend_and_excite/pipeline_stable_diffusion_attend_and_excite.py
null
71
class KandinskyImg2ImgPipeline(DiffusionPipeline): """ Pipeline for image-to-image generation using Kandinsky This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the library implements for all the pipelines (such as downloading or saving, running o...
class_definition
3,216
22,005
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py
null
72
class KandinskyPriorPipelineOutput(BaseOutput): """ Output class for KandinskyPriorPipeline. Args: image_embeds (`torch.Tensor`) clip image embeddings for text prompt negative_image_embeds (`List[PIL.Image.Image]` or `np.ndarray`) clip image embeddings for unconditio...
class_definition
3,773
4,221
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py
null
73
class KandinskyPriorPipeline(DiffusionPipeline): """ Pipeline for generating image prior for Kandinsky This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the library implements for all the pipelines (such as downloading or saving, running on a par...
class_definition
4,224
24,019
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py
null
74
class KandinskyInpaintPipeline(DiffusionPipeline): """ Pipeline for text-guided image inpainting using Kandinsky2.1 This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the library implements for all the pipelines (such as downloading or saving, run...
class_definition
9,239
28,723
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py
null
75
class KandinskyPipeline(DiffusionPipeline): """ Pipeline for text-to-image generation using Kandinsky This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the library implements for all the pipelines (such as downloading or saving, running on a part...
class_definition
2,473
17,900
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py
null
76
class MCLIPConfig(XLMRobertaConfig): model_type = "M-CLIP" def __init__(self, transformerDimSize=1024, imageDimSize=768, **kwargs): self.transformerDimensions = transformerDimSize self.numDims = imageDimSize super().__init__(**kwargs)
class_definition
91
358
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kandinsky/text_encoder.py
null
77
class MultilingualCLIP(PreTrainedModel): config_class = MCLIPConfig def __init__(self, config, *args, **kwargs): super().__init__(config, *args, **kwargs) self.transformer = XLMRobertaModel(config) self.LinearTransformation = torch.nn.Linear( in_features=config.transformerDi...
class_definition
361
1,021
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kandinsky/text_encoder.py
null
78
class KandinskyCombinedPipeline(DiffusionPipeline): """ Combined Pipeline for text-to-image generation using Kandinsky This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the library implements for all the pipelines (such as downloading or saving, ...
class_definition
3,805
14,587
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_combined.py
null
79
class KandinskyImg2ImgCombinedPipeline(DiffusionPipeline): """ Combined Pipeline for image-to-image generation using Kandinsky This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the library implements for all the pipelines (such as downloading or ...
class_definition
14,590
26,939
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_combined.py
null
80
class KandinskyInpaintCombinedPipeline(DiffusionPipeline): """ Combined Pipeline for generation using Kandinsky This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the library implements for all the pipelines (such as downloading or saving, running...
class_definition
26,942
39,546
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_combined.py
null
81
class StableDiffusion3ControlNetPipeline( DiffusionPipeline, SD3LoraLoaderMixin, FromSingleFileMixin, SD3IPAdapterMixin ): r""" Args: transformer ([`SD3Transformer2DModel`]): Conditional Transformer (MMDiT) architecture to denoise the encoded image latents. scheduler ([`FlowMatch...
class_definition
6,067
62,584
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet.py
null
82
class StableDiffusion3ControlNetInpaintingPipeline( DiffusionPipeline, SD3LoraLoaderMixin, FromSingleFileMixin, SD3IPAdapterMixin ): r""" Args: transformer ([`SD3Transformer2DModel`]): Conditional Transformer (MMDiT) architecture to denoise the encoded image latents. scheduler ([...
class_definition
7,071
63,574
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet_inpainting.py
null
83
class StableDiffusionXLControlNetUnionPipeline( DiffusionPipeline, StableDiffusionMixin, TextualInversionLoaderMixin, StableDiffusionXLLoraLoaderMixin, IPAdapterMixin, FromSingleFileMixin, ): r""" Pipeline for text-to-image generation using Stable Diffusion XL with ControlNet guidance. ...
class_definition
7,065
77,638
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl.py
null
84
class MultiControlNetModel(MultiControlNetModel): def __init__(self, *args, **kwargs): deprecation_message = "Importing `MultiControlNetModel` from `diffusers.pipelines.controlnet.multicontrolnet` is deprecated and this will be removed in a future version. Please use `from diffusers.models.controlnets.multi...
class_definition
153
683
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/multicontrolnet.py
null
85
class StableDiffusionXLControlNetPipeline( DiffusionPipeline, StableDiffusionMixin, TextualInversionLoaderMixin, StableDiffusionXLLoraLoaderMixin, IPAdapterMixin, FromSingleFileMixin, ): r""" Pipeline for text-to-image generation using Stable Diffusion XL with ControlNet guidance. T...
class_definition
7,369
82,634
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py
null
86
class StableDiffusionControlNetInpaintPipeline( DiffusionPipeline, StableDiffusionMixin, TextualInversionLoaderMixin, StableDiffusionLoraLoaderMixin, IPAdapterMixin, FromSingleFileMixin, ): r""" Pipeline for image inpainting using Stable Diffusion with ControlNet guidance. This mode...
class_definition
4,886
76,438
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py
null
87
class StableDiffusionControlNetPipeline( DiffusionPipeline, StableDiffusionMixin, TextualInversionLoaderMixin, StableDiffusionLoraLoaderMixin, IPAdapterMixin, FromSingleFileMixin, ): r""" Pipeline for text-to-image generation using Stable Diffusion with ControlNet guidance. This mod...
class_definition
7,017
69,209
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet.py
null
88
class StableDiffusionXLControlNetImg2ImgPipeline( DiffusionPipeline, StableDiffusionMixin, TextualInversionLoaderMixin, StableDiffusionXLLoraLoaderMixin, FromSingleFileMixin, IPAdapterMixin, ): r""" Pipeline for image-to-image generation using Stable Diffusion XL with ControlNet guidance...
class_definition
6,129
87,120
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl_img2img.py
null
89
class StableDiffusionControlNetImg2ImgPipeline( DiffusionPipeline, StableDiffusionMixin, TextualInversionLoaderMixin, StableDiffusionLoraLoaderMixin, IPAdapterMixin, FromSingleFileMixin, ): r""" Pipeline for image-to-image generation using Stable Diffusion with ControlNet guidance. ...
class_definition
5,348
67,467
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py
null
90
class StableDiffusionXLControlNetUnionImg2ImgPipeline( DiffusionPipeline, StableDiffusionMixin, TextualInversionLoaderMixin, StableDiffusionXLLoraLoaderMixin, FromSingleFileMixin, IPAdapterMixin, ): r""" Pipeline for image-to-image generation using Stable Diffusion XL with ControlNet gui...
class_definition
6,821
84,172
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_union_sd_xl_img2img.py
null
91
class BlipDiffusionControlNetPipeline(DiffusionPipeline): """ Pipeline for Canny Edge based Controlled subject-driven generation using Blip Diffusion. This model inherits from [`DiffusionPipeline`]. Check the superclass documentation for the generic methods the library implements for all the pipelines ...
class_definition
3,311
17,584
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_blip_diffusion.py
null
92
class StableDiffusionXLControlNetInpaintPipeline( DiffusionPipeline, StableDiffusionMixin, StableDiffusionXLLoraLoaderMixin, FromSingleFileMixin, IPAdapterMixin, TextualInversionLoaderMixin, ): r""" Pipeline for text-to-image generation using Stable Diffusion XL. This model inherits...
class_definition
6,480
95,146
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_inpaint_sd_xl.py
null
93
class StableDiffusionXLControlNetUnionInpaintPipeline( DiffusionPipeline, StableDiffusionMixin, StableDiffusionXLLoraLoaderMixin, FromSingleFileMixin, IPAdapterMixin, TextualInversionLoaderMixin, ): r""" Pipeline for text-to-image generation using Stable Diffusion XL. This model inh...
class_definition
6,216
91,284
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_union_inpaint_sd_xl.py
null
94
class FlaxStableDiffusionControlNetPipeline(FlaxDiffusionPipeline): r""" Flax-based pipeline for text-to-image generation using Stable Diffusion with ControlNet Guidance. This model inherits from [`FlaxDiffusionPipeline`]. Check the superclass documentation for the generic methods implemented for all p...
class_definition
4,267
21,326
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/controlnet/pipeline_flax_controlnet.py
null
95
class LTXPipelineOutput(BaseOutput): r""" Output class for LTX pipelines. Args: frames (`torch.Tensor`, `np.ndarray`, or List[List[PIL.Image.Image]]): List of video outputs - It can be a nested list of length `batch_size,` with each sub-list containing denoised PIL image seq...
class_definition
101
604
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/ltx/pipeline_output.py
null
96
class LTXPipeline(DiffusionPipeline, FromSingleFileMixin, LTXVideoLoraLoaderMixin): r""" Pipeline for text-to-video generation. Reference: https://github.com/Lightricks/LTX-Video Args: transformer ([`LTXVideoTransformer3DModel`]): Conditional Transformer architecture to denoise the...
class_definition
6,258
38,281
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/ltx/pipeline_ltx.py
null
97
class LTXImageToVideoPipeline(DiffusionPipeline, FromSingleFileMixin, LTXVideoLoraLoaderMixin): r""" Pipeline for image-to-video generation. Reference: https://github.com/Lightricks/LTX-Video Args: transformer ([`LTXVideoTransformer3DModel`]): Conditional Transformer architecture t...
class_definition
7,201
42,930
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/ltx/pipeline_ltx_image2video.py
null
98
class LeditsAttentionStore: @staticmethod def get_empty_store(): return {"down_cross": [], "mid_cross": [], "up_cross": [], "down_self": [], "mid_self": [], "up_self": []} def __call__(self, attn, is_cross: bool, place_in_unet: str, editing_prompts, PnP=False): # attn.shape = batch_size * h...
class_definition
3,219
6,701
0
/Users/nielsrogge/Documents/python_projecten/diffusers/src/diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion_xl.py
null
99