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 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 6