assassinlike commited on
Commit
cf22096
·
verified ·
1 Parent(s): 628418d

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. data/diffusion/.venv/lib/python3.11/site-packages/__pycache__/_virtualenv.cpython-311.pyc +0 -0
  2. data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/INSTALLER +1 -0
  3. data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/METADATA +78 -0
  4. data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/RECORD +12 -0
  5. data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/REQUESTED +0 -0
  6. data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/WHEEL +5 -0
  7. data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/licenses/LICENSE +20 -0
  8. data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/top_level.txt +1 -0
  9. data/diffusion/.venv/lib/python3.11/site-packages/certifi/__init__.py +4 -0
  10. data/diffusion/.venv/lib/python3.11/site-packages/certifi/__main__.py +12 -0
  11. data/diffusion/.venv/lib/python3.11/site-packages/certifi/__pycache__/__init__.cpython-311.pyc +0 -0
  12. data/diffusion/.venv/lib/python3.11/site-packages/certifi/__pycache__/core.cpython-311.pyc +0 -0
  13. data/diffusion/.venv/lib/python3.11/site-packages/certifi/cacert.pem +0 -0
  14. data/diffusion/.venv/lib/python3.11/site-packages/certifi/core.py +83 -0
  15. data/diffusion/.venv/lib/python3.11/site-packages/certifi/py.typed +0 -0
  16. data/diffusion/.venv/lib/python3.11/site-packages/charset_normalizer/__init__.py +48 -0
  17. data/diffusion/.venv/lib/python3.11/site-packages/charset_normalizer/py.typed +0 -0
  18. data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/INSTALLER +1 -0
  19. data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/METADATA +379 -0
  20. data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/RECORD +0 -0
  21. data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/REQUESTED +0 -0
  22. data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/WHEEL +5 -0
  23. data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/entry_points.txt +2 -0
  24. data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/licenses/LICENSE +201 -0
  25. data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/top_level.txt +1 -0
  26. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__init__.py +1765 -0
  27. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/__init__.cpython-311.pyc +0 -0
  28. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/callbacks.cpython-311.pyc +0 -0
  29. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/configuration_utils.cpython-311.pyc +0 -0
  30. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/dependency_versions_check.cpython-311.pyc +0 -0
  31. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/dependency_versions_table.cpython-311.pyc +0 -0
  32. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/image_processor.cpython-311.pyc +0 -0
  33. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/video_processor.cpython-311.pyc +0 -0
  34. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/callbacks.py +244 -0
  35. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/commands/__init__.py +27 -0
  36. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/commands/custom_blocks.py +132 -0
  37. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/commands/diffusers_cli.py +45 -0
  38. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/commands/env.py +198 -0
  39. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/commands/fp16_safetensors.py +132 -0
  40. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/configuration_utils.py +805 -0
  41. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/dependency_versions_check.py +34 -0
  42. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/dependency_versions_table.py +59 -0
  43. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/experimental/__init__.py +1 -0
  44. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__init__.py +31 -0
  45. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/__init__.cpython-311.pyc +0 -0
  46. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/adaptive_projected_guidance.cpython-311.pyc +0 -0
  47. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/adaptive_projected_guidance_mix.cpython-311.pyc +0 -0
  48. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/auto_guidance.cpython-311.pyc +0 -0
  49. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/classifier_free_guidance.cpython-311.pyc +0 -0
  50. data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/classifier_free_zero_star_guidance.cpython-311.pyc +0 -0
