repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
diffusers
src/diffusers/pipelines/dreamlite/pipeline_dreamlite_mobile.py
.py
# Copyright (c) 2026 ByteDance Ltd. and/or its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
570
25,312
diffusers
src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
332
14,318
diffusers
src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior_emb2emb.py
.py
import PIL.Image import torch from transformers import CLIPImageProcessor, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionModelWithProjection from ...models import PriorTransformer from ...schedulers import UnCLIPScheduler from ...utils import is_torch_xla_available, logging, replace_example_docstring from ...u...
572
25,376
diffusers
src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
329
13,949
diffusers
src/diffusers/pipelines/kandinsky2_2/__init__.py
.py
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
71
2,796
diffusers
src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet_img2img.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
372
16,795
diffusers
src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
568
24,949
diffusers
src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_combined.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
878
46,100
diffusers
src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
383
17,101
diffusers
src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior.py
.py
from typing import Callable import PIL.Image import torch from transformers import CLIPImageProcessor, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionModelWithProjection from ...models import PriorTransformer from ...schedulers import UnCLIPScheduler from ...utils import is_torch_xla_available, logging, replac...
558
25,549
diffusers
src/diffusers/pipelines/longcat_audio_dit/__init__.py
.py
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
41
1,285
diffusers
src/diffusers/pipelines/longcat_audio_dit/pipeline_longcat_audio_dit.py
.py
# Copyright 2026 MeiTuan LongCat-AudioDiT Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
359
15,474
diffusers
src/diffusers/pipelines/chroma/pipeline_chroma_img2img.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
1,009
47,954
diffusers
src/diffusers/pipelines/chroma/pipeline_output.py
.py
from dataclasses import dataclass import numpy as np import PIL.Image from ...utils import BaseOutput @dataclass class ChromaPipelineOutput(BaseOutput): """ Output class for Stable Diffusion pipelines. Args: images (`list[PIL.Image.Image]` or `np.ndarray`) list of denoised PIL image...
21
563
diffusers
src/diffusers/pipelines/chroma/pipeline_chroma.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
923
43,609
diffusers
src/diffusers/pipelines/chroma/__init__.py
.py
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _additional_imports = {} _import_structure = {"pipeline_output": ["ChromaPi...
52
1,761
diffusers
src/diffusers/pipelines/chroma/pipeline_chroma_inpainting.py
.py
""" ChromaInpaintPipeline implements a text-guided image inpainting pipeline for the lodestones/Chroma1-HD model, based on the ChromaPipeline from Hugging Face Diffusers:contentReference[oaicite:0]{index=0} and the Stable Diffusion inpainting approach:contentReference[oaicite:1]{index=1}. """ # Copyright 2025 Black Fo...
1,202
57,356
diffusers
src/diffusers/pipelines/shap_e/renderer.py
.py
# Copyright 2025 Open AI and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
1,050
39,109
diffusers
src/diffusers/pipelines/shap_e/pipeline_shap_e_img2img.py
.py
# Copyright 2025 Open AI and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
333
13,148
diffusers
src/diffusers/pipelines/shap_e/pipeline_shap_e.py
.py
# Copyright 2025 Open AI and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
346
13,347
diffusers
src/diffusers/pipelines/shap_e/__init__.py
.py
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
72
2,093
diffusers
src/diffusers/pipelines/shap_e/camera.py
.py
# Copyright 2025 Open AI and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
147
4,917
diffusers
src/diffusers/pipelines/joyimage/pipeline_joyimage_edit.py
.py
import inspect from typing import Callable, Dict, List, Optional, Union import numpy as np import torch from PIL import Image from transformers import ( Qwen2Tokenizer, Qwen3VLForConditionalGeneration, Qwen3VLProcessor, ) from ...callbacks import MultiPipelineCallbacks, PipelineCallback from ...image_proc...
878
39,028
diffusers
src/diffusers/pipelines/joyimage/pipeline_output.py
.py
from dataclasses import dataclass from typing import List, Union import numpy as np import PIL.Image from ...utils import BaseOutput @dataclass class JoyImageEditPipelineOutput(BaseOutput): """ Output class for JoyImageEdit generation pipelines. """ images: Union[List[PIL.Image.Image], np.ndarray] ...
26
524
diffusers
src/diffusers/pipelines/joyimage/__init__.py
.py
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
51
1,673
diffusers
src/diffusers/pipelines/joyimage/image_processor.py
.py
# Copyright 2025 The JoyImage Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
150
4,950
diffusers
src/diffusers/pipelines/joyimage/pipeline_joyimage_edit_plus.py
.py
# Copyright 2025 The JoyImage Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
771
35,607
diffusers
src/diffusers/pipelines/marigold/marigold_image_processing.py
.py
# Copyright 2023-2025 Marigold Team, ETH Zürich. All rights reserved. # Copyright 2024-2025 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
673
31,060
diffusers
src/diffusers/pipelines/marigold/pipeline_marigold_depth.py
.py
# Copyright 2023-2025 Marigold Team, ETH Zürich. All rights reserved. # Copyright 2024-2025 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
828
41,001
diffusers
src/diffusers/pipelines/marigold/pipeline_marigold_normals.py
.py
# Copyright 2023-2025 Marigold Team, ETH Zürich. All rights reserved. # Copyright 2024-2025 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
705
34,597
diffusers
src/diffusers/pipelines/marigold/__init__.py
.py
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
53
1,926
diffusers
src/diffusers/pipelines/marigold/pipeline_marigold_intrinsics.py
.py
# Copyright 2023-2025 Marigold Team, ETH Zürich. All rights reserved. # Copyright 2024-2025 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
722
35,679
diffusers
src/diffusers/pipelines/ledits_pp/pipeline_output.py
.py
from dataclasses import dataclass import numpy as np import PIL.Image from ...utils import BaseOutput @dataclass class LEditsPPDiffusionPipelineOutput(BaseOutput): """ Output class for LEdits++ Diffusion pipelines. Args: images (`list[PIL.Image.Image]` or `np.ndarray`) list of denoi...
43
1,517
diffusers
src/diffusers/pipelines/ledits_pp/__init__.py
.py
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
56
1,783
diffusers
src/diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion_xl.py
.py
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
1,808
87,238
diffusers
src/diffusers/pipelines/ledits_pp/pipeline_leditspp_stable_diffusion.py
.py
import inspect import math from itertools import repeat from typing import Any, Callable import torch import torch.nn.functional as F from packaging import version from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from ...configuration_utils import FrozenDict from ...image_processor import Pip...
1,537
76,145
diffusers
src/diffusers/pipelines/visualcloze/__init__.py
.py
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and i...
53
1,502
diffusers
src/diffusers/pipelines/visualcloze/pipeline_visualcloze_combined.py
.py
# Copyright 2025 VisualCloze team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
441
23,893
diffusers
src/diffusers/pipelines/visualcloze/visualcloze_utils.py
.py
# Copyright 2025 VisualCloze team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
251
10,787
diffusers
src/diffusers/pipelines/visualcloze/pipeline_visualcloze_generation.py
.py
# Copyright 2025 VisualCloze team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
924
44,025
diffusers
src/diffusers/pipelines/flux/pipeline_flux_controlnet_image_to_image.py
.py
import inspect from typing import Any, Callable import numpy as np import torch from transformers import ( CLIPTextModel, CLIPTokenizer, T5EncoderModel, T5TokenizerFast, ) from ...image_processor import PipelineImageInput, VaeImageProcessor from ...loaders import FluxLoraLoaderMixin, FromSingleFileMix...
1,014
46,801
diffusers
src/diffusers/pipelines/flux/pipeline_flux_inpaint.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
1,233
60,818
diffusers
src/diffusers/pipelines/flux/pipeline_flux_controlnet.py
.py
# Copyright 2025 Black Forest Labs, The HuggingFace Team and The InstantX Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LIC...
1,205
59,456
diffusers
src/diffusers/pipelines/flux/pipeline_flux_control.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
862
39,406
diffusers
src/diffusers/pipelines/flux/pipeline_flux_fill.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
1,013
48,202
diffusers
src/diffusers/pipelines/flux/pipeline_output.py
.py
from dataclasses import dataclass import numpy as np import PIL.Image import torch from ...utils import BaseOutput @dataclass class FluxPipelineOutput(BaseOutput): """ Output class for Flux image generation pipelines. Args: images (`list[PIL.Image.Image]` or `torch.Tensor` or `np.ndarray`) ...
39
1,246
diffusers
src/diffusers/pipelines/flux/__init__.py
.py
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _additional_imports = {} _import_structure = {"pipeline_output": ["FluxPipe...
74
3,445
diffusers
src/diffusers/pipelines/flux/pipeline_flux_controlnet_inpainting.py
.py
import inspect from typing import Any, Callable import numpy as np import PIL import torch from transformers import ( CLIPTextModel, CLIPTokenizer, T5EncoderModel, T5TokenizerFast, ) from ...image_processor import PipelineImageInput, VaeImageProcessor from ...loaders import FluxLoraLoaderMixin, FromSi...
1,211
55,467
diffusers
src/diffusers/pipelines/flux/pipeline_flux_control_img2img.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
946
44,542
diffusers
src/diffusers/pipelines/flux/pipeline_flux_prior_redux.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
503
22,485
diffusers
src/diffusers/pipelines/flux/pipeline_flux_img2img.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
1,060
52,307
diffusers
src/diffusers/pipelines/flux/pipeline_flux_control_inpaint.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
1,115
52,469
diffusers
src/diffusers/pipelines/flux/pipeline_flux_kontext.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
1,111
53,991
diffusers
src/diffusers/pipelines/flux/modeling_flux.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
47
1,518
diffusers
src/diffusers/pipelines/flux/pipeline_flux_kontext_inpaint.py
.py
# Copyright 2025 ZenAI. All rights reserved. # author: @vuongminh1907 import inspect from typing import Any, Callable import numpy as np import PIL.Image import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, CLIPVisionModelWithProjection, T5EncoderModel, T5T...
1,430
70,248
diffusers
src/diffusers/pipelines/flux/pipeline_flux.py
.py
# Copyright 2025 Black Forest Labs and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
971
46,740
diffusers
src/diffusers/utils/distributed_utils.py
.py
# Copyright 2025 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
37
1,045
diffusers
src/diffusers/utils/logging.py
.py
# coding=utf-8 # Copyright 2025 Optuna, Hugging Face # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
362
10,165
diffusers
src/diffusers/utils/export_utils.py
.py
from __future__ import annotations import io import random import struct import tempfile from collections.abc import Iterator from contextlib import contextmanager from fractions import Fraction from itertools import chain from typing import TYPE_CHECKING import numpy as np import PIL.Image import PIL.ImageOps from ...
389
14,115
diffusers
src/diffusers/utils/testing_utils.py
.py
import functools import glob import importlib import importlib.metadata import inspect import io import logging import multiprocessing import os import random import re import struct import sys import tempfile import time import unittest import urllib.parse from collections import UserDict from contextlib import contex...
1,613
58,854
diffusers
src/diffusers/utils/state_dict_utils.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
552
23,316
diffusers
src/diffusers/utils/source_code_parsing_utils.py
.py
import ast import importlib import inspect import textwrap class ReturnNameVisitor(ast.NodeVisitor): """Thanks to ChatGPT for pairing.""" def __init__(self): self.return_names = [] def visit_Return(self, node): # Check if the return value is a tuple. if isinstance(node.value, ast...
53
1,863
diffusers
src/diffusers/utils/__init__.py
.py
# Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
176
5,318
diffusers
src/diffusers/utils/remote_utils.py
.py
# coding=utf-8 # Copyright 2026 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
428
16,030
diffusers
src/diffusers/utils/hub_utils.py
.py
# coding=utf-8 # Copyright 2025 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
594
25,881
diffusers
src/diffusers/utils/constants.py
.py
# Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
91
4,277
diffusers
src/diffusers/utils/peft_utils.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
419
15,464
diffusers
src/diffusers/utils/accelerate_utils.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
49
1,839
diffusers
src/diffusers/utils/loading_utils.py
.py
import os import tempfile from typing import Any, Callable from urllib.parse import unquote, urlparse import PIL.Image import PIL.ImageOps import requests from .constants import DIFFUSERS_REQUEST_TIMEOUT from .import_utils import BACKENDS_MAPPING, is_imageio_available def load_image( image: str | PIL.Image.Imag...
178
6,159
diffusers
src/diffusers/utils/typing_utils.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
92
3,394
diffusers
src/diffusers/utils/doc_utils.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
40
1,348
diffusers
src/diffusers/utils/deprecation_utils.py
.py
import inspect import warnings from typing import Any from packaging import version from ..utils import logging logger = logging.get_logger(__name__) _TORCH_DTYPE_DEPRECATION_MESSAGE = "Please use `dtype` instead." def _resolve_dtype(dtype, torch_dtype): """Resolve the deprecated `torch_dtype` argument into ...
113
4,105
diffusers
src/diffusers/utils/torch_utils.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
410
14,955
diffusers
src/diffusers/utils/dynamic_modules_utils.py
.py
# coding=utf-8 # Copyright 2025 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
545
24,297
diffusers
src/diffusers/utils/outputs.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
135
5,002
diffusers
src/diffusers/utils/pil_utils.py
.py
import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("9.1.0"): PIL_INTERPOLATION = { "linear": PIL.Image.Resampling.BILINEAR, "bilinear": PIL.Image.Resampling.BILINEAR, "bicub...
66
1,954
diffusers
src/diffusers/utils/import_utils.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
1,024
34,925
diffusers
src/diffusers/utils/versions.py
.py
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
117
4,302
diffusers
src/diffusers/modular_pipelines/components_manager.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
1,164
50,470
diffusers
src/diffusers/modular_pipelines/__init__.py
.py
from typing import TYPE_CHECKING from ..utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, logging, ) logger = logging.get_logger(__name__) logger.warning( "Modular Diffusers is cur...
258
8,484
diffusers
src/diffusers/modular_pipelines/modular_pipeline_utils.py
.py
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
1,354
54,840
diffusers
src/diffusers/modular_pipelines/mellon_node_utils.py
.py
import copy import json import logging import os # Simple typed wrapper for parameter overrides from dataclasses import asdict, dataclass from typing import Any from huggingface_hub import create_repo, hf_hub_download, upload_file from huggingface_hub.utils import ( EntryNotFoundError, HfHubHTTPError, Rep...
1,104
41,102
diffusers
src/diffusers/modular_pipelines/modular_pipeline.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
2,952
132,456
diffusers
src/diffusers/modular_pipelines/minimax_music3/modular_blocks_minimax_music3.py
.py
# Copyright 2026 The MiniMax Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
189
8,321
diffusers
src/diffusers/modular_pipelines/minimax_music3/denoise.py
.py
# Copyright 2026 The MiniMax Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
329
12,951
diffusers
src/diffusers/modular_pipelines/minimax_music3/__init__.py
.py
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
48
1,478
diffusers
src/diffusers/modular_pipelines/minimax_music3/before_denoise.py
.py
# Copyright 2026 The MiniMax Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
74
2,770
diffusers
src/diffusers/modular_pipelines/minimax_music3/decoders.py
.py
# Copyright 2026 The MiniMax Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
96
3,857
diffusers
src/diffusers/modular_pipelines/minimax_music3/encoders.py
.py
# Copyright 2026 The MiniMax Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
362
16,493
diffusers
src/diffusers/modular_pipelines/minimax_music3/modular_pipeline.py
.py
# Copyright 2026 The MiniMax Team and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
61
2,326
diffusers
src/diffusers/modular_pipelines/flux2/modular_blocks_flux2.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
357
12,356
diffusers
src/diffusers/modular_pipelines/flux2/modular_blocks_flux2_klein_base.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
414
14,916
diffusers
src/diffusers/modular_pipelines/flux2/denoise.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
502
18,555
diffusers
src/diffusers/modular_pipelines/flux2/__init__.py
.py
from typing import TYPE_CHECKING from ...utils import ( DIFFUSERS_SLOW_IMPORT, OptionalDependencyNotAvailable, _LazyModule, get_objects_from_module, is_torch_available, is_transformers_available, ) _dummy_objects = {} _import_structure = {} try: if not (is_transformers_available() and is...
58
2,025
diffusers
src/diffusers/modular_pipelines/flux2/before_denoise.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
592
22,238
diffusers
src/diffusers/modular_pipelines/flux2/decoders.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
186
6,324
diffusers
src/diffusers/modular_pipelines/flux2/modular_blocks_flux2_klein.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
400
13,961
diffusers
src/diffusers/modular_pipelines/flux2/encoders.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
609
22,362
diffusers
src/diffusers/modular_pipelines/flux2/inputs.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
243
9,132
diffusers
src/diffusers/modular_pipelines/flux2/modular_pipeline.py
.py
# Copyright 2026 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
100
3,210