data/diffusion/.venv/lib/python3.11/site-packages/__pycache__/_virtualenv.cpython-311.pyc ADDED
Binary file (4.53 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ uv
data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/METADATA ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: certifi
3
+ Version: 2026.6.17
4
+ Summary: Python package for providing Mozilla's CA Bundle.
5
+ Home-page: https://github.com/certifi/python-certifi
6
+ Author: Kenneth Reitz
7
+ Author-email: me@kennethreitz.com
8
+ License: MPL-2.0
9
+ Project-URL: Source, https://github.com/certifi/python-certifi
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
+ Requires-Python: >=3.7
26
+ License-File: LICENSE
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: home-page
32
+ Dynamic: license
33
+ Dynamic: license-file
34
+ Dynamic: project-url
35
+ Dynamic: requires-python
36
+ Dynamic: summary
37
+
38
+ Certifi: Python SSL Certificates
39
+ ================================
40
+
41
+ Certifi provides Mozilla's carefully curated collection of Root Certificates for
42
+ validating the trustworthiness of SSL certificates while verifying the identity
43
+ of TLS hosts. It has been extracted from the `Requests`_ project.
44
+
45
+ Installation
46
+ ------------
47
+
48
+ ``certifi`` is available on PyPI. Simply install it with ``pip``::
49
+
50
+ $ pip install certifi
51
+
52
+ Usage
53
+ -----
54
+
55
+ To reference the installed certificate authority (CA) bundle, you can use the
56
+ built-in function::
57
+
58
+ >>> import certifi
59
+
60
+ >>> certifi.where()
61
+ '/usr/local/lib/python3.7/site-packages/certifi/cacert.pem'
62
+
63
+ Or from the command line::
64
+
65
+ $ python -m certifi
66
+ /usr/local/lib/python3.7/site-packages/certifi/cacert.pem
67
+
68
+ Enjoy!
69
+
70
+ .. _`Requests`: https://requests.readthedocs.io/en/latest/
71
+
72
+ Addition/Removal of Certificates
73
+ --------------------------------
74
+
75
+ Certifi does not support any addition/removal or other modification of the
76
+ CA trust store content. This project is intended to provide a reliable and
77
+ highly portable root of trust to python deployments. Look to upstream projects
78
+ for methods to use alternate trust.
data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/RECORD ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ certifi-2026.6.17.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
2
+ certifi-2026.6.17.dist-info/METADATA,sha256=6hXAnt0a2el7xm2e9xvPuRCntZLjdKCkN81e47E0wN8,2474
3
+ certifi-2026.6.17.dist-info/RECORD,,
4
+ certifi-2026.6.17.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ certifi-2026.6.17.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
6
+ certifi-2026.6.17.dist-info/licenses/LICENSE,sha256=6TcW2mucDVpKHfYP5pWzcPBpVgPSH2-D8FPkLPwQyvc,989
7
+ certifi-2026.6.17.dist-info/top_level.txt,sha256=KMu4vUCfsjLrkPbSNdgdekS-pVJzBAJFO__nI8NF6-U,8
8
+ certifi/__init__.py,sha256=-W1R_y8WCaSkT1tdjuxH_zTBZY1YH6xQgdN1nbBajOE,94
9
+ certifi/__main__.py,sha256=xBBoj905TUWBLRGANOcf7oi6e-3dMP4cEoG9OyMs11g,243
10
+ certifi/cacert.pem,sha256=u8fpwB11UbuKFZtd7dmJuO484QWv9SK2jrGwG_hUyrA,234354
11
+ certifi/core.py,sha256=XFXycndG5pf37ayeF8N32HUuDafsyhkVMbO4BAPWHa0,3394
12
+ certifi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/REQUESTED ADDED
File without changes
data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This package contains a modified version of ca-bundle.crt:
2
+
3
+ ca-bundle.crt -- Bundle of CA Root Certificates
4
+
5
+ This is a bundle of X.509 certificates of public Certificate Authorities
6
+ (CA). These were automatically extracted from Mozilla's root certificates
7
+ file (certdata.txt). This file can be found in the mozilla source tree:
8
+ https://hg.mozilla.org/mozilla-central/file/tip/security/nss/lib/ckfw/builtins/certdata.txt
9
+ It contains the certificates in PEM format and therefore
10
+ can be directly used with curl / libcurl / php_curl, or with
11
+ an Apache+mod_ssl webserver for SSL client authentication.
12
+ Just configure this file as the SSLCACertificateFile.#
13
+
14
+ ***** BEGIN LICENSE BLOCK *****
15
+ This Source Code Form is subject to the terms of the Mozilla Public License,
16
+ v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain
17
+ one at http://mozilla.org/MPL/2.0/.
18
+
19
+ ***** END LICENSE BLOCK *****
20
+ @(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $
data/diffusion/.venv/lib/python3.11/site-packages/certifi-2026.6.17.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ certifi
data/diffusion/.venv/lib/python3.11/site-packages/certifi/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from .core import contents, where
2
+
3
+ __all__ = ["contents", "where"]
4
+ __version__ = "2026.06.17"
data/diffusion/.venv/lib/python3.11/site-packages/certifi/__main__.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+
3
+ from certifi import contents, where
4
+
5
+ parser = argparse.ArgumentParser()
6
+ parser.add_argument("-c", "--contents", action="store_true")
7
+ args = parser.parse_args()
8
+
9
+ if args.contents:
10
+ print(contents())
11
+ else:
12
+ print(where())
data/diffusion/.venv/lib/python3.11/site-packages/certifi/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (333 Bytes). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/certifi/__pycache__/core.cpython-311.pyc ADDED
Binary file (2.39 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/certifi/cacert.pem ADDED
The diff for this file is too large to render. See raw diff
 
data/diffusion/.venv/lib/python3.11/site-packages/certifi/core.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ certifi.py
3
+ ~~~~~~~~~~
4
+
5
+ This module returns the installation location of cacert.pem or its contents.
6
+ """
7
+ import sys
8
+ import atexit
9
+
10
+ def exit_cacert_ctx() -> None:
11
+ _CACERT_CTX.__exit__(None, None, None) # type: ignore[union-attr]
12
+
13
+
14
+ if sys.version_info >= (3, 11):
15
+
16
+ from importlib.resources import as_file, files
17
+
18
+ _CACERT_CTX = None
19
+ _CACERT_PATH = None
20
+
21
+ def where() -> str:
22
+ # This is slightly terrible, but we want to delay extracting the file
23
+ # in cases where we're inside of a zipimport situation until someone
24
+ # actually calls where(), but we don't want to re-extract the file
25
+ # on every call of where(), so we'll do it once then store it in a
26
+ # global variable.
27
+ global _CACERT_CTX
28
+ global _CACERT_PATH
29
+ if _CACERT_PATH is None:
30
+ # This is slightly janky, the importlib.resources API wants you to
31
+ # manage the cleanup of this file, so it doesn't actually return a
32
+ # path, it returns a context manager that will give you the path
33
+ # when you enter it and will do any cleanup when you leave it. In
34
+ # the common case of not needing a temporary file, it will just
35
+ # return the file system location and the __exit__() is a no-op.
36
+ #
37
+ # We also have to hold onto the actual context manager, because
38
+ # it will do the cleanup whenever it gets garbage collected, so
39
+ # we will also store that at the global level as well.
40
+ _CACERT_CTX = as_file(files("certifi").joinpath("cacert.pem"))
41
+ _CACERT_PATH = str(_CACERT_CTX.__enter__())
42
+ atexit.register(exit_cacert_ctx)
43
+
44
+ return _CACERT_PATH
45
+
46
+ def contents() -> str:
47
+ return files("certifi").joinpath("cacert.pem").read_text(encoding="ascii")
48
+
49
+ else:
50
+
51
+ from importlib.resources import path as get_path, read_text
52
+
53
+ _CACERT_CTX = None
54
+ _CACERT_PATH = None
55
+
56
+ def where() -> str:
57
+ # This is slightly terrible, but we want to delay extracting the
58
+ # file in cases where we're inside of a zipimport situation until
59
+ # someone actually calls where(), but we don't want to re-extract
60
+ # the file on every call of where(), so we'll do it once then store
61
+ # it in a global variable.
62
+ global _CACERT_CTX
63
+ global _CACERT_PATH
64
+ if _CACERT_PATH is None:
65
+ # This is slightly janky, the importlib.resources API wants you
66
+ # to manage the cleanup of this file, so it doesn't actually
67
+ # return a path, it returns a context manager that will give
68
+ # you the path when you enter it and will do any cleanup when
69
+ # you leave it. In the common case of not needing a temporary
70
+ # file, it will just return the file system location and the
71
+ # __exit__() is a no-op.
72
+ #
73
+ # We also have to hold onto the actual context manager, because
74
+ # it will do the cleanup whenever it gets garbage collected, so
75
+ # we will also store that at the global level as well.
76
+ _CACERT_CTX = get_path("certifi", "cacert.pem")
77
+ _CACERT_PATH = str(_CACERT_CTX.__enter__())
78
+ atexit.register(exit_cacert_ctx)
79
+
80
+ return _CACERT_PATH
81
+
82
+ def contents() -> str:
83
+ return read_text("certifi", "cacert.pem", encoding="ascii")
data/diffusion/.venv/lib/python3.11/site-packages/certifi/py.typed ADDED
File without changes
data/diffusion/.venv/lib/python3.11/site-packages/charset_normalizer/__init__.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Charset-Normalizer
3
+ ~~~~~~~~~~~~~~
4
+ The Real First Universal Charset Detector.
5
+ A library that helps you read text from an unknown charset encoding.
6
+ Motivated by chardet, This package is trying to resolve the issue by taking a new approach.
7
+ All IANA character set names for which the Python core library provides codecs are supported.
8
+
9
+ Basic usage:
10
+ >>> from charset_normalizer import from_bytes
11
+ >>> results = from_bytes('Bсеки човек има право на образование. Oбразованието!'.encode('utf_8'))
12
+ >>> best_guess = results.best()
13
+ >>> str(best_guess)
14
+ 'Bсеки човек има право на образование. Oбразованието!'
15
+
16
+ Others methods and usages are available - see the full documentation
17
+ at <https://github.com/Ousret/charset_normalizer>.
18
+ :copyright: (c) 2021 by Ahmed TAHRI
19
+ :license: MIT, see LICENSE for more details.
20
+ """
21
+
22
+ from __future__ import annotations
23
+
24
+ import logging
25
+
26
+ from .api import from_bytes, from_fp, from_path, is_binary
27
+ from .legacy import detect
28
+ from .models import CharsetMatch, CharsetMatches
29
+ from .utils import set_logging_handler
30
+ from .version import VERSION, __version__
31
+
32
+ __all__ = (
33
+ "from_fp",
34
+ "from_path",
35
+ "from_bytes",
36
+ "is_binary",
37
+ "detect",
38
+ "CharsetMatch",
39
+ "CharsetMatches",
40
+ "__version__",
41
+ "VERSION",
42
+ "set_logging_handler",
43
+ )
44
+
45
+ # Attach a NullHandler to the top level logger by default
46
+ # https://docs.python.org/3.3/howto/logging.html#configuring-logging-for-a-library
47
+
48
+ logging.getLogger("charset_normalizer").addHandler(logging.NullHandler())
data/diffusion/.venv/lib/python3.11/site-packages/charset_normalizer/py.typed ADDED
File without changes
data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ uv
data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/METADATA ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: diffusers
3
+ Version: 0.39.0
4
+ Summary: State-of-the-art diffusion in PyTorch and JAX.
5
+ Home-page: https://github.com/huggingface/diffusers
6
+ Author: The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/diffusers/graphs/contributors)
7
+ Author-email: diffusers@huggingface.co
8
+ License: Apache 2.0 License
9
+ Keywords: deep learning diffusion jax pytorch stable diffusion audioldm
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Requires-Python: >=3.10.0
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: importlib_metadata
25
+ Requires-Dist: filelock
26
+ Requires-Dist: httpx<1.0.0
27
+ Requires-Dist: huggingface-hub<2.0,>=0.34.0
28
+ Requires-Dist: numpy
29
+ Requires-Dist: regex!=2019.12.17
30
+ Requires-Dist: requests
31
+ Requires-Dist: safetensors>=0.8.0
32
+ Requires-Dist: Pillow
33
+ Provides-Extra: quality
34
+ Requires-Dist: urllib3<=2.0.0; extra == "quality"
35
+ Requires-Dist: isort>=5.5.4; extra == "quality"
36
+ Requires-Dist: ruff==0.9.10; extra == "quality"
37
+ Requires-Dist: hf-doc-builder>=0.3.0; extra == "quality"
38
+ Provides-Extra: docs
39
+ Requires-Dist: hf-doc-builder>=0.3.0; extra == "docs"
40
+ Provides-Extra: training
41
+ Requires-Dist: accelerate>=0.31.0; extra == "training"
42
+ Requires-Dist: datasets; extra == "training"
43
+ Requires-Dist: protobuf<4,>=3.20.3; extra == "training"
44
+ Requires-Dist: tensorboard; extra == "training"
45
+ Requires-Dist: Jinja2; extra == "training"
46
+ Requires-Dist: peft>=0.17.0; extra == "training"
47
+ Requires-Dist: timm; extra == "training"
48
+ Provides-Extra: test
49
+ Requires-Dist: ftfy; extra == "test"
50
+ Requires-Dist: GitPython<3.1.19; extra == "test"
51
+ Requires-Dist: datasets; extra == "test"
52
+ Requires-Dist: Jinja2; extra == "test"
53
+ Requires-Dist: invisible-watermark>=0.2.0; extra == "test"
54
+ Requires-Dist: librosa; extra == "test"
55
+ Requires-Dist: llvmlite>=0.40.0; extra == "test"
56
+ Requires-Dist: numba>=0.57.0; extra == "test"
57
+ Requires-Dist: parameterized; extra == "test"
58
+ Requires-Dist: protobuf<4,>=3.20.3; extra == "test"
59
+ Requires-Dist: pytest; extra == "test"
60
+ Requires-Dist: pytest-timeout; extra == "test"
61
+ Requires-Dist: pytest-xdist; extra == "test"
62
+ Requires-Dist: requests-mock==1.10.0; extra == "test"
63
+ Requires-Dist: safetensors>=0.8.0; extra == "test"
64
+ Requires-Dist: sentencepiece!=0.1.92,>=0.1.91; extra == "test"
65
+ Requires-Dist: scipy; extra == "test"
66
+ Requires-Dist: tiktoken>=0.7.0; extra == "test"
67
+ Requires-Dist: torchsde; extra == "test"
68
+ Requires-Dist: torchvision; extra == "test"
69
+ Requires-Dist: transformers>=4.41.2; extra == "test"
70
+ Requires-Dist: phonemizer; extra == "test"
71
+ Provides-Extra: torch
72
+ Requires-Dist: torch>=2.6; extra == "torch"
73
+ Requires-Dist: accelerate>=0.31.0; extra == "torch"
74
+ Provides-Extra: bitsandbytes
75
+ Requires-Dist: bitsandbytes>=0.43.3; extra == "bitsandbytes"
76
+ Requires-Dist: accelerate>=0.31.0; extra == "bitsandbytes"
77
+ Provides-Extra: gguf
78
+ Requires-Dist: gguf>=0.10.0; extra == "gguf"
79
+ Requires-Dist: accelerate>=0.31.0; extra == "gguf"
80
+ Provides-Extra: optimum-quanto
81
+ Requires-Dist: optimum_quanto>=0.2.6; extra == "optimum-quanto"
82
+ Requires-Dist: accelerate>=0.31.0; extra == "optimum-quanto"
83
+ Provides-Extra: torchao
84
+ Requires-Dist: torchao>=0.7.0; extra == "torchao"
85
+ Requires-Dist: accelerate>=0.31.0; extra == "torchao"
86
+ Provides-Extra: nvidia-modelopt
87
+ Requires-Dist: nvidia_modelopt[hf]>=0.33.1; extra == "nvidia-modelopt"
88
+ Provides-Extra: flashpack
89
+ Requires-Dist: flashpack; extra == "flashpack"
90
+ Provides-Extra: flax
91
+ Requires-Dist: jax>=0.4.1; extra == "flax"
92
+ Requires-Dist: jaxlib>=0.4.1; extra == "flax"
93
+ Requires-Dist: flax>=0.4.1; extra == "flax"
94
+ Provides-Extra: dev
95
+ Requires-Dist: urllib3<=2.0.0; extra == "dev"
96
+ Requires-Dist: isort>=5.5.4; extra == "dev"
97
+ Requires-Dist: ruff==0.9.10; extra == "dev"
98
+ Requires-Dist: hf-doc-builder>=0.3.0; extra == "dev"
99
+ Requires-Dist: ftfy; extra == "dev"
100
+ Requires-Dist: GitPython<3.1.19; extra == "dev"
101
+ Requires-Dist: datasets; extra == "dev"
102
+ Requires-Dist: Jinja2; extra == "dev"
103
+ Requires-Dist: invisible-watermark>=0.2.0; extra == "dev"
104
+ Requires-Dist: librosa; extra == "dev"
105
+ Requires-Dist: llvmlite>=0.40.0; extra == "dev"
106
+ Requires-Dist: numba>=0.57.0; extra == "dev"
107
+ Requires-Dist: parameterized; extra == "dev"
108
+ Requires-Dist: protobuf<4,>=3.20.3; extra == "dev"
109
+ Requires-Dist: pytest; extra == "dev"
110
+ Requires-Dist: pytest-timeout; extra == "dev"
111
+ Requires-Dist: pytest-xdist; extra == "dev"
112
+ Requires-Dist: requests-mock==1.10.0; extra == "dev"
113
+ Requires-Dist: safetensors>=0.8.0; extra == "dev"
114
+ Requires-Dist: sentencepiece!=0.1.92,>=0.1.91; extra == "dev"
115
+ Requires-Dist: scipy; extra == "dev"
116
+ Requires-Dist: tiktoken>=0.7.0; extra == "dev"
117
+ Requires-Dist: torchsde; extra == "dev"
118
+ Requires-Dist: torchvision; extra == "dev"
119
+ Requires-Dist: transformers>=4.41.2; extra == "dev"
120
+ Requires-Dist: phonemizer; extra == "dev"
121
+ Requires-Dist: accelerate>=0.31.0; extra == "dev"
122
+ Requires-Dist: datasets; extra == "dev"
123
+ Requires-Dist: protobuf<4,>=3.20.3; extra == "dev"
124
+ Requires-Dist: tensorboard; extra == "dev"
125
+ Requires-Dist: Jinja2; extra == "dev"
126
+ Requires-Dist: peft>=0.17.0; extra == "dev"
127
+ Requires-Dist: timm; extra == "dev"
128
+ Requires-Dist: hf-doc-builder>=0.3.0; extra == "dev"
129
+ Requires-Dist: torch>=2.6; extra == "dev"
130
+ Requires-Dist: accelerate>=0.31.0; extra == "dev"
131
+ Requires-Dist: jax>=0.4.1; extra == "dev"
132
+ Requires-Dist: jaxlib>=0.4.1; extra == "dev"
133
+ Requires-Dist: flax>=0.4.1; extra == "dev"
134
+ Dynamic: author
135
+ Dynamic: author-email
136
+ Dynamic: classifier
137
+ Dynamic: description
138
+ Dynamic: description-content-type
139
+ Dynamic: home-page
140
+ Dynamic: keywords
141
+ Dynamic: license
142
+ Dynamic: license-file
143
+ Dynamic: provides-extra
144
+ Dynamic: requires-dist
145
+ Dynamic: requires-python
146
+ Dynamic: summary
147
+
148
+ <!---
149
+ Copyright 2022 - The HuggingFace Team. All rights reserved.
150
+
151
+ Licensed under the Apache License, Version 2.0 (the "License");
152
+ you may not use this file except in compliance with the License.
153
+ You may obtain a copy of the License at
154
+
155
+ http://www.apache.org/licenses/LICENSE-2.0
156
+
157
+ Unless required by applicable law or agreed to in writing, software
158
+ distributed under the License is distributed on an "AS IS" BASIS,
159
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
160
+ See the License for the specific language governing permissions and
161
+ limitations under the License.
162
+ -->
163
+
164
+ <p align="center">
165
+ <br>
166
+ <img src="https://raw.githubusercontent.com/huggingface/diffusers/main/docs/source/en/imgs/diffusers_library.jpg" width="400"/>
167
+ <br>
168
+ <p>
169
+ <p align="center">
170
+ <a href="https://github.com/huggingface/diffusers/blob/main/LICENSE"><img alt="GitHub" src="https://img.shields.io/github/license/huggingface/datasets.svg?color=blue"></a>
171
+ <a href="https://github.com/huggingface/diffusers/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/huggingface/diffusers.svg"></a>
172
+ <a href="https://pepy.tech/project/diffusers"><img alt="GitHub release" src="https://static.pepy.tech/badge/diffusers/month"></a>
173
+ <a href="CODE_OF_CONDUCT.md"><img alt="Contributor Covenant" src="https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg"></a>
174
+ <a href="https://twitter.com/diffuserslib"><img alt="X account" src="https://img.shields.io/twitter/url/https/twitter.com/diffuserslib.svg?style=social&label=Follow%20%40diffuserslib"></a>
175
+ </p>
176
+
177
+ 🤗 Diffusers is the go-to library for state-of-the-art pretrained diffusion models for generating images, audio, and even 3D structures of molecules. Whether you're looking for a simple inference solution or training your own diffusion models, 🤗 Diffusers is a modular toolbox that supports both. Our library is designed with a focus on [usability over performance](https://huggingface.co/docs/diffusers/conceptual/philosophy#usability-over-performance), [simple over easy](https://huggingface.co/docs/diffusers/conceptual/philosophy#simple-over-easy), and [customizability over abstractions](https://huggingface.co/docs/diffusers/conceptual/philosophy#tweakable-contributorfriendly-over-abstraction).
178
+
179
+ 🤗 Diffusers offers three core components:
180
+
181
+ - State-of-the-art [diffusion pipelines](https://huggingface.co/docs/diffusers/api/pipelines/overview) that can be run in inference with just a few lines of code.
182
+ - Interchangeable noise [schedulers](https://huggingface.co/docs/diffusers/api/schedulers/overview) for different diffusion speeds and output quality.
183
+ - Pretrained [models](https://huggingface.co/docs/diffusers/api/models/overview) that can be used as building blocks, and combined with schedulers, for creating your own end-to-end diffusion systems.
184
+
185
+ ## Installation
186
+
187
+ We recommend installing 🤗 Diffusers in a virtual environment from PyPI or Conda. For more details about installing [PyTorch](https://pytorch.org/get-started/locally/), please refer to their official documentation.
188
+
189
+ ### PyTorch
190
+
191
+ With `pip` (official package):
192
+
193
+ ```bash
194
+ pip install --upgrade diffusers[torch]
195
+ ```
196
+
197
+ With `conda` (maintained by the community):
198
+
199
+ ```sh
200
+ conda install -c conda-forge diffusers
201
+ ```
202
+
203
+ ### Apple Silicon (M1/M2) support
204
+
205
+ Please refer to the [How to use Stable Diffusion in Apple Silicon](https://huggingface.co/docs/diffusers/optimization/mps) guide.
206
+
207
+ ## Quickstart
208
+
209
+ Generating outputs is super easy with 🤗 Diffusers. To generate an image from text, use the `from_pretrained` method to load any pretrained diffusion model (browse the [Hub](https://huggingface.co/models?library=diffusers&sort=downloads) for 30,000+ checkpoints):
210
+
211
+ ```python
212
+ from diffusers import DiffusionPipeline
213
+ import torch
214
+
215
+ pipeline = DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch.float16)
216
+ pipeline.to("cuda")
217
+ pipeline("An image of a squirrel in Picasso style").images[0]
218
+ ```
219
+
220
+ You can also dig into the models and schedulers toolbox to build your own diffusion system:
221
+
222
+ ```python
223
+ from diffusers import DDPMScheduler, UNet2DModel
224
+ from PIL import Image
225
+ import torch
226
+
227
+ scheduler = DDPMScheduler.from_pretrained("google/ddpm-cat-256")
228
+ model = UNet2DModel.from_pretrained("google/ddpm-cat-256").to("cuda")
229
+ scheduler.set_timesteps(50)
230
+
231
+ sample_size = model.config.sample_size
232
+ noise = torch.randn((1, 3, sample_size, sample_size), device="cuda")
233
+ input = noise
234
+
235
+ for t in scheduler.timesteps:
236
+ with torch.no_grad():
237
+ noisy_residual = model(input, t).sample
238
+ prev_noisy_sample = scheduler.step(noisy_residual, t, input).prev_sample
239
+ input = prev_noisy_sample
240
+
241
+ image = (input / 2 + 0.5).clamp(0, 1)
242
+ image = image.cpu().permute(0, 2, 3, 1).numpy()[0]
243
+ image = Image.fromarray((image * 255).round().astype("uint8"))
244
+ image
245
+ ```
246
+
247
+ Check out the [Quickstart](https://huggingface.co/docs/diffusers/quicktour) to launch your diffusion journey today!
248
+
249
+ ## How to navigate the documentation
250
+
251
+ | **Documentation** | **What can I learn?** |
252
+ |---------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
253
+ | [Tutorial](https://huggingface.co/docs/diffusers/tutorials/tutorial_overview) | A basic crash course for learning how to use the library's most important features like using models and schedulers to build your own diffusion system, and training your own diffusion model. |
254
+ | [Loading](https://huggingface.co/docs/diffusers/using-diffusers/loading) | Guides for how to load and configure all the components (pipelines, models, and schedulers) of the library, as well as how to use different schedulers. |
255
+ | [Pipelines for inference](https://huggingface.co/docs/diffusers/using-diffusers/overview_techniques) | Guides for how to use pipelines for different inference tasks, batched generation, controlling generated outputs and randomness, and how to contribute a pipeline to the library. |
256
+ | [Optimization](https://huggingface.co/docs/diffusers/optimization/fp16) | Guides for how to optimize your diffusion model to run faster and consume less memory. |
257
+ | [Training](https://huggingface.co/docs/diffusers/training/overview) | Guides for how to train a diffusion model for different tasks with different training techniques. |
258
+ ## Contribution
259
+
260
+ We ❤️ contributions from the open-source community!
261
+ If you want to contribute to this library, please check out our [Contribution guide](https://huggingface.co/docs/diffusers/main/en/conceptual/contribution).
262
+ If you are using an AI agent, please point it at the project conventions in [`.ai/`](https://github.com/huggingface/diffusers/tree/main/.ai) first (run `make claude` or `make codex`) — see [Coding with AI agents](https://huggingface.co/docs/diffusers/main/en/conceptual/contribution#coding-with-ai-agents).
263
+ You can look out for [issues](https://github.com/huggingface/diffusers/issues) you'd like to tackle to contribute to the library.
264
+ - See [Good first issues](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) for general opportunities to contribute
265
+ - See [New model/pipeline](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+pipeline%2Fmodel%22) to contribute exciting new diffusion models / diffusion pipelines
266
+ - See [New scheduler](https://github.com/huggingface/diffusers/issues?q=is%3Aopen+is%3Aissue+label%3A%22New+scheduler%22)
267
+
268
+ Also, say 👋 in our public Discord channel <a href="https://discord.gg/G7tWnz98XR"><img alt="Join us on Discord" src="https://img.shields.io/discord/823813159592001537?color=5865F2&logo=discord&logoColor=white"></a>. We discuss the hottest trends about diffusion models, help each other with contributions, personal projects or just hang out ☕.
269
+
270
+
271
+ ## Popular Tasks & Pipelines
272
+
273
+ <table>
274
+ <tr>
275
+ <th>Task</th>
276
+ <th>Pipeline</th>
277
+ <th>🤗 Hub</th>
278
+ </tr>
279
+ <tr style="border-top: 2px solid black">
280
+ <td>Unconditional Image Generation</td>
281
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/ddpm"> DDPM </a></td>
282
+ <td><a href="https://huggingface.co/google/ddpm-ema-church-256"> google/ddpm-ema-church-256 </a></td>
283
+ </tr>
284
+ <tr style="border-top: 2px solid black">
285
+ <td>Text-to-Image</td>
286
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/text2img">Stable Diffusion Text-to-Image</a></td>
287
+ <td><a href="https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5"> stable-diffusion-v1-5/stable-diffusion-v1-5 </a></td>
288
+ </tr>
289
+ <tr>
290
+ <td>Text-to-Image</td>
291
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/unclip">unCLIP</a></td>
292
+ <td><a href="https://huggingface.co/kakaobrain/karlo-v1-alpha"> kakaobrain/karlo-v1-alpha </a></td>
293
+ </tr>
294
+ <tr>
295
+ <td>Text-to-Image</td>
296
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/deepfloyd_if">DeepFloyd IF</a></td>
297
+ <td><a href="https://huggingface.co/DeepFloyd/IF-I-XL-v1.0"> DeepFloyd/IF-I-XL-v1.0 </a></td>
298
+ </tr>
299
+ <tr>
300
+ <td>Text-to-Image</td>
301
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/kandinsky">Kandinsky</a></td>
302
+ <td><a href="https://huggingface.co/kandinsky-community/kandinsky-2-2-decoder"> kandinsky-community/kandinsky-2-2-decoder </a></td>
303
+ </tr>
304
+ <tr style="border-top: 2px solid black">
305
+ <td>Text-guided Image-to-Image</td>
306
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/controlnet">ControlNet</a></td>
307
+ <td><a href="https://huggingface.co/lllyasviel/sd-controlnet-canny"> lllyasviel/sd-controlnet-canny </a></td>
308
+ </tr>
309
+ <tr>
310
+ <td>Text-guided Image-to-Image</td>
311
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/pix2pix">InstructPix2Pix</a></td>
312
+ <td><a href="https://huggingface.co/timbrooks/instruct-pix2pix"> timbrooks/instruct-pix2pix </a></td>
313
+ </tr>
314
+ <tr>
315
+ <td>Text-guided Image-to-Image</td>
316
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/img2img">Stable Diffusion Image-to-Image</a></td>
317
+ <td><a href="https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5"> stable-diffusion-v1-5/stable-diffusion-v1-5 </a></td>
318
+ </tr>
319
+ <tr style="border-top: 2px solid black">
320
+ <td>Text-guided Image Inpainting</td>
321
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/inpaint">Stable Diffusion Inpainting</a></td>
322
+ <td><a href="https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-inpainting"> stable-diffusion-v1-5/stable-diffusion-inpainting </a></td>
323
+ </tr>
324
+ <tr style="border-top: 2px solid black">
325
+ <td>Image Variation</td>
326
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/image_variation">Stable Diffusion Image Variation</a></td>
327
+ <td><a href="https://huggingface.co/lambdalabs/sd-image-variations-diffusers"> lambdalabs/sd-image-variations-diffusers </a></td>
328
+ </tr>
329
+ <tr style="border-top: 2px solid black">
330
+ <td>Super Resolution</td>
331
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/upscale">Stable Diffusion Upscale</a></td>
332
+ <td><a href="https://huggingface.co/stabilityai/stable-diffusion-x4-upscaler"> stabilityai/stable-diffusion-x4-upscaler </a></td>
333
+ </tr>
334
+ <tr>
335
+ <td>Super Resolution</td>
336
+ <td><a href="https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/latent_upscale">Stable Diffusion Latent Upscale</a></td>
337
+ <td><a href="https://huggingface.co/stabilityai/sd-x2-latent-upscaler"> stabilityai/sd-x2-latent-upscaler </a></td>
338
+ </tr>
339
+ </table>
340
+
341
+ ## Popular libraries using 🧨 Diffusers
342
+
343
+ - https://github.com/microsoft/TaskMatrix
344
+ - https://github.com/invoke-ai/InvokeAI
345
+ - https://github.com/InstantID/InstantID
346
+ - https://github.com/apple/ml-stable-diffusion
347
+ - https://github.com/Sanster/lama-cleaner
348
+ - https://github.com/IDEA-Research/Grounded-Segment-Anything
349
+ - https://github.com/ashawkey/stable-dreamfusion
350
+ - https://github.com/deep-floyd/IF
351
+ - https://github.com/bentoml/BentoML
352
+ - https://github.com/bmaltais/kohya_ss
353
+ - +14,000 other amazing GitHub repositories 💪
354
+
355
+ Thank you for using us ❤️.
356
+
357
+ ## Credits
358
+
359
+ This library concretizes previous work by many different authors and would not have been possible without their great research and implementations. We'd like to thank, in particular, the following implementations which have helped us in our development and without which the API could not have been as polished today:
360
+
361
+ - @CompVis' latent diffusion models library, available [here](https://github.com/CompVis/latent-diffusion)
362
+ - @hojonathanho original DDPM implementation, available [here](https://github.com/hojonathanho/diffusion) as well as the extremely useful translation into PyTorch by @pesser, available [here](https://github.com/pesser/pytorch_diffusion)
363
+ - @ermongroup's DDIM implementation, available [here](https://github.com/ermongroup/ddim)
364
+ - @yang-song's Score-VE and Score-VP implementations, available [here](https://github.com/yang-song/score_sde_pytorch)
365
+
366
+ We also want to thank @heejkoo for the very helpful overview of papers, code and resources on diffusion models, available [here](https://github.com/heejkoo/Awesome-Diffusion-Models) as well as @crowsonkb and @rromb for useful discussions and insights.
367
+
368
+ ## Citation
369
+
370
+ ```bibtex
371
+ @misc{von-platen-etal-2022-diffusers,
372
+ author = {Patrick von Platen and Suraj Patil and Anton Lozhkov and Pedro Cuenca and Nathan Lambert and Kashif Rasul and Mishig Davaadorj and Dhruv Nair and Sayak Paul and William Berman and Yiyi Xu and Steven Liu and Thomas Wolf},
373
+ title = {Diffusers: State-of-the-art diffusion models},
374
+ year = {2022},
375
+ publisher = {GitHub},
376
+ journal = {GitHub repository},
377
+ howpublished = {\url{https://github.com/huggingface/diffusers}}
378
+ }
379
+ ```
data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/RECORD ADDED
The diff for this file is too large to render. See raw diff
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/REQUESTED ADDED
File without changes
data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/entry_points.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [console_scripts]
2
+ diffusers-cli = diffusers.commands.diffusers_cli:main
data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, Any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/diffusion/.venv/lib/python3.11/site-packages/diffusers-0.39.0.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ diffusers
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__init__.py ADDED
@@ -0,0 +1,1765 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __version__ = "0.39.0"
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from .utils import (
6
+ DIFFUSERS_SLOW_IMPORT,
7
+ OptionalDependencyNotAvailable,
8
+ _LazyModule,
9
+ is_accelerate_available,
10
+ is_auto_round_available,
11
+ is_bitsandbytes_available,
12
+ is_flax_available,
13
+ is_gguf_available,
14
+ is_librosa_available,
15
+ is_note_seq_available,
16
+ is_nvidia_modelopt_available,
17
+ is_onnx_available,
18
+ is_opencv_available,
19
+ is_optimum_quanto_available,
20
+ is_scipy_available,
21
+ is_sentencepiece_available,
22
+ is_torch_available,
23
+ is_torchao_available,
24
+ is_torchsde_available,
25
+ is_transformers_available,
26
+ is_transformers_flax_compatible,
27
+ is_transformers_version,
28
+ )
29
+
30
+
31
+ # Lazy Import based on
32
+ # https://github.com/huggingface/transformers/blob/main/src/transformers/__init__.py
33
+
34
+ # When adding a new object to this init, please add it to `_import_structure`. The `_import_structure` is a dictionary submodule to list of object names,
35
+ # and is used to defer the actual importing for when the objects are requested.
36
+ # This way `import diffusers` provides the names in the namespace without actually importing anything (and especially none of the backends).
37
+
38
+ _import_structure = {
39
+ "configuration_utils": ["ConfigMixin"],
40
+ "guiders": [],
41
+ "hooks": [],
42
+ "loaders": ["FromOriginalModelMixin"],
43
+ "models": [],
44
+ "modular_pipelines": [],
45
+ "pipelines": [],
46
+ "quantizers.pipe_quant_config": ["PipelineQuantizationConfig"],
47
+ "quantizers.quantization_config": [],
48
+ "schedulers": [],
49
+ "utils": [
50
+ "OptionalDependencyNotAvailable",
51
+ "is_flax_available",
52
+ "is_inflect_available",
53
+ "is_invisible_watermark_available",
54
+ "is_librosa_available",
55
+ "is_note_seq_available",
56
+ "is_onnx_available",
57
+ "is_scipy_available",
58
+ "is_torch_available",
59
+ "is_torchsde_available",
60
+ "is_transformers_available",
61
+ "is_transformers_version",
62
+ "is_unidecode_available",
63
+ "logging",
64
+ ],
65
+ }
66
+
67
+ try:
68
+ if not is_torch_available() and not is_accelerate_available() and not is_bitsandbytes_available():
69
+ raise OptionalDependencyNotAvailable()
70
+ except OptionalDependencyNotAvailable:
71
+ from .utils import dummy_bitsandbytes_objects
72
+
73
+ _import_structure["utils.dummy_bitsandbytes_objects"] = [
74
+ name for name in dir(dummy_bitsandbytes_objects) if not name.startswith("_")
75
+ ]
76
+ else:
77
+ _import_structure["quantizers.quantization_config"].append("BitsAndBytesConfig")
78
+
79
+ try:
80
+ if not is_torch_available() and not is_accelerate_available() and not is_gguf_available():
81
+ raise OptionalDependencyNotAvailable()
82
+ except OptionalDependencyNotAvailable:
83
+ from .utils import dummy_gguf_objects
84
+
85
+ _import_structure["utils.dummy_gguf_objects"] = [
86
+ name for name in dir(dummy_gguf_objects) if not name.startswith("_")
87
+ ]
88
+ else:
89
+ _import_structure["quantizers.quantization_config"].append("GGUFQuantizationConfig")
90
+
91
+ try:
92
+ if not is_torch_available() and not is_accelerate_available() and not is_torchao_available():
93
+ raise OptionalDependencyNotAvailable()
94
+ except OptionalDependencyNotAvailable:
95
+ from .utils import dummy_torchao_objects
96
+
97
+ _import_structure["utils.dummy_torchao_objects"] = [
98
+ name for name in dir(dummy_torchao_objects) if not name.startswith("_")
99
+ ]
100
+ else:
101
+ _import_structure["quantizers.quantization_config"].append("TorchAoConfig")
102
+
103
+ try:
104
+ if not is_torch_available() and not is_accelerate_available() and not is_optimum_quanto_available():
105
+ raise OptionalDependencyNotAvailable()
106
+ except OptionalDependencyNotAvailable:
107
+ from .utils import dummy_optimum_quanto_objects
108
+
109
+ _import_structure["utils.dummy_optimum_quanto_objects"] = [
110
+ name for name in dir(dummy_optimum_quanto_objects) if not name.startswith("_")
111
+ ]
112
+ else:
113
+ _import_structure["quantizers.quantization_config"].append("QuantoConfig")
114
+
115
+ try:
116
+ if not is_torch_available() and not is_accelerate_available() and not is_nvidia_modelopt_available():
117
+ raise OptionalDependencyNotAvailable()
118
+ except OptionalDependencyNotAvailable:
119
+ from .utils import dummy_nvidia_modelopt_objects
120
+
121
+ _import_structure["utils.dummy_nvidia_modelopt_objects"] = [
122
+ name for name in dir(dummy_nvidia_modelopt_objects) if not name.startswith("_")
123
+ ]
124
+ else:
125
+ _import_structure["quantizers.quantization_config"].append("NVIDIAModelOptConfig")
126
+
127
+ try:
128
+ if not is_auto_round_available():
129
+ raise OptionalDependencyNotAvailable()
130
+ except OptionalDependencyNotAvailable:
131
+ from .utils import dummy_auto_round_objects
132
+
133
+ _import_structure["utils.dummy_auto_round_objects"] = [
134
+ name for name in dir(dummy_auto_round_objects) if not name.startswith("_")
135
+ ]
136
+ else:
137
+ _import_structure["quantizers.quantization_config"].append("AutoRoundConfig")
138
+
139
+ try:
140
+ if not is_onnx_available():
141
+ raise OptionalDependencyNotAvailable()
142
+ except OptionalDependencyNotAvailable:
143
+ from .utils import dummy_onnx_objects # noqa F403
144
+
145
+ _import_structure["utils.dummy_onnx_objects"] = [
146
+ name for name in dir(dummy_onnx_objects) if not name.startswith("_")
147
+ ]
148
+
149
+ else:
150
+ _import_structure["pipelines"].extend(["OnnxRuntimeModel"])
151
+
152
+ try:
153
+ if not is_torch_available():
154
+ raise OptionalDependencyNotAvailable()
155
+ except OptionalDependencyNotAvailable:
156
+ from .utils import dummy_pt_objects # noqa F403
157
+
158
+ _import_structure["utils.dummy_pt_objects"] = [name for name in dir(dummy_pt_objects) if not name.startswith("_")]
159
+
160
+ else:
161
+ _import_structure["guiders"].extend(
162
+ [
163
+ "AdaptiveProjectedGuidance",
164
+ "AdaptiveProjectedMixGuidance",
165
+ "AutoGuidance",
166
+ "BaseGuidance",
167
+ "ClassifierFreeGuidance",
168
+ "ClassifierFreeZeroStarGuidance",
169
+ "FrequencyDecoupledGuidance",
170
+ "PerturbedAttentionGuidance",
171
+ "SkipLayerGuidance",
172
+ "SmoothedEnergyGuidance",
173
+ "TangentialClassifierFreeGuidance",
174
+ ]
175
+ )
176
+ _import_structure["hooks"].extend(
177
+ [
178
+ "FasterCacheConfig",
179
+ "FirstBlockCacheConfig",
180
+ "HookRegistry",
181
+ "LayerSkipConfig",
182
+ "MagCacheConfig",
183
+ "PyramidAttentionBroadcastConfig",
184
+ "SmoothedEnergyGuidanceConfig",
185
+ "TaylorSeerCacheConfig",
186
+ "TextKVCacheConfig",
187
+ "apply_faster_cache",
188
+ "apply_first_block_cache",
189
+ "apply_layer_skip",
190
+ "apply_mag_cache",
191
+ "apply_pyramid_attention_broadcast",
192
+ "apply_taylorseer_cache",
193
+ "apply_text_kv_cache",
194
+ ]
195
+ )
196
+ _import_structure["image_processor"] = [
197
+ "InpaintProcessor",
198
+ "IPAdapterMaskProcessor",
199
+ "PixArtImageProcessor",
200
+ "VaeImageProcessor",
201
+ "VaeImageProcessorLDM3D",
202
+ ]
203
+ _import_structure["models"].extend(
204
+ [
205
+ "AceStepTransformer1DModel",
206
+ "AllegroTransformer3DModel",
207
+ "AnimaTextConditioner",
208
+ "AnyFlowFARTransformer3DModel",
209
+ "AnyFlowTransformer3DModel",
210
+ "AsymmetricAutoencoderKL",
211
+ "AttentionBackendName",
212
+ "AuraFlowTransformer2DModel",
213
+ "AutoencoderDC",
214
+ "AutoencoderKL",
215
+ "AutoencoderKLAllegro",
216
+ "AutoencoderKLCogVideoX",
217
+ "AutoencoderKLCosmos",
218
+ "AutoencoderKLFlux2",
219
+ "AutoencoderKLHunyuanImage",
220
+ "AutoencoderKLHunyuanImageRefiner",
221
+ "AutoencoderKLHunyuanVideo",
222
+ "AutoencoderKLHunyuanVideo15",
223
+ "AutoencoderKLKVAE",
224
+ "AutoencoderKLKVAEVideo",
225
+ "AutoencoderKLLTX2Audio",
226
+ "AutoencoderKLLTX2Video",
227
+ "AutoencoderKLLTXVideo",
228
+ "AutoencoderKLMagvit",
229
+ "AutoencoderKLMochi",
230
+ "AutoencoderKLQwenImage",
231
+ "AutoencoderKLTemporalDecoder",
232
+ "AutoencoderKLWan",
233
+ "AutoencoderOobleck",
234
+ "AutoencoderRAE",
235
+ "AutoencoderTiny",
236
+ "AutoencoderVidTok",
237
+ "AutoModel",
238
+ "BriaFiboTransformer2DModel",
239
+ "BriaTransformer2DModel",
240
+ "CacheMixin",
241
+ "ChromaTransformer2DModel",
242
+ "ChronoEditTransformer3DModel",
243
+ "CogVideoXTransformer3DModel",
244
+ "CogView3PlusTransformer2DModel",
245
+ "CogView4Transformer2DModel",
246
+ "ConsisIDTransformer3DModel",
247
+ "ConsistencyDecoderVAE",
248
+ "ContextParallelConfig",
249
+ "ControlNetModel",
250
+ "ControlNetUnionModel",
251
+ "ControlNetXSAdapter",
252
+ "Cosmos3AVAEAudioTokenizer",
253
+ "Cosmos3OmniTransformer",
254
+ "CosmosControlNetModel",
255
+ "CosmosTransformer3DModel",
256
+ "DiTTransformer2DModel",
257
+ "DreamLiteTransformer2DModel",
258
+ "DreamLiteUNetModel",
259
+ "EasyAnimateTransformer3DModel",
260
+ "ErnieImageTransformer2DModel",
261
+ "Flux2Transformer2DModel",
262
+ "FluxControlNetModel",
263
+ "FluxMultiControlNetModel",
264
+ "FluxTransformer2DModel",
265
+ "GlmImageTransformer2DModel",
266
+ "HeliosTransformer3DModel",
267
+ "HiDreamImageTransformer2DModel",
268
+ "HunyuanDiT2DControlNetModel",
269
+ "HunyuanDiT2DModel",
270
+ "HunyuanDiT2DMultiControlNetModel",
271
+ "HunyuanImageTransformer2DModel",
272
+ "HunyuanVideo15Transformer3DModel",
273
+ "HunyuanVideoFramepackTransformer3DModel",
274
+ "HunyuanVideoTransformer3DModel",
275
+ "I2VGenXLUNet",
276
+ "Ideogram4Transformer2DModel",
277
+ "JoyImageEditTransformer3DModel",
278
+ "Kandinsky3UNet",
279
+ "Kandinsky5Transformer3DModel",
280
+ "Krea2Transformer2DModel",
281
+ "LatteTransformer3DModel",
282
+ "LongCatAudioDiTTransformer",
283
+ "LongCatAudioDiTVae",
284
+ "LongCatImageTransformer2DModel",
285
+ "LTX2VideoTransformer3DModel",
286
+ "LTXVideoTransformer3DModel",
287
+ "Lumina2Transformer2DModel",
288
+ "LuminaNextDiT2DModel",
289
+ "MochiTransformer3DModel",
290
+ "ModelMixin",
291
+ "MotifVideoTransformer3DModel",
292
+ "MotionAdapter",
293
+ "MultiAdapter",
294
+ "MultiControlNetModel",
295
+ "NucleusMoEImageTransformer2DModel",
296
+ "OmniGenTransformer2DModel",
297
+ "OvisImageTransformer2DModel",
298
+ "ParallelConfig",
299
+ "PixArtTransformer2DModel",
300
+ "PriorTransformer",
301
+ "PRXTransformer2DModel",
302
+ "QwenImageControlNetModel",
303
+ "QwenImageMultiControlNetModel",
304
+ "QwenImageTransformer2DModel",
305
+ "SanaControlNetModel",
306
+ "SanaTransformer2DModel",
307
+ "SanaVideoTransformer3DModel",
308
+ "SD3ControlNetModel",
309
+ "SD3MultiControlNetModel",
310
+ "SD3Transformer2DModel",
311
+ "SkyReelsV2Transformer3DModel",
312
+ "SparseControlNetModel",
313
+ "StableAudioDiTModel",
314
+ "StableCascadeUNet",
315
+ "T2IAdapter",
316
+ "T5FilmDecoder",
317
+ "Transformer2DModel",
318
+ "TransformerTemporalModel",
319
+ "UNet1DModel",
320
+ "UNet2DConditionModel",
321
+ "UNet2DModel",
322
+ "UNet3DConditionModel",
323
+ "UNetControlNetXSModel",
324
+ "UNetMotionModel",
325
+ "UNetSpatioTemporalConditionModel",
326
+ "UVit2DModel",
327
+ "VQModel",
328
+ "WanAnimateTransformer3DModel",
329
+ "WanTransformer3DModel",
330
+ "WanVACETransformer3DModel",
331
+ "ZImageControlNetModel",
332
+ "ZImageTransformer2DModel",
333
+ "attention_backend",
334
+ ]
335
+ )
336
+ _import_structure["modular_pipelines"].extend(
337
+ [
338
+ "AutoPipelineBlocks",
339
+ "ComponentsManager",
340
+ "ComponentSpec",
341
+ "ConditionalPipelineBlocks",
342
+ "ConfigSpec",
343
+ "InputParam",
344
+ "LoopSequentialPipelineBlocks",
345
+ "ModularPipeline",
346
+ "ModularPipelineBlocks",
347
+ "OutputParam",
348
+ "SequentialPipelineBlocks",
349
+ ]
350
+ )
351
+ _import_structure["optimization"] = [
352
+ "get_constant_schedule",
353
+ "get_constant_schedule_with_warmup",
354
+ "get_cosine_schedule_with_warmup",
355
+ "get_cosine_with_hard_restarts_schedule_with_warmup",
356
+ "get_linear_schedule_with_warmup",
357
+ "get_polynomial_decay_schedule_with_warmup",
358
+ "get_scheduler",
359
+ ]
360
+ _import_structure["pipelines"].extend(
361
+ [
362
+ "AudioPipelineOutput",
363
+ "AutoPipelineForImage2Image",
364
+ "AutoPipelineForInpainting",
365
+ "AutoPipelineForText2Audio",
366
+ "AutoPipelineForText2Image",
367
+ "ConsistencyModelPipeline",
368
+ "DanceDiffusionPipeline",
369
+ "DDIMPipeline",
370
+ "DDPMPipeline",
371
+ "DiffusionPipeline",
372
+ "DiTPipeline",
373
+ "ImagePipelineOutput",
374
+ "KarrasVePipeline",
375
+ "LDMPipeline",
376
+ "LDMSuperResolutionPipeline",
377
+ "PNDMPipeline",
378
+ "RePaintPipeline",
379
+ "ScoreSdeVePipeline",
380
+ "StableDiffusionMixin",
381
+ ]
382
+ )
383
+ _import_structure["quantizers"] = ["DiffusersQuantizer"]
384
+ _import_structure["schedulers"].extend(
385
+ [
386
+ "AmusedScheduler",
387
+ "BlockRefinementScheduler",
388
+ "BlockRefinementSchedulerOutput",
389
+ "CMStochasticIterativeScheduler",
390
+ "CogVideoXDDIMScheduler",
391
+ "CogVideoXDPMScheduler",
392
+ "DDIMInverseScheduler",
393
+ "DDIMParallelScheduler",
394
+ "DDIMScheduler",
395
+ "DDPMParallelScheduler",
396
+ "DDPMScheduler",
397
+ "DDPMWuerstchenScheduler",
398
+ "DEISMultistepScheduler",
399
+ "DiscreteDDIMScheduler",
400
+ "DiscreteDDIMSchedulerOutput",
401
+ "DPMSolverMultistepInverseScheduler",
402
+ "DPMSolverMultistepScheduler",
403
+ "DPMSolverSinglestepScheduler",
404
+ "EDMDPMSolverMultistepScheduler",
405
+ "EDMEulerScheduler",
406
+ "EntropyBoundScheduler",
407
+ "EntropyBoundSchedulerOutput",
408
+ "EulerAncestralDiscreteScheduler",
409
+ "EulerDiscreteScheduler",
410
+ "FlowMapEulerDiscreteScheduler",
411
+ "FlowMatchEulerDiscreteScheduler",
412
+ "FlowMatchHeunDiscreteScheduler",
413
+ "FlowMatchLCMScheduler",
414
+ "HeliosDMDScheduler",
415
+ "HeliosScheduler",
416
+ "HeunDiscreteScheduler",
417
+ "IPNDMScheduler",
418
+ "KarrasVeScheduler",
419
+ "KDPM2AncestralDiscreteScheduler",
420
+ "KDPM2DiscreteScheduler",
421
+ "LCMScheduler",
422
+ "LTXEulerAncestralRFScheduler",
423
+ "PNDMScheduler",
424
+ "RePaintScheduler",
425
+ "SASolverScheduler",
426
+ "SchedulerMixin",
427
+ "SCMScheduler",
428
+ "ScoreSdeVeScheduler",
429
+ "TCDScheduler",
430
+ "UnCLIPScheduler",
431
+ "UniPCMultistepScheduler",
432
+ "VQDiffusionScheduler",
433
+ ]
434
+ )
435
+ _import_structure["training_utils"] = ["EMAModel"]
436
+ _import_structure["video_processor"] = ["VideoProcessor"]
437
+
438
+ try:
439
+ if not (is_torch_available() and is_scipy_available()):
440
+ raise OptionalDependencyNotAvailable()
441
+ except OptionalDependencyNotAvailable:
442
+ from .utils import dummy_torch_and_scipy_objects # noqa F403
443
+
444
+ _import_structure["utils.dummy_torch_and_scipy_objects"] = [
445
+ name for name in dir(dummy_torch_and_scipy_objects) if not name.startswith("_")
446
+ ]
447
+
448
+ else:
449
+ _import_structure["schedulers"].extend(["LMSDiscreteScheduler"])
450
+
451
+ try:
452
+ if not (is_torch_available() and is_torchsde_available()):
453
+ raise OptionalDependencyNotAvailable()
454
+ except OptionalDependencyNotAvailable:
455
+ from .utils import dummy_torch_and_torchsde_objects # noqa F403
456
+
457
+ _import_structure["utils.dummy_torch_and_torchsde_objects"] = [
458
+ name for name in dir(dummy_torch_and_torchsde_objects) if not name.startswith("_")
459
+ ]
460
+
461
+ else:
462
+ _import_structure["schedulers"].extend(["CosineDPMSolverMultistepScheduler", "DPMSolverSDEScheduler"])
463
+
464
+ try:
465
+ if not (is_torch_available() and is_transformers_available()):
466
+ raise OptionalDependencyNotAvailable()
467
+ except OptionalDependencyNotAvailable:
468
+ from .utils import dummy_torch_and_transformers_objects # noqa F403
469
+
470
+ _import_structure["utils.dummy_torch_and_transformers_objects"] = [
471
+ name for name in dir(dummy_torch_and_transformers_objects) if not name.startswith("_")
472
+ ]
473
+
474
+ else:
475
+ _import_structure["modular_pipelines"].extend(
476
+ [
477
+ "AnimaAutoBlocks",
478
+ "AnimaModularPipeline",
479
+ "ErnieImageAutoBlocks",
480
+ "ErnieImageModularPipeline",
481
+ "Flux2AutoBlocks",
482
+ "Flux2KleinAutoBlocks",
483
+ "Flux2KleinBaseAutoBlocks",
484
+ "Flux2KleinBaseModularPipeline",
485
+ "Flux2KleinModularPipeline",
486
+ "Flux2ModularPipeline",
487
+ "FluxAutoBlocks",
488
+ "FluxKontextAutoBlocks",
489
+ "FluxKontextModularPipeline",
490
+ "FluxModularPipeline",
491
+ "HeliosAutoBlocks",
492
+ "HeliosModularPipeline",
493
+ "HeliosPyramidAutoBlocks",
494
+ "HeliosPyramidDistilledAutoBlocks",
495
+ "HeliosPyramidDistilledModularPipeline",
496
+ "HeliosPyramidModularPipeline",
497
+ "HunyuanVideo15AutoBlocks",
498
+ "HunyuanVideo15ModularPipeline",
499
+ "Ideogram4AutoBlocks",
500
+ "Ideogram4ModularPipeline",
501
+ "LTXAutoBlocks",
502
+ "LTXModularPipeline",
503
+ "QwenImageAutoBlocks",
504
+ "QwenImageEditAutoBlocks",
505
+ "QwenImageEditModularPipeline",
506
+ "QwenImageEditPlusAutoBlocks",
507
+ "QwenImageEditPlusModularPipeline",
508
+ "QwenImageLayeredAutoBlocks",
509
+ "QwenImageLayeredModularPipeline",
510
+ "QwenImageModularPipeline",
511
+ "StableDiffusion3AutoBlocks",
512
+ "StableDiffusion3ModularPipeline",
513
+ "StableDiffusionXLAutoBlocks",
514
+ "StableDiffusionXLModularPipeline",
515
+ "Wan22Blocks",
516
+ "Wan22Image2VideoBlocks",
517
+ "Wan22Image2VideoModularPipeline",
518
+ "Wan22ModularPipeline",
519
+ "WanBlocks",
520
+ "WanImage2VideoAutoBlocks",
521
+ "WanImage2VideoModularPipeline",
522
+ "WanModularPipeline",
523
+ "ZImageAutoBlocks",
524
+ "ZImageModularPipeline",
525
+ ]
526
+ )
527
+ _import_structure["pipelines"].extend(
528
+ [
529
+ "AceStepAudioTokenDetokenizer",
530
+ "AceStepAudioTokenizer",
531
+ "AceStepConditionEncoder",
532
+ "AceStepPipeline",
533
+ "AllegroPipeline",
534
+ "AltDiffusionImg2ImgPipeline",
535
+ "AltDiffusionPipeline",
536
+ "AmusedImg2ImgPipeline",
537
+ "AmusedInpaintPipeline",
538
+ "AmusedPipeline",
539
+ "AnimateDiffControlNetPipeline",
540
+ "AnimateDiffPAGPipeline",
541
+ "AnimateDiffPipeline",
542
+ "AnimateDiffSDXLPipeline",
543
+ "AnimateDiffSparseControlNetPipeline",
544
+ "AnimateDiffVideoToVideoControlNetPipeline",
545
+ "AnimateDiffVideoToVideoPipeline",
546
+ "AnyFlowFARPipeline",
547
+ "AnyFlowPipeline",
548
+ "AudioLDM2Pipeline",
549
+ "AudioLDM2ProjectionModel",
550
+ "AudioLDM2UNet2DConditionModel",
551
+ "AudioLDMPipeline",
552
+ "AuraFlowPipeline",
553
+ "BlipDiffusionControlNetPipeline",
554
+ "BlipDiffusionPipeline",
555
+ "BriaFiboEditPipeline",
556
+ "BriaFiboPipeline",
557
+ "BriaPipeline",
558
+ "ChromaImg2ImgPipeline",
559
+ "ChromaInpaintPipeline",
560
+ "ChromaPipeline",
561
+ "ChronoEditPipeline",
562
+ "CLIPImageProjection",
563
+ "CogVideoXFunControlPipeline",
564
+ "CogVideoXImageToVideoPipeline",
565
+ "CogVideoXPipeline",
566
+ "CogVideoXVideoToVideoPipeline",
567
+ "CogView3PlusPipeline",
568
+ "CogView4ControlPipeline",
569
+ "CogView4Pipeline",
570
+ "ConsisIDPipeline",
571
+ "Cosmos2_5_PredictBasePipeline",
572
+ "Cosmos2_5_TransferPipeline",
573
+ "Cosmos2TextToImagePipeline",
574
+ "Cosmos2VideoToWorldPipeline",
575
+ "Cosmos3OmniPipeline",
576
+ "CosmosActionCondition",
577
+ "CosmosTextToWorldPipeline",
578
+ "CosmosVideoToWorldPipeline",
579
+ "CycleDiffusionPipeline",
580
+ "DiffusionGemmaPipeline",
581
+ "DiffusionGemmaPipelineOutput",
582
+ "DreamLiteMobilePipeline",
583
+ "DreamLitePipeline",
584
+ "DreamLitePipelineOutput",
585
+ "EasyAnimateControlPipeline",
586
+ "EasyAnimateInpaintPipeline",
587
+ "EasyAnimatePipeline",
588
+ "ErnieImagePipeline",
589
+ "Flux2KleinInpaintPipeline",
590
+ "Flux2KleinKVPipeline",
591
+ "Flux2KleinPipeline",
592
+ "Flux2Pipeline",
593
+ "FluxControlImg2ImgPipeline",
594
+ "FluxControlInpaintPipeline",
595
+ "FluxControlNetImg2ImgPipeline",
596
+ "FluxControlNetInpaintPipeline",
597
+ "FluxControlNetPipeline",
598
+ "FluxControlPipeline",
599
+ "FluxFillPipeline",
600
+ "FluxImg2ImgPipeline",
601
+ "FluxInpaintPipeline",
602
+ "FluxKontextInpaintPipeline",
603
+ "FluxKontextPipeline",
604
+ "FluxPipeline",
605
+ "FluxPriorReduxPipeline",
606
+ "GlmImagePipeline",
607
+ "HeliosPipeline",
608
+ "HeliosPyramidPipeline",
609
+ "HiDreamImagePipeline",
610
+ "HunyuanDiTControlNetPipeline",
611
+ "HunyuanDiTPAGPipeline",
612
+ "HunyuanDiTPipeline",
613
+ "HunyuanImagePipeline",
614
+ "HunyuanImageRefinerPipeline",
615
+ "HunyuanSkyreelsImageToVideoPipeline",
616
+ "HunyuanVideo15ImageToVideoPipeline",
617
+ "HunyuanVideo15Pipeline",
618
+ "HunyuanVideoFramepackPipeline",
619
+ "HunyuanVideoImageToVideoPipeline",
620
+ "HunyuanVideoPipeline",
621
+ "I2VGenXLPipeline",
622
+ "Ideogram4Pipeline",
623
+ "Ideogram4PromptEnhancerHead",
624
+ "IFImg2ImgPipeline",
625
+ "IFImg2ImgSuperResolutionPipeline",
626
+ "IFInpaintingPipeline",
627
+ "IFInpaintingSuperResolutionPipeline",
628
+ "IFPipeline",
629
+ "IFSuperResolutionPipeline",
630
+ "ImageTextPipelineOutput",
631
+ "JoyImageEditPipeline",
632
+ "JoyImageEditPipelineOutput",
633
+ "Kandinsky3Img2ImgPipeline",
634
+ "Kandinsky3Pipeline",
635
+ "Kandinsky5I2IPipeline",
636
+ "Kandinsky5I2VPipeline",
637
+ "Kandinsky5T2IPipeline",
638
+ "Kandinsky5T2VPipeline",
639
+ "KandinskyCombinedPipeline",
640
+ "KandinskyImg2ImgCombinedPipeline",
641
+ "KandinskyImg2ImgPipeline",
642
+ "KandinskyInpaintCombinedPipeline",
643
+ "KandinskyInpaintPipeline",
644
+ "KandinskyPipeline",
645
+ "KandinskyPriorPipeline",
646
+ "KandinskyV22CombinedPipeline",
647
+ "KandinskyV22ControlnetImg2ImgPipeline",
648
+ "KandinskyV22ControlnetPipeline",
649
+ "KandinskyV22Img2ImgCombinedPipeline",
650
+ "KandinskyV22Img2ImgPipeline",
651
+ "KandinskyV22InpaintCombinedPipeline",
652
+ "KandinskyV22InpaintPipeline",
653
+ "KandinskyV22Pipeline",
654
+ "KandinskyV22PriorEmb2EmbPipeline",
655
+ "KandinskyV22PriorPipeline",
656
+ "Krea2Pipeline",
657
+ "LatentConsistencyModelImg2ImgPipeline",
658
+ "LatentConsistencyModelPipeline",
659
+ "LattePipeline",
660
+ "LDMTextToImagePipeline",
661
+ "LEditsPPPipelineStableDiffusion",
662
+ "LEditsPPPipelineStableDiffusionXL",
663
+ "LLaDA2Pipeline",
664
+ "LLaDA2PipelineOutput",
665
+ "LongCatAudioDiTPipeline",
666
+ "LongCatImageEditPipeline",
667
+ "LongCatImagePipeline",
668
+ "LTX2ConditionPipeline",
669
+ "LTX2HDRPipeline",
670
+ "LTX2ImageToVideoPipeline",
671
+ "LTX2InContextPipeline",
672
+ "LTX2LatentUpsamplePipeline",
673
+ "LTX2Pipeline",
674
+ "LTXConditionPipeline",
675
+ "LTXI2VLongMultiPromptPipeline",
676
+ "LTXImageToVideoPipeline",
677
+ "LTXLatentUpsamplePipeline",
678
+ "LTXPipeline",
679
+ "LucyEditPipeline",
680
+ "Lumina2Pipeline",
681
+ "Lumina2Text2ImgPipeline",
682
+ "LuminaPipeline",
683
+ "LuminaText2ImgPipeline",
684
+ "MarigoldDepthPipeline",
685
+ "MarigoldIntrinsicsPipeline",
686
+ "MarigoldNormalsPipeline",
687
+ "MochiPipeline",
688
+ "MotifVideoImage2VideoPipeline",
689
+ "MotifVideoPipeline",
690
+ "MotifVideoPipelineOutput",
691
+ "MusicLDMPipeline",
692
+ "NucleusMoEImagePipeline",
693
+ "OmniGenPipeline",
694
+ "OvisImagePipeline",
695
+ "PaintByExamplePipeline",
696
+ "PIAPipeline",
697
+ "PixArtAlphaPipeline",
698
+ "PixArtSigmaPAGPipeline",
699
+ "PixArtSigmaPipeline",
700
+ "PRXPipeline",
701
+ "PRXPixelPipeline",
702
+ "QwenImageControlNetInpaintPipeline",
703
+ "QwenImageControlNetPipeline",
704
+ "QwenImageEditInpaintPipeline",
705
+ "QwenImageEditPipeline",
706
+ "QwenImageEditPlusPipeline",
707
+ "QwenImageImg2ImgPipeline",
708
+ "QwenImageInpaintPipeline",
709
+ "QwenImageLayeredPipeline",
710
+ "QwenImagePipeline",
711
+ "ReduxImageEncoder",
712
+ "SanaControlNetPipeline",
713
+ "SanaImageToVideoPipeline",
714
+ "SanaPAGPipeline",
715
+ "SanaPipeline",
716
+ "SanaSprintImg2ImgPipeline",
717
+ "SanaSprintPipeline",
718
+ "SanaVideoPipeline",
719
+ "SanaVideoPipeline",
720
+ "SemanticStableDiffusionPipeline",
721
+ "ShapEImg2ImgPipeline",
722
+ "ShapEPipeline",
723
+ "SkyReelsV2DiffusionForcingImageToVideoPipeline",
724
+ "SkyReelsV2DiffusionForcingPipeline",
725
+ "SkyReelsV2DiffusionForcingVideoToVideoPipeline",
726
+ "SkyReelsV2ImageToVideoPipeline",
727
+ "SkyReelsV2Pipeline",
728
+ "StableAudioPipeline",
729
+ "StableAudioProjectionModel",
730
+ "StableCascadeCombinedPipeline",
731
+ "StableCascadeDecoderPipeline",
732
+ "StableCascadePriorPipeline",
733
+ "StableDiffusion3ControlNetInpaintingPipeline",
734
+ "StableDiffusion3ControlNetPipeline",
735
+ "StableDiffusion3Img2ImgPipeline",
736
+ "StableDiffusion3InpaintPipeline",
737
+ "StableDiffusion3PAGImg2ImgPipeline",
738
+ "StableDiffusion3PAGImg2ImgPipeline",
739
+ "StableDiffusion3PAGPipeline",
740
+ "StableDiffusion3Pipeline",
741
+ "StableDiffusionAdapterPipeline",
742
+ "StableDiffusionAttendAndExcitePipeline",
743
+ "StableDiffusionControlNetImg2ImgPipeline",
744
+ "StableDiffusionControlNetInpaintPipeline",
745
+ "StableDiffusionControlNetPAGInpaintPipeline",
746
+ "StableDiffusionControlNetPAGPipeline",
747
+ "StableDiffusionControlNetPipeline",
748
+ "StableDiffusionControlNetXSPipeline",
749
+ "StableDiffusionDepth2ImgPipeline",
750
+ "StableDiffusionDiffEditPipeline",
751
+ "StableDiffusionGLIGENPipeline",
752
+ "StableDiffusionGLIGENTextImagePipeline",
753
+ "StableDiffusionImageVariationPipeline",
754
+ "StableDiffusionImg2ImgPipeline",
755
+ "StableDiffusionInpaintPipeline",
756
+ "StableDiffusionInpaintPipelineLegacy",
757
+ "StableDiffusionInstructPix2PixPipeline",
758
+ "StableDiffusionLatentUpscalePipeline",
759
+ "StableDiffusionLDM3DPipeline",
760
+ "StableDiffusionModelEditingPipeline",
761
+ "StableDiffusionPAGImg2ImgPipeline",
762
+ "StableDiffusionPAGInpaintPipeline",
763
+ "StableDiffusionPAGPipeline",
764
+ "StableDiffusionPanoramaPipeline",
765
+ "StableDiffusionParadigmsPipeline",
766
+ "StableDiffusionPipeline",
767
+ "StableDiffusionPipelineSafe",
768
+ "StableDiffusionPix2PixZeroPipeline",
769
+ "StableDiffusionSAGPipeline",
770
+ "StableDiffusionUpscalePipeline",
771
+ "StableDiffusionXLAdapterPipeline",
772
+ "StableDiffusionXLControlNetImg2ImgPipeline",
773
+ "StableDiffusionXLControlNetInpaintPipeline",
774
+ "StableDiffusionXLControlNetPAGImg2ImgPipeline",
775
+ "StableDiffusionXLControlNetPAGPipeline",
776
+ "StableDiffusionXLControlNetPipeline",
777
+ "StableDiffusionXLControlNetUnionImg2ImgPipeline",
778
+ "StableDiffusionXLControlNetUnionInpaintPipeline",
779
+ "StableDiffusionXLControlNetUnionPipeline",
780
+ "StableDiffusionXLControlNetXSPipeline",
781
+ "StableDiffusionXLImg2ImgPipeline",
782
+ "StableDiffusionXLInpaintPipeline",
783
+ "StableDiffusionXLInstructPix2PixPipeline",
784
+ "StableDiffusionXLPAGImg2ImgPipeline",
785
+ "StableDiffusionXLPAGInpaintPipeline",
786
+ "StableDiffusionXLPAGPipeline",
787
+ "StableDiffusionXLPipeline",
788
+ "StableUnCLIPImg2ImgPipeline",
789
+ "StableUnCLIPPipeline",
790
+ "StableVideoDiffusionPipeline",
791
+ "TextToVideoSDPipeline",
792
+ "TextToVideoZeroPipeline",
793
+ "TextToVideoZeroSDXLPipeline",
794
+ "UnCLIPImageVariationPipeline",
795
+ "UnCLIPPipeline",
796
+ "UniDiffuserModel",
797
+ "UniDiffuserPipeline",
798
+ "UniDiffuserTextDecoder",
799
+ "VersatileDiffusionDualGuidedPipeline",
800
+ "VersatileDiffusionImageVariationPipeline",
801
+ "VersatileDiffusionPipeline",
802
+ "VersatileDiffusionTextToImagePipeline",
803
+ "VideoToVideoSDPipeline",
804
+ "VisualClozeGenerationPipeline",
805
+ "VisualClozePipeline",
806
+ "VQDiffusionPipeline",
807
+ "WanAnimatePipeline",
808
+ "WanImageToVideoPipeline",
809
+ "WanPipeline",
810
+ "WanVACEPipeline",
811
+ "WanVideoToVideoPipeline",
812
+ "WuerstchenCombinedPipeline",
813
+ "WuerstchenDecoderPipeline",
814
+ "WuerstchenPriorPipeline",
815
+ "ZImageControlNetInpaintPipeline",
816
+ "ZImageControlNetPipeline",
817
+ "ZImageImg2ImgPipeline",
818
+ "ZImageInpaintPipeline",
819
+ "ZImageOmniPipeline",
820
+ "ZImagePipeline",
821
+ ]
822
+ )
823
+
824
+
825
+ try:
826
+ if not (is_torch_available() and is_transformers_available() and is_opencv_available()):
827
+ raise OptionalDependencyNotAvailable()
828
+ except OptionalDependencyNotAvailable:
829
+ from .utils import dummy_torch_and_transformers_and_opencv_objects # noqa F403
830
+
831
+ _import_structure["utils.dummy_torch_and_transformers_and_opencv_objects"] = [
832
+ name for name in dir(dummy_torch_and_transformers_and_opencv_objects) if not name.startswith("_")
833
+ ]
834
+
835
+ else:
836
+ _import_structure["pipelines"].extend(["ConsisIDPipeline"])
837
+
838
+ try:
839
+ if not (is_torch_available() and is_transformers_available() and is_sentencepiece_available()):
840
+ raise OptionalDependencyNotAvailable()
841
+ except OptionalDependencyNotAvailable:
842
+ from .utils import dummy_torch_and_transformers_and_sentencepiece_objects # noqa F403
843
+
844
+ _import_structure["utils.dummy_torch_and_transformers_and_sentencepiece_objects"] = [
845
+ name for name in dir(dummy_torch_and_transformers_and_sentencepiece_objects) if not name.startswith("_")
846
+ ]
847
+
848
+ else:
849
+ _import_structure["pipelines"].extend(["KolorsImg2ImgPipeline", "KolorsPAGPipeline", "KolorsPipeline"])
850
+
851
+ try:
852
+ if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
853
+ raise OptionalDependencyNotAvailable()
854
+ except OptionalDependencyNotAvailable:
855
+ from .utils import dummy_torch_and_transformers_and_onnx_objects # noqa F403
856
+
857
+ _import_structure["utils.dummy_torch_and_transformers_and_onnx_objects"] = [
858
+ name for name in dir(dummy_torch_and_transformers_and_onnx_objects) if not name.startswith("_")
859
+ ]
860
+
861
+ else:
862
+ _import_structure["pipelines"].extend(
863
+ [
864
+ "OnnxStableDiffusionImg2ImgPipeline",
865
+ "OnnxStableDiffusionInpaintPipeline",
866
+ "OnnxStableDiffusionInpaintPipelineLegacy",
867
+ "OnnxStableDiffusionPipeline",
868
+ "OnnxStableDiffusionUpscalePipeline",
869
+ "StableDiffusionOnnxPipeline",
870
+ ]
871
+ )
872
+
873
+ try:
874
+ if not (is_torch_available() and is_librosa_available()):
875
+ raise OptionalDependencyNotAvailable()
876
+ except OptionalDependencyNotAvailable:
877
+ from .utils import dummy_torch_and_librosa_objects # noqa F403
878
+
879
+ _import_structure["utils.dummy_torch_and_librosa_objects"] = [
880
+ name for name in dir(dummy_torch_and_librosa_objects) if not name.startswith("_")
881
+ ]
882
+
883
+ else:
884
+ _import_structure["pipelines"].extend(["AudioDiffusionPipeline", "Mel"])
885
+
886
+ try:
887
+ if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
888
+ raise OptionalDependencyNotAvailable()
889
+ except OptionalDependencyNotAvailable:
890
+ from .utils import dummy_transformers_and_torch_and_note_seq_objects # noqa F403
891
+
892
+ _import_structure["utils.dummy_transformers_and_torch_and_note_seq_objects"] = [
893
+ name for name in dir(dummy_transformers_and_torch_and_note_seq_objects) if not name.startswith("_")
894
+ ]
895
+
896
+
897
+ else:
898
+ _import_structure["pipelines"].extend(["SpectrogramDiffusionPipeline"])
899
+
900
+ try:
901
+ if not is_flax_available():
902
+ raise OptionalDependencyNotAvailable()
903
+ except OptionalDependencyNotAvailable:
904
+ from .utils import dummy_flax_objects # noqa F403
905
+
906
+ _import_structure["utils.dummy_flax_objects"] = [
907
+ name for name in dir(dummy_flax_objects) if not name.startswith("_")
908
+ ]
909
+
910
+
911
+ else:
912
+ _import_structure["models.controlnets.controlnet_flax"] = ["FlaxControlNetModel"]
913
+ _import_structure["models.modeling_flax_utils"] = ["FlaxModelMixin"]
914
+ _import_structure["models.unets.unet_2d_condition_flax"] = ["FlaxUNet2DConditionModel"]
915
+ _import_structure["models.vae_flax"] = ["FlaxAutoencoderKL"]
916
+ _import_structure["schedulers"].extend(
917
+ [
918
+ "FlaxDDIMScheduler",
919
+ "FlaxDDPMScheduler",
920
+ "FlaxDPMSolverMultistepScheduler",
921
+ "FlaxEulerDiscreteScheduler",
922
+ "FlaxKarrasVeScheduler",
923
+ "FlaxLMSDiscreteScheduler",
924
+ "FlaxPNDMScheduler",
925
+ "FlaxSchedulerMixin",
926
+ "FlaxScoreSdeVeScheduler",
927
+ ]
928
+ )
929
+
930
+
931
+ try:
932
+ if not (is_flax_available() and is_transformers_available() and is_transformers_flax_compatible()):
933
+ raise OptionalDependencyNotAvailable()
934
+ except OptionalDependencyNotAvailable:
935
+ from .utils import dummy_flax_and_transformers_objects # noqa F403
936
+
937
+ _import_structure["utils.dummy_flax_and_transformers_objects"] = [
938
+ name for name in dir(dummy_flax_and_transformers_objects) if not name.startswith("_")
939
+ ]
940
+
941
+
942
+ else:
943
+ _import_structure["pipelines"].extend(
944
+ [
945
+ "FlaxDiffusionPipeline",
946
+ "FlaxStableDiffusionControlNetPipeline",
947
+ "FlaxStableDiffusionImg2ImgPipeline",
948
+ "FlaxStableDiffusionInpaintPipeline",
949
+ "FlaxStableDiffusionPipeline",
950
+ "FlaxStableDiffusionXLPipeline",
951
+ ]
952
+ )
953
+
954
+ try:
955
+ if not (is_note_seq_available()):
956
+ raise OptionalDependencyNotAvailable()
957
+ except OptionalDependencyNotAvailable:
958
+ from .utils import dummy_note_seq_objects # noqa F403
959
+
960
+ _import_structure["utils.dummy_note_seq_objects"] = [
961
+ name for name in dir(dummy_note_seq_objects) if not name.startswith("_")
962
+ ]
963
+
964
+
965
+ else:
966
+ _import_structure["pipelines"].extend(["MidiProcessor"])
967
+
968
+ if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
969
+ from .configuration_utils import ConfigMixin
970
+ from .quantizers import PipelineQuantizationConfig
971
+
972
+ try:
973
+ if not is_bitsandbytes_available():
974
+ raise OptionalDependencyNotAvailable()
975
+ except OptionalDependencyNotAvailable:
976
+ from .utils.dummy_bitsandbytes_objects import *
977
+ else:
978
+ from .quantizers.quantization_config import BitsAndBytesConfig
979
+
980
+ try:
981
+ if not is_gguf_available():
982
+ raise OptionalDependencyNotAvailable()
983
+ except OptionalDependencyNotAvailable:
984
+ from .utils.dummy_gguf_objects import *
985
+ else:
986
+ from .quantizers.quantization_config import GGUFQuantizationConfig
987
+
988
+ try:
989
+ if not is_torchao_available():
990
+ raise OptionalDependencyNotAvailable()
991
+ except OptionalDependencyNotAvailable:
992
+ from .utils.dummy_torchao_objects import *
993
+ else:
994
+ from .quantizers.quantization_config import TorchAoConfig
995
+
996
+ try:
997
+ if not is_optimum_quanto_available():
998
+ raise OptionalDependencyNotAvailable()
999
+ except OptionalDependencyNotAvailable:
1000
+ from .utils.dummy_optimum_quanto_objects import *
1001
+ else:
1002
+ from .quantizers.quantization_config import QuantoConfig
1003
+
1004
+ try:
1005
+ if not is_nvidia_modelopt_available():
1006
+ raise OptionalDependencyNotAvailable()
1007
+ except OptionalDependencyNotAvailable:
1008
+ from .utils.dummy_nvidia_modelopt_objects import *
1009
+ else:
1010
+ from .quantizers.quantization_config import NVIDIAModelOptConfig
1011
+
1012
+ try:
1013
+ if not is_auto_round_available():
1014
+ raise OptionalDependencyNotAvailable()
1015
+ except OptionalDependencyNotAvailable:
1016
+ from .utils.dummy_auto_round_objects import *
1017
+ else:
1018
+ from .quantizers.quantization_config import AutoRoundConfig
1019
+
1020
+ try:
1021
+ if not is_onnx_available():
1022
+ raise OptionalDependencyNotAvailable()
1023
+ except OptionalDependencyNotAvailable:
1024
+ from .utils.dummy_onnx_objects import * # noqa F403
1025
+ else:
1026
+ from .pipelines import OnnxRuntimeModel
1027
+
1028
+ try:
1029
+ if not is_torch_available():
1030
+ raise OptionalDependencyNotAvailable()
1031
+ except OptionalDependencyNotAvailable:
1032
+ from .utils.dummy_pt_objects import * # noqa F403
1033
+ else:
1034
+ from .guiders import (
1035
+ AdaptiveProjectedGuidance,
1036
+ AdaptiveProjectedMixGuidance,
1037
+ AutoGuidance,
1038
+ BaseGuidance,
1039
+ ClassifierFreeGuidance,
1040
+ ClassifierFreeZeroStarGuidance,
1041
+ FrequencyDecoupledGuidance,
1042
+ PerturbedAttentionGuidance,
1043
+ SkipLayerGuidance,
1044
+ SmoothedEnergyGuidance,
1045
+ TangentialClassifierFreeGuidance,
1046
+ )
1047
+ from .hooks import (
1048
+ FasterCacheConfig,
1049
+ FirstBlockCacheConfig,
1050
+ HookRegistry,
1051
+ LayerSkipConfig,
1052
+ MagCacheConfig,
1053
+ PyramidAttentionBroadcastConfig,
1054
+ SmoothedEnergyGuidanceConfig,
1055
+ TaylorSeerCacheConfig,
1056
+ TextKVCacheConfig,
1057
+ apply_faster_cache,
1058
+ apply_first_block_cache,
1059
+ apply_layer_skip,
1060
+ apply_mag_cache,
1061
+ apply_pyramid_attention_broadcast,
1062
+ apply_taylorseer_cache,
1063
+ apply_text_kv_cache,
1064
+ )
1065
+ from .image_processor import (
1066
+ InpaintProcessor,
1067
+ IPAdapterMaskProcessor,
1068
+ PixArtImageProcessor,
1069
+ VaeImageProcessor,
1070
+ VaeImageProcessorLDM3D,
1071
+ )
1072
+ from .models import (
1073
+ AceStepTransformer1DModel,
1074
+ AllegroTransformer3DModel,
1075
+ AnimaTextConditioner,
1076
+ AnyFlowFARTransformer3DModel,
1077
+ AnyFlowTransformer3DModel,
1078
+ AsymmetricAutoencoderKL,
1079
+ AttentionBackendName,
1080
+ AuraFlowTransformer2DModel,
1081
+ AutoencoderDC,
1082
+ AutoencoderKL,
1083
+ AutoencoderKLAllegro,
1084
+ AutoencoderKLCogVideoX,
1085
+ AutoencoderKLCosmos,
1086
+ AutoencoderKLFlux2,
1087
+ AutoencoderKLHunyuanImage,
1088
+ AutoencoderKLHunyuanImageRefiner,
1089
+ AutoencoderKLHunyuanVideo,
1090
+ AutoencoderKLHunyuanVideo15,
1091
+ AutoencoderKLKVAE,
1092
+ AutoencoderKLKVAEVideo,
1093
+ AutoencoderKLLTX2Audio,
1094
+ AutoencoderKLLTX2Video,
1095
+ AutoencoderKLLTXVideo,
1096
+ AutoencoderKLMagvit,
1097
+ AutoencoderKLMochi,
1098
+ AutoencoderKLQwenImage,
1099
+ AutoencoderKLTemporalDecoder,
1100
+ AutoencoderKLWan,
1101
+ AutoencoderOobleck,
1102
+ AutoencoderRAE,
1103
+ AutoencoderTiny,
1104
+ AutoencoderVidTok,
1105
+ AutoModel,
1106
+ BriaFiboTransformer2DModel,
1107
+ BriaTransformer2DModel,
1108
+ CacheMixin,
1109
+ ChromaTransformer2DModel,
1110
+ ChronoEditTransformer3DModel,
1111
+ CogVideoXTransformer3DModel,
1112
+ CogView3PlusTransformer2DModel,
1113
+ CogView4Transformer2DModel,
1114
+ ConsisIDTransformer3DModel,
1115
+ ConsistencyDecoderVAE,
1116
+ ContextParallelConfig,
1117
+ ControlNetModel,
1118
+ ControlNetUnionModel,
1119
+ ControlNetXSAdapter,
1120
+ Cosmos3AVAEAudioTokenizer,
1121
+ Cosmos3OmniTransformer,
1122
+ CosmosControlNetModel,
1123
+ CosmosTransformer3DModel,
1124
+ DiTTransformer2DModel,
1125
+ DreamLiteTransformer2DModel,
1126
+ DreamLiteUNetModel,
1127
+ EasyAnimateTransformer3DModel,
1128
+ ErnieImageTransformer2DModel,
1129
+ Flux2Transformer2DModel,
1130
+ FluxControlNetModel,
1131
+ FluxMultiControlNetModel,
1132
+ FluxTransformer2DModel,
1133
+ GlmImageTransformer2DModel,
1134
+ HeliosTransformer3DModel,
1135
+ HiDreamImageTransformer2DModel,
1136
+ HunyuanDiT2DControlNetModel,
1137
+ HunyuanDiT2DModel,
1138
+ HunyuanDiT2DMultiControlNetModel,
1139
+ HunyuanImageTransformer2DModel,
1140
+ HunyuanVideo15Transformer3DModel,
1141
+ HunyuanVideoFramepackTransformer3DModel,
1142
+ HunyuanVideoTransformer3DModel,
1143
+ I2VGenXLUNet,
1144
+ Ideogram4Transformer2DModel,
1145
+ JoyImageEditTransformer3DModel,
1146
+ Kandinsky3UNet,
1147
+ Kandinsky5Transformer3DModel,
1148
+ Krea2Transformer2DModel,
1149
+ LatteTransformer3DModel,
1150
+ LongCatAudioDiTTransformer,
1151
+ LongCatAudioDiTVae,
1152
+ LongCatImageTransformer2DModel,
1153
+ LTX2VideoTransformer3DModel,
1154
+ LTXVideoTransformer3DModel,
1155
+ Lumina2Transformer2DModel,
1156
+ LuminaNextDiT2DModel,
1157
+ MochiTransformer3DModel,
1158
+ ModelMixin,
1159
+ MotifVideoTransformer3DModel,
1160
+ MotionAdapter,
1161
+ MultiAdapter,
1162
+ MultiControlNetModel,
1163
+ NucleusMoEImageTransformer2DModel,
1164
+ OmniGenTransformer2DModel,
1165
+ OvisImageTransformer2DModel,
1166
+ ParallelConfig,
1167
+ PixArtTransformer2DModel,
1168
+ PriorTransformer,
1169
+ PRXTransformer2DModel,
1170
+ QwenImageControlNetModel,
1171
+ QwenImageMultiControlNetModel,
1172
+ QwenImageTransformer2DModel,
1173
+ SanaControlNetModel,
1174
+ SanaTransformer2DModel,
1175
+ SanaVideoTransformer3DModel,
1176
+ SD3ControlNetModel,
1177
+ SD3MultiControlNetModel,
1178
+ SD3Transformer2DModel,
1179
+ SkyReelsV2Transformer3DModel,
1180
+ SparseControlNetModel,
1181
+ StableAudioDiTModel,
1182
+ T2IAdapter,
1183
+ T5FilmDecoder,
1184
+ Transformer2DModel,
1185
+ TransformerTemporalModel,
1186
+ UNet1DModel,
1187
+ UNet2DConditionModel,
1188
+ UNet2DModel,
1189
+ UNet3DConditionModel,
1190
+ UNetControlNetXSModel,
1191
+ UNetMotionModel,
1192
+ UNetSpatioTemporalConditionModel,
1193
+ UVit2DModel,
1194
+ VQModel,
1195
+ WanAnimateTransformer3DModel,
1196
+ WanTransformer3DModel,
1197
+ WanVACETransformer3DModel,
1198
+ ZImageControlNetModel,
1199
+ ZImageTransformer2DModel,
1200
+ attention_backend,
1201
+ )
1202
+ from .modular_pipelines import (
1203
+ AutoPipelineBlocks,
1204
+ ComponentsManager,
1205
+ ComponentSpec,
1206
+ ConditionalPipelineBlocks,
1207
+ ConfigSpec,
1208
+ InputParam,
1209
+ LoopSequentialPipelineBlocks,
1210
+ ModularPipeline,
1211
+ ModularPipelineBlocks,
1212
+ OutputParam,
1213
+ SequentialPipelineBlocks,
1214
+ )
1215
+ from .optimization import (
1216
+ get_constant_schedule,
1217
+ get_constant_schedule_with_warmup,
1218
+ get_cosine_schedule_with_warmup,
1219
+ get_cosine_with_hard_restarts_schedule_with_warmup,
1220
+ get_linear_schedule_with_warmup,
1221
+ get_polynomial_decay_schedule_with_warmup,
1222
+ get_scheduler,
1223
+ )
1224
+ from .pipelines import (
1225
+ AudioPipelineOutput,
1226
+ AutoPipelineForImage2Image,
1227
+ AutoPipelineForInpainting,
1228
+ AutoPipelineForText2Audio,
1229
+ AutoPipelineForText2Image,
1230
+ BlipDiffusionControlNetPipeline,
1231
+ BlipDiffusionPipeline,
1232
+ CLIPImageProjection,
1233
+ ConsistencyModelPipeline,
1234
+ DanceDiffusionPipeline,
1235
+ DDIMPipeline,
1236
+ DDPMPipeline,
1237
+ DiffusionPipeline,
1238
+ DiTPipeline,
1239
+ ImagePipelineOutput,
1240
+ KarrasVePipeline,
1241
+ LDMPipeline,
1242
+ LDMSuperResolutionPipeline,
1243
+ PNDMPipeline,
1244
+ RePaintPipeline,
1245
+ ScoreSdeVePipeline,
1246
+ StableDiffusionMixin,
1247
+ )
1248
+ from .quantizers import DiffusersQuantizer
1249
+ from .schedulers import (
1250
+ AmusedScheduler,
1251
+ BlockRefinementScheduler,
1252
+ BlockRefinementSchedulerOutput,
1253
+ CMStochasticIterativeScheduler,
1254
+ CogVideoXDDIMScheduler,
1255
+ CogVideoXDPMScheduler,
1256
+ DDIMInverseScheduler,
1257
+ DDIMParallelScheduler,
1258
+ DDIMScheduler,
1259
+ DDPMParallelScheduler,
1260
+ DDPMScheduler,
1261
+ DDPMWuerstchenScheduler,
1262
+ DEISMultistepScheduler,
1263
+ DiscreteDDIMScheduler,
1264
+ DiscreteDDIMSchedulerOutput,
1265
+ DPMSolverMultistepInverseScheduler,
1266
+ DPMSolverMultistepScheduler,
1267
+ DPMSolverSinglestepScheduler,
1268
+ EDMDPMSolverMultistepScheduler,
1269
+ EDMEulerScheduler,
1270
+ EntropyBoundScheduler,
1271
+ EntropyBoundSchedulerOutput,
1272
+ EulerAncestralDiscreteScheduler,
1273
+ EulerDiscreteScheduler,
1274
+ FlowMapEulerDiscreteScheduler,
1275
+ FlowMatchEulerDiscreteScheduler,
1276
+ FlowMatchHeunDiscreteScheduler,
1277
+ FlowMatchLCMScheduler,
1278
+ HeliosDMDScheduler,
1279
+ HeliosScheduler,
1280
+ HeunDiscreteScheduler,
1281
+ IPNDMScheduler,
1282
+ KarrasVeScheduler,
1283
+ KDPM2AncestralDiscreteScheduler,
1284
+ KDPM2DiscreteScheduler,
1285
+ LCMScheduler,
1286
+ LTXEulerAncestralRFScheduler,
1287
+ PNDMScheduler,
1288
+ RePaintScheduler,
1289
+ SASolverScheduler,
1290
+ SchedulerMixin,
1291
+ SCMScheduler,
1292
+ ScoreSdeVeScheduler,
1293
+ TCDScheduler,
1294
+ UnCLIPScheduler,
1295
+ UniPCMultistepScheduler,
1296
+ VQDiffusionScheduler,
1297
+ )
1298
+ from .training_utils import EMAModel
1299
+ from .video_processor import VideoProcessor
1300
+
1301
+ try:
1302
+ if not (is_torch_available() and is_scipy_available()):
1303
+ raise OptionalDependencyNotAvailable()
1304
+ except OptionalDependencyNotAvailable:
1305
+ from .utils.dummy_torch_and_scipy_objects import * # noqa F403
1306
+ else:
1307
+ from .schedulers import LMSDiscreteScheduler
1308
+
1309
+ try:
1310
+ if not (is_torch_available() and is_torchsde_available()):
1311
+ raise OptionalDependencyNotAvailable()
1312
+ except OptionalDependencyNotAvailable:
1313
+ from .utils.dummy_torch_and_torchsde_objects import * # noqa F403
1314
+ else:
1315
+ from .schedulers import CosineDPMSolverMultistepScheduler, DPMSolverSDEScheduler
1316
+
1317
+ try:
1318
+ if not (is_torch_available() and is_transformers_available()):
1319
+ raise OptionalDependencyNotAvailable()
1320
+ except OptionalDependencyNotAvailable:
1321
+ from .utils.dummy_torch_and_transformers_objects import * # noqa F403
1322
+ else:
1323
+ from .modular_pipelines import (
1324
+ AnimaAutoBlocks,
1325
+ AnimaModularPipeline,
1326
+ ErnieImageAutoBlocks,
1327
+ ErnieImageModularPipeline,
1328
+ Flux2AutoBlocks,
1329
+ Flux2KleinAutoBlocks,
1330
+ Flux2KleinBaseAutoBlocks,
1331
+ Flux2KleinBaseModularPipeline,
1332
+ Flux2KleinModularPipeline,
1333
+ Flux2ModularPipeline,
1334
+ FluxAutoBlocks,
1335
+ FluxKontextAutoBlocks,
1336
+ FluxKontextModularPipeline,
1337
+ FluxModularPipeline,
1338
+ HeliosAutoBlocks,
1339
+ HeliosModularPipeline,
1340
+ HeliosPyramidAutoBlocks,
1341
+ HeliosPyramidDistilledAutoBlocks,
1342
+ HeliosPyramidDistilledModularPipeline,
1343
+ HeliosPyramidModularPipeline,
1344
+ HunyuanVideo15AutoBlocks,
1345
+ HunyuanVideo15ModularPipeline,
1346
+ Ideogram4AutoBlocks,
1347
+ Ideogram4ModularPipeline,
1348
+ LTXAutoBlocks,
1349
+ LTXModularPipeline,
1350
+ QwenImageAutoBlocks,
1351
+ QwenImageEditAutoBlocks,
1352
+ QwenImageEditModularPipeline,
1353
+ QwenImageEditPlusAutoBlocks,
1354
+ QwenImageEditPlusModularPipeline,
1355
+ QwenImageLayeredAutoBlocks,
1356
+ QwenImageLayeredModularPipeline,
1357
+ QwenImageModularPipeline,
1358
+ StableDiffusion3AutoBlocks,
1359
+ StableDiffusion3ModularPipeline,
1360
+ StableDiffusionXLAutoBlocks,
1361
+ StableDiffusionXLModularPipeline,
1362
+ Wan22Blocks,
1363
+ Wan22Image2VideoBlocks,
1364
+ Wan22Image2VideoModularPipeline,
1365
+ Wan22ModularPipeline,
1366
+ WanBlocks,
1367
+ WanImage2VideoAutoBlocks,
1368
+ WanImage2VideoModularPipeline,
1369
+ WanModularPipeline,
1370
+ ZImageAutoBlocks,
1371
+ ZImageModularPipeline,
1372
+ )
1373
+ from .pipelines import (
1374
+ AceStepAudioTokenDetokenizer,
1375
+ AceStepAudioTokenizer,
1376
+ AceStepConditionEncoder,
1377
+ AceStepPipeline,
1378
+ AllegroPipeline,
1379
+ AltDiffusionImg2ImgPipeline,
1380
+ AltDiffusionPipeline,
1381
+ AmusedImg2ImgPipeline,
1382
+ AmusedInpaintPipeline,
1383
+ AmusedPipeline,
1384
+ AnimateDiffControlNetPipeline,
1385
+ AnimateDiffPAGPipeline,
1386
+ AnimateDiffPipeline,
1387
+ AnimateDiffSDXLPipeline,
1388
+ AnimateDiffSparseControlNetPipeline,
1389
+ AnimateDiffVideoToVideoControlNetPipeline,
1390
+ AnimateDiffVideoToVideoPipeline,
1391
+ AnyFlowFARPipeline,
1392
+ AnyFlowPipeline,
1393
+ AudioLDM2Pipeline,
1394
+ AudioLDM2ProjectionModel,
1395
+ AudioLDM2UNet2DConditionModel,
1396
+ AudioLDMPipeline,
1397
+ AuraFlowPipeline,
1398
+ BriaFiboEditPipeline,
1399
+ BriaFiboPipeline,
1400
+ BriaPipeline,
1401
+ ChromaImg2ImgPipeline,
1402
+ ChromaInpaintPipeline,
1403
+ ChromaPipeline,
1404
+ ChronoEditPipeline,
1405
+ CLIPImageProjection,
1406
+ CogVideoXFunControlPipeline,
1407
+ CogVideoXImageToVideoPipeline,
1408
+ CogVideoXPipeline,
1409
+ CogVideoXVideoToVideoPipeline,
1410
+ CogView3PlusPipeline,
1411
+ CogView4ControlPipeline,
1412
+ CogView4Pipeline,
1413
+ ConsisIDPipeline,
1414
+ Cosmos2_5_PredictBasePipeline,
1415
+ Cosmos2_5_TransferPipeline,
1416
+ Cosmos2TextToImagePipeline,
1417
+ Cosmos2VideoToWorldPipeline,
1418
+ Cosmos3OmniPipeline,
1419
+ CosmosActionCondition,
1420
+ CosmosTextToWorldPipeline,
1421
+ CosmosVideoToWorldPipeline,
1422
+ CycleDiffusionPipeline,
1423
+ DiffusionGemmaPipeline,
1424
+ DiffusionGemmaPipelineOutput,
1425
+ DreamLiteMobilePipeline,
1426
+ DreamLitePipeline,
1427
+ DreamLitePipelineOutput,
1428
+ EasyAnimateControlPipeline,
1429
+ EasyAnimateInpaintPipeline,
1430
+ EasyAnimatePipeline,
1431
+ ErnieImagePipeline,
1432
+ Flux2KleinInpaintPipeline,
1433
+ Flux2KleinKVPipeline,
1434
+ Flux2KleinPipeline,
1435
+ Flux2Pipeline,
1436
+ FluxControlImg2ImgPipeline,
1437
+ FluxControlInpaintPipeline,
1438
+ FluxControlNetImg2ImgPipeline,
1439
+ FluxControlNetInpaintPipeline,
1440
+ FluxControlNetPipeline,
1441
+ FluxControlPipeline,
1442
+ FluxFillPipeline,
1443
+ FluxImg2ImgPipeline,
1444
+ FluxInpaintPipeline,
1445
+ FluxKontextInpaintPipeline,
1446
+ FluxKontextPipeline,
1447
+ FluxPipeline,
1448
+ FluxPriorReduxPipeline,
1449
+ GlmImagePipeline,
1450
+ HeliosPipeline,
1451
+ HeliosPyramidPipeline,
1452
+ HiDreamImagePipeline,
1453
+ HunyuanDiTControlNetPipeline,
1454
+ HunyuanDiTPAGPipeline,
1455
+ HunyuanDiTPipeline,
1456
+ HunyuanImagePipeline,
1457
+ HunyuanImageRefinerPipeline,
1458
+ HunyuanSkyreelsImageToVideoPipeline,
1459
+ HunyuanVideo15ImageToVideoPipeline,
1460
+ HunyuanVideo15Pipeline,
1461
+ HunyuanVideoFramepackPipeline,
1462
+ HunyuanVideoImageToVideoPipeline,
1463
+ HunyuanVideoPipeline,
1464
+ I2VGenXLPipeline,
1465
+ Ideogram4Pipeline,
1466
+ Ideogram4PromptEnhancerHead,
1467
+ IFImg2ImgPipeline,
1468
+ IFImg2ImgSuperResolutionPipeline,
1469
+ IFInpaintingPipeline,
1470
+ IFInpaintingSuperResolutionPipeline,
1471
+ IFPipeline,
1472
+ IFSuperResolutionPipeline,
1473
+ ImageTextPipelineOutput,
1474
+ JoyImageEditPipeline,
1475
+ JoyImageEditPipelineOutput,
1476
+ Kandinsky3Img2ImgPipeline,
1477
+ Kandinsky3Pipeline,
1478
+ Kandinsky5I2IPipeline,
1479
+ Kandinsky5I2VPipeline,
1480
+ Kandinsky5T2IPipeline,
1481
+ Kandinsky5T2VPipeline,
1482
+ KandinskyCombinedPipeline,
1483
+ KandinskyImg2ImgCombinedPipeline,
1484
+ KandinskyImg2ImgPipeline,
1485
+ KandinskyInpaintCombinedPipeline,
1486
+ KandinskyInpaintPipeline,
1487
+ KandinskyPipeline,
1488
+ KandinskyPriorPipeline,
1489
+ KandinskyV22CombinedPipeline,
1490
+ KandinskyV22ControlnetImg2ImgPipeline,
1491
+ KandinskyV22ControlnetPipeline,
1492
+ KandinskyV22Img2ImgCombinedPipeline,
1493
+ KandinskyV22Img2ImgPipeline,
1494
+ KandinskyV22InpaintCombinedPipeline,
1495
+ KandinskyV22InpaintPipeline,
1496
+ KandinskyV22Pipeline,
1497
+ KandinskyV22PriorEmb2EmbPipeline,
1498
+ KandinskyV22PriorPipeline,
1499
+ Krea2Pipeline,
1500
+ LatentConsistencyModelImg2ImgPipeline,
1501
+ LatentConsistencyModelPipeline,
1502
+ LattePipeline,
1503
+ LDMTextToImagePipeline,
1504
+ LEditsPPPipelineStableDiffusion,
1505
+ LEditsPPPipelineStableDiffusionXL,
1506
+ LLaDA2Pipeline,
1507
+ LLaDA2PipelineOutput,
1508
+ LongCatAudioDiTPipeline,
1509
+ LongCatImageEditPipeline,
1510
+ LongCatImagePipeline,
1511
+ LTX2ConditionPipeline,
1512
+ LTX2HDRPipeline,
1513
+ LTX2ImageToVideoPipeline,
1514
+ LTX2InContextPipeline,
1515
+ LTX2LatentUpsamplePipeline,
1516
+ LTX2Pipeline,
1517
+ LTXConditionPipeline,
1518
+ LTXI2VLongMultiPromptPipeline,
1519
+ LTXImageToVideoPipeline,
1520
+ LTXLatentUpsamplePipeline,
1521
+ LTXPipeline,
1522
+ LucyEditPipeline,
1523
+ Lumina2Pipeline,
1524
+ Lumina2Text2ImgPipeline,
1525
+ LuminaPipeline,
1526
+ LuminaText2ImgPipeline,
1527
+ MarigoldDepthPipeline,
1528
+ MarigoldIntrinsicsPipeline,
1529
+ MarigoldNormalsPipeline,
1530
+ MochiPipeline,
1531
+ MotifVideoImage2VideoPipeline,
1532
+ MotifVideoPipeline,
1533
+ MotifVideoPipelineOutput,
1534
+ MusicLDMPipeline,
1535
+ NucleusMoEImagePipeline,
1536
+ OmniGenPipeline,
1537
+ OvisImagePipeline,
1538
+ PaintByExamplePipeline,
1539
+ PIAPipeline,
1540
+ PixArtAlphaPipeline,
1541
+ PixArtSigmaPAGPipeline,
1542
+ PixArtSigmaPipeline,
1543
+ PRXPipeline,
1544
+ PRXPixelPipeline,
1545
+ QwenImageControlNetInpaintPipeline,
1546
+ QwenImageControlNetPipeline,
1547
+ QwenImageEditInpaintPipeline,
1548
+ QwenImageEditPipeline,
1549
+ QwenImageEditPlusPipeline,
1550
+ QwenImageImg2ImgPipeline,
1551
+ QwenImageInpaintPipeline,
1552
+ QwenImageLayeredPipeline,
1553
+ QwenImagePipeline,
1554
+ ReduxImageEncoder,
1555
+ SanaControlNetPipeline,
1556
+ SanaImageToVideoPipeline,
1557
+ SanaPAGPipeline,
1558
+ SanaPipeline,
1559
+ SanaSprintImg2ImgPipeline,
1560
+ SanaSprintPipeline,
1561
+ SanaVideoPipeline,
1562
+ SemanticStableDiffusionPipeline,
1563
+ ShapEImg2ImgPipeline,
1564
+ ShapEPipeline,
1565
+ SkyReelsV2DiffusionForcingImageToVideoPipeline,
1566
+ SkyReelsV2DiffusionForcingPipeline,
1567
+ SkyReelsV2DiffusionForcingVideoToVideoPipeline,
1568
+ SkyReelsV2ImageToVideoPipeline,
1569
+ SkyReelsV2Pipeline,
1570
+ StableAudioPipeline,
1571
+ StableAudioProjectionModel,
1572
+ StableCascadeCombinedPipeline,
1573
+ StableCascadeDecoderPipeline,
1574
+ StableCascadePriorPipeline,
1575
+ StableDiffusion3ControlNetInpaintingPipeline,
1576
+ StableDiffusion3ControlNetPipeline,
1577
+ StableDiffusion3Img2ImgPipeline,
1578
+ StableDiffusion3InpaintPipeline,
1579
+ StableDiffusion3PAGImg2ImgPipeline,
1580
+ StableDiffusion3PAGPipeline,
1581
+ StableDiffusion3Pipeline,
1582
+ StableDiffusionAdapterPipeline,
1583
+ StableDiffusionAttendAndExcitePipeline,
1584
+ StableDiffusionControlNetImg2ImgPipeline,
1585
+ StableDiffusionControlNetInpaintPipeline,
1586
+ StableDiffusionControlNetPAGInpaintPipeline,
1587
+ StableDiffusionControlNetPAGPipeline,
1588
+ StableDiffusionControlNetPipeline,
1589
+ StableDiffusionControlNetXSPipeline,
1590
+ StableDiffusionDepth2ImgPipeline,
1591
+ StableDiffusionDiffEditPipeline,
1592
+ StableDiffusionGLIGENPipeline,
1593
+ StableDiffusionGLIGENTextImagePipeline,
1594
+ StableDiffusionImageVariationPipeline,
1595
+ StableDiffusionImg2ImgPipeline,
1596
+ StableDiffusionInpaintPipeline,
1597
+ StableDiffusionInpaintPipelineLegacy,
1598
+ StableDiffusionInstructPix2PixPipeline,
1599
+ StableDiffusionLatentUpscalePipeline,
1600
+ StableDiffusionLDM3DPipeline,
1601
+ StableDiffusionModelEditingPipeline,
1602
+ StableDiffusionPAGImg2ImgPipeline,
1603
+ StableDiffusionPAGInpaintPipeline,
1604
+ StableDiffusionPAGPipeline,
1605
+ StableDiffusionPanoramaPipeline,
1606
+ StableDiffusionParadigmsPipeline,
1607
+ StableDiffusionPipeline,
1608
+ StableDiffusionPipelineSafe,
1609
+ StableDiffusionPix2PixZeroPipeline,
1610
+ StableDiffusionSAGPipeline,
1611
+ StableDiffusionUpscalePipeline,
1612
+ StableDiffusionXLAdapterPipeline,
1613
+ StableDiffusionXLControlNetImg2ImgPipeline,
1614
+ StableDiffusionXLControlNetInpaintPipeline,
1615
+ StableDiffusionXLControlNetPAGImg2ImgPipeline,
1616
+ StableDiffusionXLControlNetPAGPipeline,
1617
+ StableDiffusionXLControlNetPipeline,
1618
+ StableDiffusionXLControlNetUnionImg2ImgPipeline,
1619
+ StableDiffusionXLControlNetUnionInpaintPipeline,
1620
+ StableDiffusionXLControlNetUnionPipeline,
1621
+ StableDiffusionXLControlNetXSPipeline,
1622
+ StableDiffusionXLImg2ImgPipeline,
1623
+ StableDiffusionXLInpaintPipeline,
1624
+ StableDiffusionXLInstructPix2PixPipeline,
1625
+ StableDiffusionXLPAGImg2ImgPipeline,
1626
+ StableDiffusionXLPAGInpaintPipeline,
1627
+ StableDiffusionXLPAGPipeline,
1628
+ StableDiffusionXLPipeline,
1629
+ StableUnCLIPImg2ImgPipeline,
1630
+ StableUnCLIPPipeline,
1631
+ StableVideoDiffusionPipeline,
1632
+ TextToVideoSDPipeline,
1633
+ TextToVideoZeroPipeline,
1634
+ TextToVideoZeroSDXLPipeline,
1635
+ UnCLIPImageVariationPipeline,
1636
+ UnCLIPPipeline,
1637
+ UniDiffuserModel,
1638
+ UniDiffuserPipeline,
1639
+ UniDiffuserTextDecoder,
1640
+ VersatileDiffusionDualGuidedPipeline,
1641
+ VersatileDiffusionImageVariationPipeline,
1642
+ VersatileDiffusionPipeline,
1643
+ VersatileDiffusionTextToImagePipeline,
1644
+ VideoToVideoSDPipeline,
1645
+ VisualClozeGenerationPipeline,
1646
+ VisualClozePipeline,
1647
+ VQDiffusionPipeline,
1648
+ WanAnimatePipeline,
1649
+ WanImageToVideoPipeline,
1650
+ WanPipeline,
1651
+ WanVACEPipeline,
1652
+ WanVideoToVideoPipeline,
1653
+ WuerstchenCombinedPipeline,
1654
+ WuerstchenDecoderPipeline,
1655
+ WuerstchenPriorPipeline,
1656
+ ZImageControlNetInpaintPipeline,
1657
+ ZImageControlNetPipeline,
1658
+ ZImageImg2ImgPipeline,
1659
+ ZImageInpaintPipeline,
1660
+ ZImageOmniPipeline,
1661
+ ZImagePipeline,
1662
+ )
1663
+
1664
+ try:
1665
+ if not (is_torch_available() and is_transformers_available() and is_sentencepiece_available()):
1666
+ raise OptionalDependencyNotAvailable()
1667
+ except OptionalDependencyNotAvailable:
1668
+ from .utils.dummy_torch_and_transformers_and_sentencepiece_objects import * # noqa F403
1669
+ else:
1670
+ from .pipelines import KolorsImg2ImgPipeline, KolorsPAGPipeline, KolorsPipeline
1671
+
1672
+ try:
1673
+ if not (is_torch_available() and is_transformers_available() and is_opencv_available()):
1674
+ raise OptionalDependencyNotAvailable()
1675
+ except OptionalDependencyNotAvailable:
1676
+ from .utils.dummy_torch_and_transformers_and_opencv_objects import * # noqa F403
1677
+ else:
1678
+ from .pipelines import ConsisIDPipeline
1679
+
1680
+ try:
1681
+ if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
1682
+ raise OptionalDependencyNotAvailable()
1683
+ except OptionalDependencyNotAvailable:
1684
+ from .utils.dummy_torch_and_transformers_and_onnx_objects import * # noqa F403
1685
+ else:
1686
+ from .pipelines import (
1687
+ OnnxStableDiffusionImg2ImgPipeline,
1688
+ OnnxStableDiffusionInpaintPipeline,
1689
+ OnnxStableDiffusionInpaintPipelineLegacy,
1690
+ OnnxStableDiffusionPipeline,
1691
+ OnnxStableDiffusionUpscalePipeline,
1692
+ StableDiffusionOnnxPipeline,
1693
+ )
1694
+
1695
+ try:
1696
+ if not (is_torch_available() and is_librosa_available()):
1697
+ raise OptionalDependencyNotAvailable()
1698
+ except OptionalDependencyNotAvailable:
1699
+ from .utils.dummy_torch_and_librosa_objects import * # noqa F403
1700
+ else:
1701
+ from .pipelines import AudioDiffusionPipeline, Mel
1702
+
1703
+ try:
1704
+ if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
1705
+ raise OptionalDependencyNotAvailable()
1706
+ except OptionalDependencyNotAvailable:
1707
+ from .utils.dummy_transformers_and_torch_and_note_seq_objects import * # noqa F403
1708
+ else:
1709
+ from .pipelines import SpectrogramDiffusionPipeline
1710
+
1711
+ try:
1712
+ if not is_flax_available():
1713
+ raise OptionalDependencyNotAvailable()
1714
+ except OptionalDependencyNotAvailable:
1715
+ from .utils.dummy_flax_objects import * # noqa F403
1716
+ else:
1717
+ from .models.controlnets.controlnet_flax import FlaxControlNetModel
1718
+ from .models.modeling_flax_utils import FlaxModelMixin
1719
+ from .models.unets.unet_2d_condition_flax import FlaxUNet2DConditionModel
1720
+ from .models.vae_flax import FlaxAutoencoderKL
1721
+ from .schedulers import (
1722
+ FlaxDDIMScheduler,
1723
+ FlaxDDPMScheduler,
1724
+ FlaxDPMSolverMultistepScheduler,
1725
+ FlaxEulerDiscreteScheduler,
1726
+ FlaxKarrasVeScheduler,
1727
+ FlaxLMSDiscreteScheduler,
1728
+ FlaxPNDMScheduler,
1729
+ FlaxSchedulerMixin,
1730
+ FlaxScoreSdeVeScheduler,
1731
+ )
1732
+
1733
+ try:
1734
+ if not (is_flax_available() and is_transformers_available() and is_transformers_flax_compatible()):
1735
+ raise OptionalDependencyNotAvailable()
1736
+ except OptionalDependencyNotAvailable:
1737
+ from .utils.dummy_flax_and_transformers_objects import * # noqa F403
1738
+ else:
1739
+ from .pipelines import (
1740
+ FlaxDiffusionPipeline,
1741
+ FlaxStableDiffusionControlNetPipeline,
1742
+ FlaxStableDiffusionImg2ImgPipeline,
1743
+ FlaxStableDiffusionInpaintPipeline,
1744
+ FlaxStableDiffusionPipeline,
1745
+ FlaxStableDiffusionXLPipeline,
1746
+ )
1747
+
1748
+ try:
1749
+ if not (is_note_seq_available()):
1750
+ raise OptionalDependencyNotAvailable()
1751
+ except OptionalDependencyNotAvailable:
1752
+ from .utils.dummy_note_seq_objects import * # noqa F403
1753
+ else:
1754
+ from .pipelines import MidiProcessor
1755
+
1756
+ else:
1757
+ import sys
1758
+
1759
+ sys.modules[__name__] = _LazyModule(
1760
+ __name__,
1761
+ globals()["__file__"],
1762
+ _import_structure,
1763
+ module_spec=__spec__,
1764
+ extra_objects={"__version__": __version__},
1765
+ )
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (55.3 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/callbacks.cpython-311.pyc ADDED
Binary file (11.7 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/configuration_utils.cpython-311.pyc ADDED
Binary file (43.9 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/dependency_versions_check.cpython-311.pyc ADDED
Binary file (1.03 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/dependency_versions_table.cpython-311.pyc ADDED
Binary file (2.42 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/image_processor.cpython-311.pyc ADDED
Binary file (70.1 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/__pycache__/video_processor.cpython-311.pyc ADDED
Binary file (10.2 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/callbacks.py ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any
2
+
3
+ from .configuration_utils import ConfigMixin, register_to_config
4
+ from .utils import CONFIG_NAME
5
+
6
+
7
+ class PipelineCallback(ConfigMixin):
8
+ """
9
+ Base class for all the official callbacks used in a pipeline. This class provides a structure for implementing
10
+ custom callbacks and ensures that all callbacks have a consistent interface.
11
+
12
+ Please implement the following:
13
+ `tensor_inputs`: This should return a list of tensor inputs specific to your callback. You will only be able to
14
+ include
15
+ variables listed in the `._callback_tensor_inputs` attribute of your pipeline class.
16
+ `callback_fn`: This method defines the core functionality of your callback.
17
+ """
18
+
19
+ config_name = CONFIG_NAME
20
+
21
+ @register_to_config
22
+ def __init__(self, cutoff_step_ratio=1.0, cutoff_step_index=None):
23
+ super().__init__()
24
+
25
+ if (cutoff_step_ratio is None and cutoff_step_index is None) or (
26
+ cutoff_step_ratio is not None and cutoff_step_index is not None
27
+ ):
28
+ raise ValueError("Either cutoff_step_ratio or cutoff_step_index should be provided, not both or none.")
29
+
30
+ if cutoff_step_ratio is not None and (
31
+ not isinstance(cutoff_step_ratio, float) or not (0.0 <= cutoff_step_ratio <= 1.0)
32
+ ):
33
+ raise ValueError("cutoff_step_ratio must be a float between 0.0 and 1.0.")
34
+
35
+ @property
36
+ def tensor_inputs(self) -> list[str]:
37
+ raise NotImplementedError(f"You need to set the attribute `tensor_inputs` for {self.__class__}")
38
+
39
+ def callback_fn(self, pipeline, step_index, timesteps, callback_kwargs) -> dict[str, Any]:
40
+ raise NotImplementedError(f"You need to implement the method `callback_fn` for {self.__class__}")
41
+
42
+ def __call__(self, pipeline, step_index, timestep, callback_kwargs) -> dict[str, Any]:
43
+ return self.callback_fn(pipeline, step_index, timestep, callback_kwargs)
44
+
45
+
46
+ class MultiPipelineCallbacks:
47
+ """
48
+ This class is designed to handle multiple pipeline callbacks. It accepts a list of PipelineCallback objects and
49
+ provides a unified interface for calling all of them.
50
+ """
51
+
52
+ def __init__(self, callbacks: list[PipelineCallback]):
53
+ self.callbacks = callbacks
54
+
55
+ @property
56
+ def tensor_inputs(self) -> list[str]:
57
+ return [input for callback in self.callbacks for input in callback.tensor_inputs]
58
+
59
+ def __call__(self, pipeline, step_index, timestep, callback_kwargs) -> dict[str, Any]:
60
+ """
61
+ Calls all the callbacks in order with the given arguments and returns the final callback_kwargs.
62
+ """
63
+ for callback in self.callbacks:
64
+ callback_kwargs = callback(pipeline, step_index, timestep, callback_kwargs)
65
+
66
+ return callback_kwargs
67
+
68
+
69
+ class SDCFGCutoffCallback(PipelineCallback):
70
+ """
71
+ Callback function for Stable Diffusion Pipelines. After certain number of steps (set by `cutoff_step_ratio` or
72
+ `cutoff_step_index`), this callback will disable the CFG.
73
+
74
+ Note: This callback mutates the pipeline by changing the `_guidance_scale` attribute to 0.0 after the cutoff step.
75
+ """
76
+
77
+ tensor_inputs = ["prompt_embeds"]
78
+
79
+ def callback_fn(self, pipeline, step_index, timestep, callback_kwargs) -> dict[str, Any]:
80
+ cutoff_step_ratio = self.config.cutoff_step_ratio
81
+ cutoff_step_index = self.config.cutoff_step_index
82
+
83
+ # Use cutoff_step_index if it's not None, otherwise use cutoff_step_ratio
84
+ cutoff_step = (
85
+ cutoff_step_index if cutoff_step_index is not None else int(pipeline.num_timesteps * cutoff_step_ratio)
86
+ )
87
+
88
+ if step_index == cutoff_step:
89
+ prompt_embeds = callback_kwargs[self.tensor_inputs[0]]
90
+ prompt_embeds = prompt_embeds[-1:] # "-1" denotes the embeddings for conditional text tokens.
91
+
92
+ pipeline._guidance_scale = 0.0
93
+
94
+ callback_kwargs[self.tensor_inputs[0]] = prompt_embeds
95
+ return callback_kwargs
96
+
97
+
98
+ class SDXLCFGCutoffCallback(PipelineCallback):
99
+ """
100
+ Callback function for the base Stable Diffusion XL Pipelines. After certain number of steps (set by
101
+ `cutoff_step_ratio` or `cutoff_step_index`), this callback will disable the CFG.
102
+
103
+ Note: This callback mutates the pipeline by changing the `_guidance_scale` attribute to 0.0 after the cutoff step.
104
+ """
105
+
106
+ tensor_inputs = [
107
+ "prompt_embeds",
108
+ "add_text_embeds",
109
+ "add_time_ids",
110
+ ]
111
+
112
+ def callback_fn(self, pipeline, step_index, timestep, callback_kwargs) -> dict[str, Any]:
113
+ cutoff_step_ratio = self.config.cutoff_step_ratio
114
+ cutoff_step_index = self.config.cutoff_step_index
115
+
116
+ # Use cutoff_step_index if it's not None, otherwise use cutoff_step_ratio
117
+ cutoff_step = (
118
+ cutoff_step_index if cutoff_step_index is not None else int(pipeline.num_timesteps * cutoff_step_ratio)
119
+ )
120
+
121
+ if step_index == cutoff_step:
122
+ prompt_embeds = callback_kwargs[self.tensor_inputs[0]]
123
+ prompt_embeds = prompt_embeds[-1:] # "-1" denotes the embeddings for conditional text tokens.
124
+
125
+ add_text_embeds = callback_kwargs[self.tensor_inputs[1]]
126
+ add_text_embeds = add_text_embeds[-1:] # "-1" denotes the embeddings for conditional pooled text tokens
127
+
128
+ add_time_ids = callback_kwargs[self.tensor_inputs[2]]
129
+ add_time_ids = add_time_ids[-1:] # "-1" denotes the embeddings for conditional added time vector
130
+
131
+ pipeline._guidance_scale = 0.0
132
+
133
+ callback_kwargs[self.tensor_inputs[0]] = prompt_embeds
134
+ callback_kwargs[self.tensor_inputs[1]] = add_text_embeds
135
+ callback_kwargs[self.tensor_inputs[2]] = add_time_ids
136
+
137
+ return callback_kwargs
138
+
139
+
140
+ class SDXLControlnetCFGCutoffCallback(PipelineCallback):
141
+ """
142
+ Callback function for the Controlnet Stable Diffusion XL Pipelines. After certain number of steps (set by
143
+ `cutoff_step_ratio` or `cutoff_step_index`), this callback will disable the CFG.
144
+
145
+ Note: This callback mutates the pipeline by changing the `_guidance_scale` attribute to 0.0 after the cutoff step.
146
+ """
147
+
148
+ tensor_inputs = [
149
+ "prompt_embeds",
150
+ "add_text_embeds",
151
+ "add_time_ids",
152
+ "image",
153
+ ]
154
+
155
+ def callback_fn(self, pipeline, step_index, timestep, callback_kwargs) -> dict[str, Any]:
156
+ cutoff_step_ratio = self.config.cutoff_step_ratio
157
+ cutoff_step_index = self.config.cutoff_step_index
158
+
159
+ # Use cutoff_step_index if it's not None, otherwise use cutoff_step_ratio
160
+ cutoff_step = (
161
+ cutoff_step_index if cutoff_step_index is not None else int(pipeline.num_timesteps * cutoff_step_ratio)
162
+ )
163
+
164
+ if step_index == cutoff_step:
165
+ prompt_embeds = callback_kwargs[self.tensor_inputs[0]]
166
+ prompt_embeds = prompt_embeds[-1:] # "-1" denotes the embeddings for conditional text tokens.
167
+
168
+ add_text_embeds = callback_kwargs[self.tensor_inputs[1]]
169
+ add_text_embeds = add_text_embeds[-1:] # "-1" denotes the embeddings for conditional pooled text tokens
170
+
171
+ add_time_ids = callback_kwargs[self.tensor_inputs[2]]
172
+ add_time_ids = add_time_ids[-1:] # "-1" denotes the embeddings for conditional added time vector
173
+
174
+ # For Controlnet
175
+ image = callback_kwargs[self.tensor_inputs[3]]
176
+ image = image[-1:]
177
+
178
+ pipeline._guidance_scale = 0.0
179
+
180
+ callback_kwargs[self.tensor_inputs[0]] = prompt_embeds
181
+ callback_kwargs[self.tensor_inputs[1]] = add_text_embeds
182
+ callback_kwargs[self.tensor_inputs[2]] = add_time_ids
183
+ callback_kwargs[self.tensor_inputs[3]] = image
184
+
185
+ return callback_kwargs
186
+
187
+
188
+ class IPAdapterScaleCutoffCallback(PipelineCallback):
189
+ """
190
+ Callback function for any pipeline that inherits `IPAdapterMixin`. After certain number of steps (set by
191
+ `cutoff_step_ratio` or `cutoff_step_index`), this callback will set the IP Adapter scale to `0.0`.
192
+
193
+ Note: This callback mutates the IP Adapter attention processors by setting the scale to 0.0 after the cutoff step.
194
+ """
195
+
196
+ tensor_inputs = []
197
+
198
+ def callback_fn(self, pipeline, step_index, timestep, callback_kwargs) -> dict[str, Any]:
199
+ cutoff_step_ratio = self.config.cutoff_step_ratio
200
+ cutoff_step_index = self.config.cutoff_step_index
201
+
202
+ # Use cutoff_step_index if it's not None, otherwise use cutoff_step_ratio
203
+ cutoff_step = (
204
+ cutoff_step_index if cutoff_step_index is not None else int(pipeline.num_timesteps * cutoff_step_ratio)
205
+ )
206
+
207
+ if step_index == cutoff_step:
208
+ pipeline.set_ip_adapter_scale(0.0)
209
+ return callback_kwargs
210
+
211
+
212
+ class SD3CFGCutoffCallback(PipelineCallback):
213
+ """
214
+ Callback function for Stable Diffusion 3 Pipelines. After certain number of steps (set by `cutoff_step_ratio` or
215
+ `cutoff_step_index`), this callback will disable the CFG.
216
+
217
+ Note: This callback mutates the pipeline by changing the `_guidance_scale` attribute to 0.0 after the cutoff step.
218
+ """
219
+
220
+ tensor_inputs = ["prompt_embeds", "pooled_prompt_embeds"]
221
+
222
+ def callback_fn(self, pipeline, step_index, timestep, callback_kwargs) -> dict[str, Any]:
223
+ cutoff_step_ratio = self.config.cutoff_step_ratio
224
+ cutoff_step_index = self.config.cutoff_step_index
225
+
226
+ # Use cutoff_step_index if it's not None, otherwise use cutoff_step_ratio
227
+ cutoff_step = (
228
+ cutoff_step_index if cutoff_step_index is not None else int(pipeline.num_timesteps * cutoff_step_ratio)
229
+ )
230
+
231
+ if step_index == cutoff_step:
232
+ prompt_embeds = callback_kwargs[self.tensor_inputs[0]]
233
+ prompt_embeds = prompt_embeds[-1:] # "-1" denotes the embeddings for conditional text tokens.
234
+
235
+ pooled_prompt_embeds = callback_kwargs[self.tensor_inputs[1]]
236
+ pooled_prompt_embeds = pooled_prompt_embeds[
237
+ -1:
238
+ ] # "-1" denotes the embeddings for conditional pooled text tokens.
239
+
240
+ pipeline._guidance_scale = 0.0
241
+
242
+ callback_kwargs[self.tensor_inputs[0]] = prompt_embeds
243
+ callback_kwargs[self.tensor_inputs[1]] = pooled_prompt_embeds
244
+ return callback_kwargs
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/commands/__init__.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from abc import ABC, abstractmethod
16
+ from argparse import ArgumentParser
17
+
18
+
19
+ class BaseDiffusersCLICommand(ABC):
20
+ @staticmethod
21
+ @abstractmethod
22
+ def register_subcommand(parser: ArgumentParser):
23
+ raise NotImplementedError()
24
+
25
+ @abstractmethod
26
+ def run(self):
27
+ raise NotImplementedError()
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/commands/custom_blocks.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """
16
+ Usage example:
17
+ TODO
18
+ """
19
+
20
+ import ast
21
+ import importlib.util
22
+ import os
23
+ from argparse import ArgumentParser, Namespace
24
+ from pathlib import Path
25
+
26
+ from ..utils import logging
27
+ from . import BaseDiffusersCLICommand
28
+
29
+
30
+ EXPECTED_PARENT_CLASSES = ["ModularPipelineBlocks"]
31
+ CONFIG = "config.json"
32
+
33
+
34
+ def conversion_command_factory(args: Namespace):
35
+ return CustomBlocksCommand(args.block_module_name, args.block_class_name)
36
+
37
+
38
+ class CustomBlocksCommand(BaseDiffusersCLICommand):
39
+ @staticmethod
40
+ def register_subcommand(parser: ArgumentParser):
41
+ conversion_parser = parser.add_parser("custom_blocks")
42
+ conversion_parser.add_argument(
43
+ "--block_module_name",
44
+ type=str,
45
+ default="block.py",
46
+ help="Module filename in which the custom block will be implemented.",
47
+ )
48
+ conversion_parser.add_argument(
49
+ "--block_class_name",
50
+ type=str,
51
+ default=None,
52
+ help="Name of the custom block. If provided None, we will try to infer it.",
53
+ )
54
+ conversion_parser.set_defaults(func=conversion_command_factory)
55
+
56
+ def __init__(self, block_module_name: str = "block.py", block_class_name: str = None):
57
+ self.logger = logging.get_logger("diffusers-cli/custom_blocks")
58
+ self.block_module_name = Path(block_module_name)
59
+ self.block_class_name = block_class_name
60
+
61
+ def run(self):
62
+ # determine the block to be saved.
63
+ out = self._get_class_names(self.block_module_name)
64
+ classes_found = list({cls for cls, _ in out})
65
+
66
+ if self.block_class_name is not None:
67
+ child_class, parent_class = self._choose_block(out, self.block_class_name)
68
+ if child_class is None and parent_class is None:
69
+ raise ValueError(
70
+ "`block_class_name` could not be retrieved. Available classes from "
71
+ f"{self.block_module_name}:\n{classes_found}"
72
+ )
73
+ else:
74
+ self.logger.info(
75
+ f"Found classes: {classes_found} will be using {classes_found[0]}. "
76
+ "If this needs to be changed, re-run the command specifying `block_class_name`."
77
+ )
78
+ child_class, parent_class = out[0][0], out[0][1]
79
+
80
+ # dynamically get the custom block and initialize it to call `save_pretrained` in the current directory.
81
+ # the user is responsible for running it, so I guess that is safe?
82
+ module_name = f"__dynamic__{self.block_module_name.stem}"
83
+ spec = importlib.util.spec_from_file_location(module_name, str(self.block_module_name))
84
+ module = importlib.util.module_from_spec(spec)
85
+ spec.loader.exec_module(module)
86
+ getattr(module, child_class)().save_pretrained(os.getcwd())
87
+
88
+ # or, we could create it manually.
89
+ # automap = self._create_automap(parent_class=parent_class, child_class=child_class)
90
+ # with open(CONFIG, "w") as f:
91
+ # json.dump(automap, f)
92
+
93
+ def _choose_block(self, candidates, chosen=None):
94
+ for cls, base in candidates:
95
+ if cls == chosen:
96
+ return cls, base
97
+ return None, None
98
+
99
+ def _get_class_names(self, file_path):
100
+ source = file_path.read_text(encoding="utf-8")
101
+ try:
102
+ tree = ast.parse(source, filename=file_path)
103
+ except SyntaxError as e:
104
+ raise ValueError(f"Could not parse {file_path!r}: {e}") from e
105
+
106
+ results: list[tuple[str, str]] = []
107
+ for node in tree.body:
108
+ if not isinstance(node, ast.ClassDef):
109
+ continue
110
+
111
+ # extract all base names for this class
112
+ base_names = [bname for b in node.bases if (bname := self._get_base_name(b)) is not None]
113
+
114
+ # for each allowed base that appears in the class's bases, emit a tuple
115
+ for allowed in EXPECTED_PARENT_CLASSES:
116
+ if allowed in base_names:
117
+ results.append((node.name, allowed))
118
+
119
+ return results
120
+
121
+ def _get_base_name(self, node: ast.expr):
122
+ if isinstance(node, ast.Name):
123
+ return node.id
124
+ elif isinstance(node, ast.Attribute):
125
+ val = self._get_base_name(node.value)
126
+ return f"{val}.{node.attr}" if val else node.attr
127
+ return None
128
+
129
+ def _create_automap(self, parent_class, child_class):
130
+ module = str(self.block_module_name).replace(".py", "").rsplit(".", 1)[-1]
131
+ auto_map = {f"{parent_class}": f"{module}.{child_class}"}
132
+ return {"auto_map": auto_map}
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/commands/diffusers_cli.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # Copyright 2026 The HuggingFace Team. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from argparse import ArgumentParser
17
+
18
+ from .custom_blocks import CustomBlocksCommand
19
+ from .env import EnvironmentCommand
20
+ from .fp16_safetensors import FP16SafetensorsCommand
21
+
22
+
23
+ def main():
24
+ parser = ArgumentParser("Diffusers CLI tool", usage="diffusers-cli <command> [<args>]")
25
+ commands_parser = parser.add_subparsers(help="diffusers-cli command helpers")
26
+
27
+ # Register commands
28
+ EnvironmentCommand.register_subcommand(commands_parser)
29
+ FP16SafetensorsCommand.register_subcommand(commands_parser)
30
+ CustomBlocksCommand.register_subcommand(commands_parser)
31
+
32
+ # Let's go
33
+ args = parser.parse_args()
34
+
35
+ if not hasattr(args, "func"):
36
+ parser.print_help()
37
+ exit(1)
38
+
39
+ # Run
40
+ service = args.func(args)
41
+ service.run()
42
+
43
+
44
+ if __name__ == "__main__":
45
+ main()
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/commands/env.py ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import importlib.metadata
16
+ import platform
17
+ import subprocess
18
+ from argparse import ArgumentParser
19
+
20
+ import huggingface_hub
21
+
22
+ from .. import __version__ as version
23
+ from ..utils import (
24
+ is_accelerate_available,
25
+ is_bitsandbytes_available,
26
+ is_flax_available,
27
+ is_gguf_available,
28
+ is_google_colab,
29
+ is_nvidia_modelopt_available,
30
+ is_optimum_quanto_available,
31
+ is_peft_available,
32
+ is_safetensors_available,
33
+ is_torch_available,
34
+ is_torchao_available,
35
+ is_transformers_available,
36
+ is_xformers_available,
37
+ )
38
+ from . import BaseDiffusersCLICommand
39
+
40
+
41
+ # (display name, availability_fn, pypi distribution name for importlib.metadata.version)
42
+ _QUANTIZATION_BACKENDS = (
43
+ ("bitsandbytes", is_bitsandbytes_available, "bitsandbytes"),
44
+ ("gguf", is_gguf_available, "gguf"),
45
+ ("optimum-quanto", is_optimum_quanto_available, "optimum-quanto"),
46
+ ("torchao", is_torchao_available, "torchao"),
47
+ ("nvidia-modelopt", is_nvidia_modelopt_available, "nvidia-modelopt"),
48
+ )
49
+
50
+
51
+ def info_command_factory(_):
52
+ return EnvironmentCommand()
53
+
54
+
55
+ class EnvironmentCommand(BaseDiffusersCLICommand):
56
+ @staticmethod
57
+ def register_subcommand(parser: ArgumentParser) -> None:
58
+ download_parser = parser.add_parser("env")
59
+ download_parser.set_defaults(func=info_command_factory)
60
+
61
+ def run(self) -> dict:
62
+ hub_version = huggingface_hub.__version__
63
+
64
+ safetensors_version = "not installed"
65
+ if is_safetensors_available():
66
+ import safetensors
67
+
68
+ safetensors_version = safetensors.__version__
69
+
70
+ pt_version = "not installed"
71
+ pt_cuda_available = "NA"
72
+ if is_torch_available():
73
+ import torch
74
+
75
+ pt_version = torch.__version__
76
+ pt_cuda_available = torch.cuda.is_available()
77
+
78
+ flax_version = "not installed"
79
+ jax_version = "not installed"
80
+ jaxlib_version = "not installed"
81
+ jax_backend = "NA"
82
+ if is_flax_available():
83
+ import flax
84
+ import jax
85
+ import jaxlib
86
+
87
+ flax_version = flax.__version__
88
+ jax_version = jax.__version__
89
+ jaxlib_version = jaxlib.__version__
90
+ jax_backend = jax.lib.xla_bridge.get_backend().platform
91
+
92
+ transformers_version = "not installed"
93
+ if is_transformers_available():
94
+ import transformers
95
+
96
+ transformers_version = transformers.__version__
97
+
98
+ accelerate_version = "not installed"
99
+ if is_accelerate_available():
100
+ import accelerate
101
+
102
+ accelerate_version = accelerate.__version__
103
+
104
+ peft_version = "not installed"
105
+ if is_peft_available():
106
+ import peft
107
+
108
+ peft_version = peft.__version__
109
+
110
+ quantization_versions = {}
111
+ for backend_name, is_available_fn, dist_name in _QUANTIZATION_BACKENDS:
112
+ if not is_available_fn():
113
+ continue
114
+ try:
115
+ quantization_versions[backend_name] = importlib.metadata.version(dist_name)
116
+ except importlib.metadata.PackageNotFoundError:
117
+ quantization_versions[backend_name] = "N/A"
118
+
119
+ xformers_version = "not installed"
120
+ if is_xformers_available():
121
+ import xformers
122
+
123
+ xformers_version = xformers.__version__
124
+
125
+ platform_info = platform.platform()
126
+
127
+ is_google_colab_str = "Yes" if is_google_colab() else "No"
128
+
129
+ accelerator = "NA"
130
+ if platform.system() in {"Linux", "Windows"}:
131
+ try:
132
+ sp = subprocess.Popen(
133
+ ["nvidia-smi", "--query-gpu=gpu_name,memory.total", "--format=csv,noheader"],
134
+ stdout=subprocess.PIPE,
135
+ stderr=subprocess.PIPE,
136
+ )
137
+ out_str, _ = sp.communicate()
138
+ out_str = out_str.decode("utf-8")
139
+
140
+ if len(out_str) > 0:
141
+ accelerator = out_str.strip()
142
+ except FileNotFoundError:
143
+ pass
144
+ elif platform.system() == "Darwin": # Mac OS
145
+ try:
146
+ sp = subprocess.Popen(
147
+ ["system_profiler", "SPDisplaysDataType"],
148
+ stdout=subprocess.PIPE,
149
+ stderr=subprocess.PIPE,
150
+ )
151
+ out_str, _ = sp.communicate()
152
+ out_str = out_str.decode("utf-8")
153
+
154
+ start = out_str.find("Chipset Model:")
155
+ if start != -1:
156
+ start += len("Chipset Model:")
157
+ end = out_str.find("\n", start)
158
+ accelerator = out_str[start:end].strip()
159
+
160
+ start = out_str.find("VRAM (Total):")
161
+ if start != -1:
162
+ start += len("VRAM (Total):")
163
+ end = out_str.find("\n", start)
164
+ accelerator += " VRAM: " + out_str[start:end].strip()
165
+ except FileNotFoundError:
166
+ pass
167
+ else:
168
+ print("It seems you are running an unusual OS. Could you fill in the accelerator manually?")
169
+
170
+ info = {
171
+ "🤗 Diffusers version": version,
172
+ "Platform": platform_info,
173
+ "Running on Google Colab?": is_google_colab_str,
174
+ "Python version": platform.python_version(),
175
+ "PyTorch version (GPU?)": f"{pt_version} ({pt_cuda_available})",
176
+ "Flax version (CPU?/GPU?/TPU?)": f"{flax_version} ({jax_backend})",
177
+ "Jax version": jax_version,
178
+ "JaxLib version": jaxlib_version,
179
+ "Huggingface_hub version": hub_version,
180
+ "Transformers version": transformers_version,
181
+ "Accelerate version": accelerate_version,
182
+ "PEFT version": peft_version,
183
+ **{f"{name} version": ver for name, ver in quantization_versions.items()},
184
+ "Safetensors version": safetensors_version,
185
+ "xFormers version": xformers_version,
186
+ "Accelerator": accelerator,
187
+ "Using GPU in script?": "<fill in>",
188
+ "Using distributed or parallel set-up in script?": "<fill in>",
189
+ }
190
+
191
+ print("\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n")
192
+ print(self.format_dict(info))
193
+
194
+ return info
195
+
196
+ @staticmethod
197
+ def format_dict(d: dict) -> str:
198
+ return "\n".join([f"- {prop}: {val}" for prop, val in d.items()]) + "\n"
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/commands/fp16_safetensors.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """
16
+ Usage example:
17
+ diffusers-cli fp16_safetensors --ckpt_id=openai/shap-e --fp16 --use_safetensors
18
+ """
19
+
20
+ import glob
21
+ import json
22
+ import warnings
23
+ from argparse import ArgumentParser, Namespace
24
+ from importlib import import_module
25
+
26
+ import huggingface_hub
27
+ import torch
28
+ from huggingface_hub import hf_hub_download
29
+ from packaging import version
30
+
31
+ from ..utils import logging
32
+ from . import BaseDiffusersCLICommand
33
+
34
+
35
+ def conversion_command_factory(args: Namespace):
36
+ if args.use_auth_token:
37
+ warnings.warn(
38
+ "The `--use_auth_token` flag is deprecated and will be removed in a future version."
39
+ "Authentication is now handled automatically if the user is logged in."
40
+ )
41
+ return FP16SafetensorsCommand(args.ckpt_id, args.fp16, args.use_safetensors)
42
+
43
+
44
+ class FP16SafetensorsCommand(BaseDiffusersCLICommand):
45
+ @staticmethod
46
+ def register_subcommand(parser: ArgumentParser):
47
+ conversion_parser = parser.add_parser("fp16_safetensors")
48
+ conversion_parser.add_argument(
49
+ "--ckpt_id",
50
+ type=str,
51
+ help="Repo id of the checkpoints on which to run the conversion. Example: 'openai/shap-e'.",
52
+ )
53
+ conversion_parser.add_argument(
54
+ "--fp16", action="store_true", help="If serializing the variables in FP16 precision."
55
+ )
56
+ conversion_parser.add_argument(
57
+ "--use_safetensors", action="store_true", help="If serializing in the safetensors format."
58
+ )
59
+ conversion_parser.add_argument(
60
+ "--use_auth_token",
61
+ action="store_true",
62
+ help="When working with checkpoints having private visibility. When used `hf auth login` needs to be run beforehand.",
63
+ )
64
+ conversion_parser.set_defaults(func=conversion_command_factory)
65
+
66
+ def __init__(self, ckpt_id: str, fp16: bool, use_safetensors: bool):
67
+ self.logger = logging.get_logger("diffusers-cli/fp16_safetensors")
68
+ self.ckpt_id = ckpt_id
69
+ self.local_ckpt_dir = f"/tmp/{ckpt_id}"
70
+ self.fp16 = fp16
71
+
72
+ self.use_safetensors = use_safetensors
73
+
74
+ if not self.use_safetensors and not self.fp16:
75
+ raise NotImplementedError(
76
+ "When `use_safetensors` and `fp16` both are False, then this command is of no use."
77
+ )
78
+
79
+ def run(self):
80
+ if version.parse(huggingface_hub.__version__) < version.parse("0.9.0"):
81
+ raise ImportError(
82
+ "The huggingface_hub version must be >= 0.9.0 to use this command. Please update your huggingface_hub"
83
+ " installation."
84
+ )
85
+ else:
86
+ from huggingface_hub import create_commit
87
+ from huggingface_hub._commit_api import CommitOperationAdd
88
+
89
+ model_index = hf_hub_download(repo_id=self.ckpt_id, filename="model_index.json")
90
+ with open(model_index, "r") as f:
91
+ pipeline_class_name = json.load(f)["_class_name"]
92
+ pipeline_class = getattr(import_module("diffusers"), pipeline_class_name)
93
+ self.logger.info(f"Pipeline class imported: {pipeline_class_name}.")
94
+
95
+ # Load the appropriate pipeline. We could have used `DiffusionPipeline`
96
+ # here, but just to avoid potential edge cases.
97
+ pipeline = pipeline_class.from_pretrained(
98
+ self.ckpt_id, torch_dtype=torch.float16 if self.fp16 else torch.float32
99
+ )
100
+ pipeline.save_pretrained(
101
+ self.local_ckpt_dir,
102
+ safe_serialization=True if self.use_safetensors else False,
103
+ variant="fp16" if self.fp16 else None,
104
+ )
105
+ self.logger.info(f"Pipeline locally saved to {self.local_ckpt_dir}.")
106
+
107
+ # Fetch all the paths.
108
+ if self.fp16:
109
+ modified_paths = glob.glob(f"{self.local_ckpt_dir}/*/*.fp16.*")
110
+ elif self.use_safetensors:
111
+ modified_paths = glob.glob(f"{self.local_ckpt_dir}/*/*.safetensors")
112
+
113
+ # Prepare for the PR.
114
+ commit_message = f"Serialize variables with FP16: {self.fp16} and safetensors: {self.use_safetensors}."
115
+ operations = []
116
+ for path in modified_paths:
117
+ operations.append(CommitOperationAdd(path_in_repo="/".join(path.split("/")[4:]), path_or_fileobj=path))
118
+
119
+ # Open the PR.
120
+ commit_description = (
121
+ "Variables converted by the [`diffusers`' `fp16_safetensors`"
122
+ " CLI](https://github.com/huggingface/diffusers/blob/main/src/diffusers/commands/fp16_safetensors.py)."
123
+ )
124
+ hub_pr_url = create_commit(
125
+ repo_id=self.ckpt_id,
126
+ operations=operations,
127
+ commit_message=commit_message,
128
+ commit_description=commit_description,
129
+ repo_type="model",
130
+ create_pr=True,
131
+ ).pr_url
132
+ self.logger.info(f"PR created here: {hub_pr_url}.")
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/configuration_utils.py ADDED
@@ -0,0 +1,805 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2025 The HuggingFace Inc. team.
3
+ # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ """ConfigMixin base class and utilities."""
17
+
18
+ import dataclasses
19
+ import functools
20
+ import importlib
21
+ import inspect
22
+ import json
23
+ import os
24
+ import re
25
+ from collections import OrderedDict
26
+ from pathlib import Path
27
+ from typing import Any
28
+
29
+ import numpy as np
30
+ from huggingface_hub import DDUFEntry, create_repo, hf_hub_download
31
+ from huggingface_hub.utils import (
32
+ EntryNotFoundError,
33
+ HfHubHTTPError,
34
+ RepositoryNotFoundError,
35
+ RevisionNotFoundError,
36
+ validate_hf_hub_args,
37
+ )
38
+ from typing_extensions import Self
39
+
40
+ from . import __version__
41
+ from .utils import (
42
+ HUGGINGFACE_CO_RESOLVE_ENDPOINT,
43
+ DummyObject,
44
+ deprecate,
45
+ extract_commit_hash,
46
+ http_user_agent,
47
+ logging,
48
+ )
49
+
50
+
51
+ logger = logging.get_logger(__name__)
52
+
53
+ _re_configuration_file = re.compile(r"config\.(.*)\.json")
54
+
55
+
56
+ class FrozenDict(OrderedDict):
57
+ def __init__(self, *args, **kwargs):
58
+ super().__init__(*args, **kwargs)
59
+
60
+ for key, value in self.items():
61
+ setattr(self, key, value)
62
+
63
+ self.__frozen = True
64
+
65
+ def __delitem__(self, *args, **kwargs):
66
+ raise Exception(f"You cannot use ``__delitem__`` on a {self.__class__.__name__} instance.")
67
+
68
+ def setdefault(self, *args, **kwargs):
69
+ raise Exception(f"You cannot use ``setdefault`` on a {self.__class__.__name__} instance.")
70
+
71
+ def pop(self, *args, **kwargs):
72
+ raise Exception(f"You cannot use ``pop`` on a {self.__class__.__name__} instance.")
73
+
74
+ def update(self, *args, **kwargs):
75
+ raise Exception(f"You cannot use ``update`` on a {self.__class__.__name__} instance.")
76
+
77
+ def __setattr__(self, name, value):
78
+ if hasattr(self, "__frozen") and self.__frozen:
79
+ raise Exception(f"You cannot use ``__setattr__`` on a {self.__class__.__name__} instance.")
80
+ super().__setattr__(name, value)
81
+
82
+ def __setitem__(self, name, value):
83
+ if hasattr(self, "__frozen") and self.__frozen:
84
+ raise Exception(f"You cannot use ``__setattr__`` on a {self.__class__.__name__} instance.")
85
+ super().__setitem__(name, value)
86
+
87
+
88
+ class ConfigMixin:
89
+ r"""
90
+ Base class for all configuration classes. All configuration parameters are stored under `self.config`. Also
91
+ provides the [`~ConfigMixin.from_config`] and [`~ConfigMixin.save_config`] methods for loading, downloading, and
92
+ saving classes that inherit from [`ConfigMixin`].
93
+
94
+ Class attributes:
95
+ - **config_name** (`str`) -- A filename under which the config should stored when calling
96
+ [`~ConfigMixin.save_config`] (should be overridden by parent class).
97
+ - **ignore_for_config** (`list[str]`) -- A list of attributes that should not be saved in the config (should be
98
+ overridden by subclass).
99
+ - **has_compatibles** (`bool`) -- Whether the class has compatible classes (should be overridden by subclass).
100
+ - **_deprecated_kwargs** (`list[str]`) -- Keyword arguments that are deprecated. Note that the `init` function
101
+ should only have a `kwargs` argument if at least one argument is deprecated (should be overridden by
102
+ subclass).
103
+ """
104
+
105
+ config_name = None
106
+ ignore_for_config = []
107
+ has_compatibles = False
108
+
109
+ _deprecated_kwargs = []
110
+ _auto_class = None
111
+
112
+ @classmethod
113
+ def register_for_auto_class(cls, auto_class="AutoModel"):
114
+ """
115
+ Register this class with the given auto class so that it can be loaded with `AutoModel.from_pretrained(...,
116
+ trust_remote_code=True)`.
117
+
118
+ When the config is saved, the resulting `config.json` will include an `auto_map` entry mapping the auto class
119
+ to this class's module and class name.
120
+
121
+ Args:
122
+ auto_class (`str` or type, *optional*, defaults to `"AutoModel"`):
123
+ The auto class to register this class with. Can be a string (e.g. `"AutoModel"`) or the class itself.
124
+ Currently only `"AutoModel"` is supported.
125
+
126
+ Example:
127
+
128
+ ```python
129
+ from diffusers import ModelMixin, ConfigMixin
130
+
131
+
132
+ class MyCustomModel(ModelMixin, ConfigMixin): ...
133
+
134
+
135
+ MyCustomModel.register_for_auto_class("AutoModel")
136
+ ```
137
+ """
138
+ if auto_class != "AutoModel":
139
+ raise ValueError(f"Only 'AutoModel' is supported, got '{auto_class}'.")
140
+
141
+ cls._auto_class = auto_class
142
+
143
+ def register_to_config(self, **kwargs):
144
+ if self.config_name is None:
145
+ raise NotImplementedError(f"Make sure that {self.__class__} has defined a class name `config_name`")
146
+ # Special case for `kwargs` used in deprecation warning added to schedulers
147
+ # TODO: remove this when we remove the deprecation warning, and the `kwargs` argument,
148
+ # or solve in a more general way.
149
+ kwargs.pop("kwargs", None)
150
+
151
+ if not hasattr(self, "_internal_dict"):
152
+ internal_dict = kwargs
153
+ else:
154
+ previous_dict = dict(self._internal_dict)
155
+ internal_dict = {**self._internal_dict, **kwargs}
156
+ logger.debug(f"Updating config from {previous_dict} to {internal_dict}")
157
+
158
+ self._internal_dict = FrozenDict(internal_dict)
159
+
160
+ def __getattr__(self, name: str) -> Any:
161
+ """The only reason we overwrite `getattr` here is to gracefully deprecate accessing
162
+ config attributes directly. See https://github.com/huggingface/diffusers/pull/3129
163
+
164
+ This function is mostly copied from PyTorch's __getattr__ overwrite:
165
+ https://pytorch.org/docs/stable/_modules/torch/nn/modules/module.html#Module
166
+ """
167
+
168
+ is_in_config = "_internal_dict" in self.__dict__ and hasattr(self.__dict__["_internal_dict"], name)
169
+ is_attribute = name in self.__dict__
170
+
171
+ if is_in_config and not is_attribute:
172
+ deprecation_message = f"Accessing config attribute `{name}` directly via '{type(self).__name__}' object attribute is deprecated. Please access '{name}' over '{type(self).__name__}'s config object instead, e.g. 'scheduler.config.{name}'."
173
+ deprecate("direct config name access", "1.0.0", deprecation_message, standard_warn=False)
174
+ return self._internal_dict[name]
175
+
176
+ raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
177
+
178
+ def save_config(self, save_directory: str | os.PathLike, push_to_hub: bool = False, **kwargs):
179
+ """
180
+ Save a configuration object to the directory specified in `save_directory` so that it can be reloaded using the
181
+ [`~ConfigMixin.from_config`] class method.
182
+
183
+ Args:
184
+ save_directory (`str` or `os.PathLike`):
185
+ Directory where the configuration JSON file is saved (will be created if it does not exist).
186
+ push_to_hub (`bool`, *optional*, defaults to `False`):
187
+ Whether or not to push your model to the Hugging Face Hub after saving it. You can specify the
188
+ repository you want to push to with `repo_id` (will default to the name of `save_directory` in your
189
+ namespace).
190
+ kwargs (`dict[str, Any]`, *optional*):
191
+ Additional keyword arguments passed along to the [`~utils.PushToHubMixin.push_to_hub`] method.
192
+ """
193
+ if os.path.isfile(save_directory):
194
+ raise AssertionError(f"Provided path ({save_directory}) should be a directory, not a file")
195
+
196
+ os.makedirs(save_directory, exist_ok=True)
197
+
198
+ # If we save using the predefined names, we can load using `from_config`
199
+ output_config_file = os.path.join(save_directory, self.config_name)
200
+
201
+ self.to_json_file(output_config_file)
202
+ logger.info(f"Configuration saved in {output_config_file}")
203
+
204
+ if push_to_hub:
205
+ commit_message = kwargs.pop("commit_message", None)
206
+ private = kwargs.pop("private", None)
207
+ create_pr = kwargs.pop("create_pr", False)
208
+ token = kwargs.pop("token", None)
209
+ repo_id = kwargs.pop("repo_id", save_directory.split(os.path.sep)[-1])
210
+ repo_id = create_repo(repo_id, exist_ok=True, private=private, token=token).repo_id
211
+ subfolder = kwargs.pop("subfolder", None)
212
+
213
+ self._upload_folder(
214
+ save_directory,
215
+ repo_id,
216
+ token=token,
217
+ commit_message=commit_message,
218
+ create_pr=create_pr,
219
+ subfolder=subfolder,
220
+ )
221
+
222
+ @classmethod
223
+ def from_config(
224
+ cls, config: FrozenDict | dict[str, Any] = None, return_unused_kwargs=False, **kwargs
225
+ ) -> Self | tuple[Self, dict[str, Any]]:
226
+ r"""
227
+ Instantiate a Python class from a config dictionary.
228
+
229
+ Parameters:
230
+ config (`dict[str, Any]`):
231
+ A config dictionary from which the Python class is instantiated. Make sure to only load configuration
232
+ files of compatible classes.
233
+ return_unused_kwargs (`bool`, *optional*, defaults to `False`):
234
+ Whether kwargs that are not consumed by the Python class should be returned or not.
235
+ kwargs (remaining dictionary of keyword arguments, *optional*):
236
+ Can be used to update the configuration object (after it is loaded) and initiate the Python class.
237
+ `**kwargs` are passed directly to the underlying scheduler/model's `__init__` method and eventually
238
+ overwrite the same named arguments in `config`.
239
+
240
+ Returns:
241
+ [`ModelMixin`] or [`SchedulerMixin`]:
242
+ A model or scheduler object instantiated from a config dictionary.
243
+
244
+ Examples:
245
+
246
+ ```python
247
+ >>> from diffusers import DDPMScheduler, DDIMScheduler, PNDMScheduler
248
+
249
+ >>> # Download scheduler from huggingface.co and cache.
250
+ >>> scheduler = DDPMScheduler.from_pretrained("google/ddpm-cifar10-32")
251
+
252
+ >>> # Instantiate DDIM scheduler class with same config as DDPM
253
+ >>> scheduler = DDIMScheduler.from_config(scheduler.config)
254
+
255
+ >>> # Instantiate PNDM scheduler class with same config as DDPM
256
+ >>> scheduler = PNDMScheduler.from_config(scheduler.config)
257
+ ```
258
+ """
259
+ # <===== TO BE REMOVED WITH DEPRECATION
260
+ # TODO(Patrick) - make sure to remove the following lines when config=="model_path" is deprecated
261
+ if "pretrained_model_name_or_path" in kwargs:
262
+ config = kwargs.pop("pretrained_model_name_or_path")
263
+
264
+ if config is None:
265
+ raise ValueError("Please make sure to provide a config as the first positional argument.")
266
+ # ======>
267
+
268
+ if not isinstance(config, dict):
269
+ deprecation_message = "It is deprecated to pass a pretrained model name or path to `from_config`."
270
+ if "Scheduler" in cls.__name__:
271
+ deprecation_message += (
272
+ f"If you were trying to load a scheduler, please use {cls}.from_pretrained(...) instead."
273
+ " Otherwise, please make sure to pass a configuration dictionary instead. This functionality will"
274
+ " be removed in v1.0.0."
275
+ )
276
+ elif "Model" in cls.__name__:
277
+ deprecation_message += (
278
+ f"If you were trying to load a model, please use {cls}.load_config(...) followed by"
279
+ f" {cls}.from_config(...) instead. Otherwise, please make sure to pass a configuration dictionary"
280
+ " instead. This functionality will be removed in v1.0.0."
281
+ )
282
+ deprecate("config-passed-as-path", "1.0.0", deprecation_message, standard_warn=False)
283
+ config, kwargs = cls.load_config(pretrained_model_name_or_path=config, return_unused_kwargs=True, **kwargs)
284
+
285
+ init_dict, unused_kwargs, hidden_dict = cls.extract_init_dict(config, **kwargs)
286
+
287
+ # Allow dtype to be specified on initialization
288
+ if "dtype" in unused_kwargs:
289
+ init_dict["dtype"] = unused_kwargs.pop("dtype")
290
+
291
+ # add possible deprecated kwargs
292
+ for deprecated_kwarg in cls._deprecated_kwargs:
293
+ if deprecated_kwarg in unused_kwargs:
294
+ init_dict[deprecated_kwarg] = unused_kwargs.pop(deprecated_kwarg)
295
+
296
+ # Return model and optionally state and/or unused_kwargs
297
+ model = cls(**init_dict)
298
+
299
+ # make sure to also save config parameters that might be used for compatible classes
300
+ # update _class_name
301
+ if "_class_name" in hidden_dict:
302
+ hidden_dict["_class_name"] = cls.__name__
303
+
304
+ model.register_to_config(**hidden_dict)
305
+
306
+ # add hidden kwargs of compatible classes to unused_kwargs
307
+ unused_kwargs = {**unused_kwargs, **hidden_dict}
308
+
309
+ if return_unused_kwargs:
310
+ return (model, unused_kwargs)
311
+ else:
312
+ return model
313
+
314
+ @classmethod
315
+ def get_config_dict(cls, *args, **kwargs):
316
+ deprecation_message = (
317
+ f" The function get_config_dict is deprecated. Please use {cls}.load_config instead. This function will be"
318
+ " removed in version v1.0.0"
319
+ )
320
+ deprecate("get_config_dict", "1.0.0", deprecation_message, standard_warn=False)
321
+ return cls.load_config(*args, **kwargs)
322
+
323
+ @classmethod
324
+ @validate_hf_hub_args
325
+ def load_config(
326
+ cls,
327
+ pretrained_model_name_or_path: str | os.PathLike,
328
+ return_unused_kwargs=False,
329
+ return_commit_hash=False,
330
+ **kwargs,
331
+ ) -> tuple[dict[str, Any], dict[str, Any]]:
332
+ r"""
333
+ Load a model or scheduler configuration.
334
+
335
+ Parameters:
336
+ pretrained_model_name_or_path (`str` or `os.PathLike`, *optional*):
337
+ Can be either:
338
+
339
+ - A string, the *model id* (for example `google/ddpm-celebahq-256`) of a pretrained model hosted on
340
+ the Hub.
341
+ - A path to a *directory* (for example `./my_model_directory`) containing model weights saved with
342
+ [`~ConfigMixin.save_config`].
343
+
344
+ cache_dir (`str | os.PathLike`, *optional*):
345
+ Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
346
+ is not used.
347
+ force_download (`bool`, *optional*, defaults to `False`):
348
+ Whether or not to force the (re-)download of the model weights and configuration files, overriding the
349
+ cached versions if they exist.
350
+ proxies (`dict[str, str]`, *optional*):
351
+ A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
352
+ 'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
353
+ output_loading_info(`bool`, *optional*, defaults to `False`):
354
+ Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages.
355
+ local_files_only (`bool`, *optional*, defaults to `False`):
356
+ Whether to only load local model weights and configuration files or not. If set to `True`, the model
357
+ won't be downloaded from the Hub.
358
+ token (`str` or *bool*, *optional*):
359
+ The token to use as HTTP bearer authorization for remote files. If `True`, the token generated from
360
+ `diffusers-cli login` (stored in `~/.huggingface`) is used.
361
+ revision (`str`, *optional*, defaults to `"main"`):
362
+ The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
363
+ allowed by Git.
364
+ subfolder (`str`, *optional*, defaults to `""`):
365
+ The subfolder location of a model file within a larger model repository on the Hub or locally.
366
+ return_unused_kwargs (`bool`, *optional*, defaults to `False):
367
+ Whether unused keyword arguments of the config are returned.
368
+ return_commit_hash (`bool`, *optional*, defaults to `False):
369
+ Whether the `commit_hash` of the loaded configuration are returned.
370
+
371
+ Returns:
372
+ `dict`:
373
+ A dictionary of all the parameters stored in a JSON configuration file.
374
+
375
+ """
376
+ cache_dir = kwargs.pop("cache_dir", None)
377
+ local_dir = kwargs.pop("local_dir", None)
378
+ local_dir_use_symlinks = kwargs.pop("local_dir_use_symlinks", "auto")
379
+ force_download = kwargs.pop("force_download", False)
380
+ proxies = kwargs.pop("proxies", None)
381
+ token = kwargs.pop("token", None)
382
+ local_files_only = kwargs.pop("local_files_only", False)
383
+ revision = kwargs.pop("revision", None)
384
+ _ = kwargs.pop("mirror", None)
385
+ subfolder = kwargs.pop("subfolder", None)
386
+ user_agent = kwargs.pop("user_agent", {})
387
+ dduf_entries: dict[str, DDUFEntry] | None = kwargs.pop("dduf_entries", None)
388
+
389
+ user_agent = {**user_agent, "file_type": "config"}
390
+ user_agent = http_user_agent(user_agent)
391
+
392
+ pretrained_model_name_or_path = str(pretrained_model_name_or_path)
393
+
394
+ if cls.config_name is None:
395
+ raise ValueError(
396
+ "`self.config_name` is not defined. Note that one should not load a config from "
397
+ "`ConfigMixin`. Please make sure to define `config_name` in a class inheriting from `ConfigMixin`"
398
+ )
399
+ # Custom path for now
400
+ if dduf_entries:
401
+ if subfolder is not None:
402
+ raise ValueError(
403
+ "DDUF file only allow for 1 level of directory (e.g transformer/model1/model.safetentors is not allowed). "
404
+ "Please check the DDUF structure"
405
+ )
406
+ config_file = cls._get_config_file_from_dduf(pretrained_model_name_or_path, dduf_entries)
407
+ elif os.path.isfile(pretrained_model_name_or_path):
408
+ config_file = pretrained_model_name_or_path
409
+ elif os.path.isdir(pretrained_model_name_or_path):
410
+ if subfolder is not None and os.path.isfile(
411
+ os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name)
412
+ ):
413
+ config_file = os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name)
414
+ elif os.path.isfile(os.path.join(pretrained_model_name_or_path, cls.config_name)):
415
+ # Load from a PyTorch checkpoint
416
+ config_file = os.path.join(pretrained_model_name_or_path, cls.config_name)
417
+ else:
418
+ raise EnvironmentError(
419
+ f"Error no file named {cls.config_name} found in directory {pretrained_model_name_or_path}."
420
+ )
421
+ else:
422
+ try:
423
+ # Load from URL or cache if already cached
424
+ config_file = hf_hub_download(
425
+ pretrained_model_name_or_path,
426
+ filename=cls.config_name,
427
+ cache_dir=cache_dir,
428
+ force_download=force_download,
429
+ proxies=proxies,
430
+ local_files_only=local_files_only,
431
+ token=token,
432
+ user_agent=user_agent,
433
+ subfolder=subfolder,
434
+ revision=revision,
435
+ local_dir=local_dir,
436
+ local_dir_use_symlinks=local_dir_use_symlinks,
437
+ )
438
+ except RepositoryNotFoundError:
439
+ raise EnvironmentError(
440
+ f"{pretrained_model_name_or_path} is not a local folder and is not a valid model identifier"
441
+ " listed on 'https://huggingface.co/models'\nIf this is a private repository, make sure to pass a"
442
+ " token having permission to this repo with `token` or log in with `hf auth login`."
443
+ )
444
+ except RevisionNotFoundError:
445
+ raise EnvironmentError(
446
+ f"{revision} is not a valid git identifier (branch name, tag name or commit id) that exists for"
447
+ " this model name. Check the model page at"
448
+ f" 'https://huggingface.co/{pretrained_model_name_or_path}' for available revisions."
449
+ )
450
+ except EntryNotFoundError:
451
+ raise EnvironmentError(
452
+ f"{pretrained_model_name_or_path} does not appear to have a file named {cls.config_name}."
453
+ )
454
+ except HfHubHTTPError as err:
455
+ raise EnvironmentError(
456
+ "There was a specific connection error when trying to load"
457
+ f" {pretrained_model_name_or_path}:\n{err}"
458
+ )
459
+ except ValueError:
460
+ raise EnvironmentError(
461
+ f"We couldn't connect to '{HUGGINGFACE_CO_RESOLVE_ENDPOINT}' to load this model, couldn't find it"
462
+ f" in the cached files and it looks like {pretrained_model_name_or_path} is not the path to a"
463
+ f" directory containing a {cls.config_name} file.\nCheckout your internet connection or see how to"
464
+ " run the library in offline mode at"
465
+ " 'https://huggingface.co/docs/diffusers/installation#offline-mode'."
466
+ )
467
+ except EnvironmentError:
468
+ raise EnvironmentError(
469
+ f"Can't load config for '{pretrained_model_name_or_path}'. If you were trying to load it from "
470
+ "'https://huggingface.co/models', make sure you don't have a local directory with the same name. "
471
+ f"Otherwise, make sure '{pretrained_model_name_or_path}' is the correct path to a directory "
472
+ f"containing a {cls.config_name} file"
473
+ )
474
+ try:
475
+ config_dict = cls._dict_from_json_file(config_file, dduf_entries=dduf_entries)
476
+
477
+ commit_hash = extract_commit_hash(config_file)
478
+ except (json.JSONDecodeError, UnicodeDecodeError):
479
+ raise EnvironmentError(f"It looks like the config file at '{config_file}' is not a valid JSON file.")
480
+
481
+ if not (return_unused_kwargs or return_commit_hash):
482
+ return config_dict
483
+
484
+ outputs = (config_dict,)
485
+
486
+ if return_unused_kwargs:
487
+ outputs += (kwargs,)
488
+
489
+ if return_commit_hash:
490
+ outputs += (commit_hash,)
491
+
492
+ return outputs
493
+
494
+ @staticmethod
495
+ def _get_init_keys(input_class):
496
+ return set(dict(inspect.signature(input_class.__init__).parameters).keys())
497
+
498
+ @classmethod
499
+ def extract_init_dict(cls, config_dict, **kwargs):
500
+ # Skip keys that were not present in the original config, so default __init__ values were used
501
+ used_defaults = config_dict.get("_use_default_values", [])
502
+ config_dict = {k: v for k, v in config_dict.items() if k not in used_defaults and k != "_use_default_values"}
503
+
504
+ # 0. Copy origin config dict
505
+ original_dict = dict(config_dict.items())
506
+
507
+ # 1. Retrieve expected config attributes from __init__ signature
508
+ expected_keys = cls._get_init_keys(cls)
509
+ expected_keys.remove("self")
510
+ # remove general kwargs if present in dict
511
+ if "kwargs" in expected_keys:
512
+ expected_keys.remove("kwargs")
513
+ # remove flax internal keys
514
+ if hasattr(cls, "_flax_internal_args"):
515
+ for arg in cls._flax_internal_args:
516
+ expected_keys.remove(arg)
517
+
518
+ # 2. Remove attributes that cannot be expected from expected config attributes
519
+ # remove keys to be ignored
520
+ if len(cls.ignore_for_config) > 0:
521
+ expected_keys = expected_keys - set(cls.ignore_for_config)
522
+
523
+ # load diffusers library to import compatible and original scheduler
524
+ diffusers_library = importlib.import_module(__name__.split(".")[0])
525
+
526
+ if cls.has_compatibles:
527
+ compatible_classes = [c for c in cls._get_compatibles() if not isinstance(c, DummyObject)]
528
+ else:
529
+ compatible_classes = []
530
+
531
+ expected_keys_comp_cls = set()
532
+ for c in compatible_classes:
533
+ expected_keys_c = cls._get_init_keys(c)
534
+ expected_keys_comp_cls = expected_keys_comp_cls.union(expected_keys_c)
535
+ expected_keys_comp_cls = expected_keys_comp_cls - cls._get_init_keys(cls)
536
+ config_dict = {k: v for k, v in config_dict.items() if k not in expected_keys_comp_cls}
537
+
538
+ # remove attributes from orig class that cannot be expected
539
+ orig_cls_name = config_dict.pop("_class_name", cls.__name__)
540
+ if (
541
+ isinstance(orig_cls_name, str)
542
+ and orig_cls_name != cls.__name__
543
+ and hasattr(diffusers_library, orig_cls_name)
544
+ ):
545
+ orig_cls = getattr(diffusers_library, orig_cls_name)
546
+ unexpected_keys_from_orig = cls._get_init_keys(orig_cls) - expected_keys
547
+ config_dict = {k: v for k, v in config_dict.items() if k not in unexpected_keys_from_orig}
548
+ elif not isinstance(orig_cls_name, str) and not isinstance(orig_cls_name, (list, tuple)):
549
+ raise ValueError(
550
+ "Make sure that the `_class_name` is of type string or list of string (for custom pipelines)."
551
+ )
552
+
553
+ # remove private attributes
554
+ config_dict = {k: v for k, v in config_dict.items() if not k.startswith("_")}
555
+
556
+ # remove quantization_config
557
+ config_dict = {k: v for k, v in config_dict.items() if k != "quantization_config"}
558
+
559
+ # 3. Create keyword arguments that will be passed to __init__ from expected keyword arguments
560
+ init_dict = {}
561
+ for key in expected_keys:
562
+ # if config param is passed to kwarg and is present in config dict
563
+ # it should overwrite existing config dict key
564
+ if key in kwargs and key in config_dict:
565
+ config_dict[key] = kwargs.pop(key)
566
+
567
+ if key in kwargs:
568
+ # overwrite key
569
+ init_dict[key] = kwargs.pop(key)
570
+ elif key in config_dict:
571
+ # use value from config dict
572
+ init_dict[key] = config_dict.pop(key)
573
+
574
+ # 4. Give nice warning if unexpected values have been passed
575
+ if len(config_dict) > 0:
576
+ logger.warning(
577
+ f"The config attributes {config_dict} were passed to {cls.__name__}, "
578
+ "but are not expected and will be ignored. Please verify your "
579
+ f"{cls.config_name} configuration file."
580
+ )
581
+
582
+ # 5. Give nice info if config attributes are initialized to default because they have not been passed
583
+ passed_keys = set(init_dict.keys())
584
+ if len(expected_keys - passed_keys) > 0:
585
+ logger.info(
586
+ f"{expected_keys - passed_keys} was not found in config. Values will be initialized to default values."
587
+ )
588
+
589
+ # 6. Define unused keyword arguments
590
+ unused_kwargs = {**config_dict, **kwargs}
591
+
592
+ # 7. Define "hidden" config parameters that were saved for compatible classes
593
+ hidden_config_dict = {k: v for k, v in original_dict.items() if k not in init_dict}
594
+
595
+ return init_dict, unused_kwargs, hidden_config_dict
596
+
597
+ @classmethod
598
+ def _dict_from_json_file(cls, json_file: str | os.PathLike, dduf_entries: dict[str, DDUFEntry] | None = None):
599
+ if dduf_entries:
600
+ text = dduf_entries[json_file].read_text()
601
+ else:
602
+ with open(json_file, "r", encoding="utf-8") as reader:
603
+ text = reader.read()
604
+ return json.loads(text)
605
+
606
+ def __repr__(self):
607
+ return f"{self.__class__.__name__} {self.to_json_string()}"
608
+
609
+ @property
610
+ def config(self) -> dict[str, Any]:
611
+ """
612
+ Returns the config of the class as a frozen dictionary
613
+
614
+ Returns:
615
+ `dict[str, Any]`: Config of the class.
616
+ """
617
+ return self._internal_dict
618
+
619
+ def to_json_string(self) -> str:
620
+ """
621
+ Serializes the configuration instance to a JSON string.
622
+
623
+ Returns:
624
+ `str`:
625
+ String containing all the attributes that make up the configuration instance in JSON format.
626
+ """
627
+ config_dict = self._internal_dict if hasattr(self, "_internal_dict") else {}
628
+ config_dict["_class_name"] = self.__class__.__name__
629
+ config_dict["_diffusers_version"] = __version__
630
+
631
+ def to_json_saveable(value):
632
+ if isinstance(value, np.ndarray):
633
+ value = value.tolist()
634
+ elif isinstance(value, Path):
635
+ value = value.as_posix()
636
+ elif hasattr(value, "to_dict") and callable(value.to_dict):
637
+ value = value.to_dict()
638
+ elif isinstance(value, list):
639
+ value = [to_json_saveable(v) for v in value]
640
+ return value
641
+
642
+ if "quantization_config" in config_dict:
643
+ config_dict["quantization_config"] = (
644
+ config_dict.quantization_config.to_dict()
645
+ if not isinstance(config_dict.quantization_config, dict)
646
+ else config_dict.quantization_config
647
+ )
648
+
649
+ config_dict = {k: to_json_saveable(v) for k, v in config_dict.items()}
650
+ # Don't save "_ignore_files" or "_use_default_values"
651
+ config_dict.pop("_ignore_files", None)
652
+ config_dict.pop("_use_default_values", None)
653
+ # pop the `_pre_quantization_dtype` as torch.dtypes are not serializable.
654
+ _ = config_dict.pop("_pre_quantization_dtype", None)
655
+
656
+ if getattr(self, "_auto_class", None) is not None:
657
+ module = self.__class__.__module__.split(".")[-1]
658
+ auto_map = config_dict.get("auto_map", {})
659
+ auto_map[self._auto_class] = f"{module}.{self.__class__.__name__}"
660
+ config_dict["auto_map"] = auto_map
661
+
662
+ return json.dumps(config_dict, indent=2, sort_keys=True) + "\n"
663
+
664
+ def to_json_file(self, json_file_path: str | os.PathLike):
665
+ """
666
+ Save the configuration instance's parameters to a JSON file.
667
+
668
+ Args:
669
+ json_file_path (`str` or `os.PathLike`):
670
+ Path to the JSON file to save a configuration instance's parameters.
671
+ """
672
+ with open(json_file_path, "w", encoding="utf-8") as writer:
673
+ writer.write(self.to_json_string())
674
+
675
+ @classmethod
676
+ def _get_config_file_from_dduf(cls, pretrained_model_name_or_path: str, dduf_entries: dict[str, DDUFEntry]):
677
+ # paths inside a DDUF file must always be "/"
678
+ config_file = (
679
+ cls.config_name
680
+ if pretrained_model_name_or_path == ""
681
+ else "/".join([pretrained_model_name_or_path, cls.config_name])
682
+ )
683
+ if config_file not in dduf_entries:
684
+ raise ValueError(
685
+ f"We did not manage to find the file {config_file} in the dduf file. We only have the following files {dduf_entries.keys()}"
686
+ )
687
+ return config_file
688
+
689
+
690
+ def register_to_config(init):
691
+ r"""
692
+ Decorator to apply on the init of classes inheriting from [`ConfigMixin`] so that all the arguments are
693
+ automatically sent to `self.register_for_config`. To ignore a specific argument accepted by the init but that
694
+ shouldn't be registered in the config, use the `ignore_for_config` class variable
695
+
696
+ Warning: Once decorated, all private arguments (beginning with an underscore) are trashed and not sent to the init!
697
+ """
698
+
699
+ @functools.wraps(init)
700
+ def inner_init(self, *args, **kwargs):
701
+ # Ignore private kwargs in the init.
702
+ init_kwargs = {k: v for k, v in kwargs.items() if not k.startswith("_")}
703
+ config_init_kwargs = {k: v for k, v in kwargs.items() if k.startswith("_")}
704
+ if not isinstance(self, ConfigMixin):
705
+ raise RuntimeError(
706
+ f"`@register_for_config` was applied to {self.__class__.__name__} init method, but this class does "
707
+ "not inherit from `ConfigMixin`."
708
+ )
709
+
710
+ ignore = getattr(self, "ignore_for_config", [])
711
+ # Get positional arguments aligned with kwargs
712
+ new_kwargs = {}
713
+ signature = inspect.signature(init)
714
+ parameters = {
715
+ name: p.default for i, (name, p) in enumerate(signature.parameters.items()) if i > 0 and name not in ignore
716
+ }
717
+ for arg, name in zip(args, parameters.keys()):
718
+ new_kwargs[name] = arg
719
+
720
+ # Then add all kwargs
721
+ new_kwargs.update(
722
+ {
723
+ k: init_kwargs.get(k, default)
724
+ for k, default in parameters.items()
725
+ if k not in ignore and k not in new_kwargs
726
+ }
727
+ )
728
+
729
+ # Take note of the parameters that were not present in the loaded config
730
+ if len(set(new_kwargs.keys()) - set(init_kwargs)) > 0:
731
+ new_kwargs["_use_default_values"] = list(set(new_kwargs.keys()) - set(init_kwargs))
732
+
733
+ new_kwargs = {**config_init_kwargs, **new_kwargs}
734
+ getattr(self, "register_to_config")(**new_kwargs)
735
+ init(self, *args, **init_kwargs)
736
+
737
+ return inner_init
738
+
739
+
740
+ def flax_register_to_config(cls):
741
+ original_init = cls.__init__
742
+
743
+ @functools.wraps(original_init)
744
+ def init(self, *args, **kwargs):
745
+ if not isinstance(self, ConfigMixin):
746
+ raise RuntimeError(
747
+ f"`@register_for_config` was applied to {self.__class__.__name__} init method, but this class does "
748
+ "not inherit from `ConfigMixin`."
749
+ )
750
+
751
+ # Ignore private kwargs in the init. Retrieve all passed attributes
752
+ init_kwargs = dict(kwargs.items())
753
+
754
+ # Retrieve default values
755
+ fields = dataclasses.fields(self)
756
+ default_kwargs = {}
757
+ for field in fields:
758
+ # ignore flax specific attributes
759
+ if field.name in self._flax_internal_args:
760
+ continue
761
+ if type(field.default) == dataclasses._MISSING_TYPE:
762
+ default_kwargs[field.name] = None
763
+ else:
764
+ default_kwargs[field.name] = getattr(self, field.name)
765
+
766
+ # Make sure init_kwargs override default kwargs
767
+ new_kwargs = {**default_kwargs, **init_kwargs}
768
+ # dtype should be part of `init_kwargs`, but not `new_kwargs`
769
+ if "dtype" in new_kwargs:
770
+ new_kwargs.pop("dtype")
771
+
772
+ # Get positional arguments aligned with kwargs
773
+ for i, arg in enumerate(args):
774
+ name = fields[i].name
775
+ new_kwargs[name] = arg
776
+
777
+ # Take note of the parameters that were not present in the loaded config
778
+ if len(set(new_kwargs.keys()) - set(init_kwargs)) > 0:
779
+ new_kwargs["_use_default_values"] = list(set(new_kwargs.keys()) - set(init_kwargs))
780
+
781
+ getattr(self, "register_to_config")(**new_kwargs)
782
+ original_init(self, *args, **kwargs)
783
+
784
+ cls.__init__ = init
785
+ return cls
786
+
787
+
788
+ class LegacyConfigMixin(ConfigMixin):
789
+ r"""
790
+ A subclass of `ConfigMixin` to resolve class mapping from legacy classes (like `Transformer2DModel`) to more
791
+ pipeline-specific classes (like `DiTTransformer2DModel`).
792
+ """
793
+
794
+ @classmethod
795
+ def from_config(cls, config: FrozenDict | dict[str, Any] = None, return_unused_kwargs=False, **kwargs):
796
+ # To prevent dependency import problem.
797
+ from .models.model_loading_utils import _fetch_remapped_cls_from_config
798
+
799
+ # resolve remapping
800
+ remapped_class = _fetch_remapped_cls_from_config(config, cls)
801
+
802
+ if remapped_class is cls:
803
+ return super(LegacyConfigMixin, remapped_class).from_config(config, return_unused_kwargs, **kwargs)
804
+ else:
805
+ return remapped_class.from_config(config, return_unused_kwargs, **kwargs)
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/dependency_versions_check.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from .dependency_versions_table import deps
16
+ from .utils.versions import require_version, require_version_core
17
+
18
+
19
+ # define which module versions we always want to check at run time
20
+ # (usually the ones defined in `install_requires` in setup.py)
21
+ #
22
+ # order specific notes:
23
+ # - tqdm must be checked before tokenizers
24
+
25
+ pkgs_to_check_at_runtime = "python requests filelock numpy".split()
26
+ for pkg in pkgs_to_check_at_runtime:
27
+ if pkg in deps:
28
+ require_version_core(deps[pkg])
29
+ else:
30
+ raise ValueError(f"can't find {pkg} in {deps.keys()}, check dependency_versions_table.py")
31
+
32
+
33
+ def dep_version_check(pkg, hint=None):
34
+ require_version(deps[pkg], hint)
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/dependency_versions_table.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THIS FILE HAS BEEN AUTOGENERATED. To update:
2
+ # 1. modify the `_deps` dict in setup.py
3
+ # 2. run `make deps_table_update`
4
+ deps = {
5
+ "Pillow": "Pillow",
6
+ "accelerate": "accelerate>=0.31.0",
7
+ "datasets": "datasets",
8
+ "filelock": "filelock",
9
+ "flax": "flax>=0.4.1",
10
+ "ftfy": "ftfy",
11
+ "hf-doc-builder": "hf-doc-builder>=0.3.0",
12
+ "httpx": "httpx<1.0.0",
13
+ "huggingface-hub": "huggingface-hub>=0.34.0,<2.0",
14
+ "requests-mock": "requests-mock==1.10.0",
15
+ "importlib_metadata": "importlib_metadata",
16
+ "invisible-watermark": "invisible-watermark>=0.2.0",
17
+ "isort": "isort>=5.5.4",
18
+ "jax": "jax>=0.4.1",
19
+ "jaxlib": "jaxlib>=0.4.1",
20
+ "Jinja2": "Jinja2",
21
+ "torchsde": "torchsde",
22
+ "note_seq": "note_seq",
23
+ "librosa": "librosa",
24
+ "llvmlite": "llvmlite>=0.40.0",
25
+ "numba": "numba>=0.57.0",
26
+ "numpy": "numpy",
27
+ "parameterized": "parameterized",
28
+ "peft": "peft>=0.17.0",
29
+ "protobuf": "protobuf>=3.20.3,<4",
30
+ "pytest": "pytest",
31
+ "pytest-timeout": "pytest-timeout",
32
+ "pytest-xdist": "pytest-xdist",
33
+ "python": "python>=3.10.0",
34
+ "ruff": "ruff==0.9.10",
35
+ "safetensors": "safetensors>=0.8.0",
36
+ "sentencepiece": "sentencepiece>=0.1.91,!=0.1.92",
37
+ "GitPython": "GitPython<3.1.19",
38
+ "scipy": "scipy",
39
+ "onnx": "onnx",
40
+ "optimum_quanto": "optimum_quanto>=0.2.6",
41
+ "gguf": "gguf>=0.10.0",
42
+ "auto-round": "auto-round>=0.13.0",
43
+ "torchao": "torchao>=0.7.0",
44
+ "bitsandbytes": "bitsandbytes>=0.43.3",
45
+ "nvidia_modelopt[hf]": "nvidia_modelopt[hf]>=0.33.1",
46
+ "regex": "regex!=2019.12.17",
47
+ "requests": "requests",
48
+ "tensorboard": "tensorboard",
49
+ "tiktoken": "tiktoken>=0.7.0",
50
+ "torch": "torch>=2.6",
51
+ "torchvision": "torchvision",
52
+ "transformers": "transformers>=4.41.2",
53
+ "urllib3": "urllib3<=2.0.0",
54
+ "black": "black",
55
+ "phonemizer": "phonemizer",
56
+ "opencv-python": "opencv-python",
57
+ "timm": "timm",
58
+ "flashpack": "flashpack",
59
+ }
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/experimental/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from .rl import ValueGuidedRLPipeline
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__init__.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ from ..utils import is_torch_available, logging
17
+
18
+
19
+ if is_torch_available():
20
+ from .adaptive_projected_guidance import AdaptiveProjectedGuidance
21
+ from .adaptive_projected_guidance_mix import AdaptiveProjectedMixGuidance
22
+ from .auto_guidance import AutoGuidance
23
+ from .classifier_free_guidance import ClassifierFreeGuidance
24
+ from .classifier_free_zero_star_guidance import ClassifierFreeZeroStarGuidance
25
+ from .frequency_decoupled_guidance import FrequencyDecoupledGuidance
26
+ from .guider_utils import BaseGuidance
27
+ from .magnitude_aware_guidance import MagnitudeAwareGuidance
28
+ from .perturbed_attention_guidance import PerturbedAttentionGuidance
29
+ from .skip_layer_guidance import SkipLayerGuidance
30
+ from .smoothed_energy_guidance import SmoothedEnergyGuidance
31
+ from .tangential_classifier_free_guidance import TangentialClassifierFreeGuidance
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (1.42 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/adaptive_projected_guidance.cpython-311.pyc ADDED
Binary file (13.9 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/adaptive_projected_guidance_mix.cpython-311.pyc ADDED
Binary file (15.8 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/auto_guidance.cpython-311.pyc ADDED
Binary file (11.5 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/classifier_free_guidance.cpython-311.pyc ADDED
Binary file (7.59 kB). View file
 
data/diffusion/.venv/lib/python3.11/site-packages/diffusers/guiders/__pycache__/classifier_free_zero_star_guidance.cpython-311.pyc ADDED
Binary file (8.74 kB). View file