mirror of
https://github.com/huggingface/diffusers.git
synced 2025-12-09 22:14:43 +08:00
Compare commits
8 Commits
yiyi-lucy
...
move-testi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
215af1a602 | ||
|
|
1a917d3ac5 | ||
|
|
65efbcead5 | ||
|
|
2a52a25b9a | ||
|
|
0137a16ed5 | ||
|
|
ce12925a23 | ||
|
|
80b06b0d5f | ||
|
|
42c19fdd0d |
@@ -25,6 +25,11 @@ from os.path import abspath, dirname, join
|
|||||||
git_repo_path = abspath(join(dirname(dirname(dirname(__file__))), "src"))
|
git_repo_path = abspath(join(dirname(dirname(dirname(__file__))), "src"))
|
||||||
sys.path.insert(1, git_repo_path)
|
sys.path.insert(1, git_repo_path)
|
||||||
|
|
||||||
|
# Add parent directory to path so we can import from tests
|
||||||
|
repo_root = abspath(dirname(dirname(__file__)))
|
||||||
|
if repo_root not in sys.path:
|
||||||
|
sys.path.insert(0, repo_root)
|
||||||
|
|
||||||
|
|
||||||
# silence FutureWarning warnings in tests since often we can't act on them until
|
# silence FutureWarning warnings in tests since often we can't act on them until
|
||||||
# they become normal warnings - i.e. the tests still need to test the current functionality
|
# they become normal warnings - i.e. the tests still need to test the current functionality
|
||||||
@@ -32,13 +37,13 @@ warnings.simplefilter(action="ignore", category=FutureWarning)
|
|||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
from diffusers.utils.testing_utils import pytest_addoption_shared
|
from tests.testing_utils import pytest_addoption_shared
|
||||||
|
|
||||||
pytest_addoption_shared(parser)
|
pytest_addoption_shared(parser)
|
||||||
|
|
||||||
|
|
||||||
def pytest_terminal_summary(terminalreporter):
|
def pytest_terminal_summary(terminalreporter):
|
||||||
from diffusers.utils.testing_utils import pytest_terminal_summary_main
|
from tests.testing_utils import pytest_terminal_summary_main
|
||||||
|
|
||||||
make_reports = terminalreporter.config.getoption("--make-reports")
|
make_reports = terminalreporter.config.getoption("--make-reports")
|
||||||
if make_reports:
|
if make_reports:
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ import math
|
|||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
# Add repo root to path to import from tests
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import accelerate
|
import accelerate
|
||||||
@@ -54,8 +56,7 @@ from diffusers.optimization import get_scheduler
|
|||||||
from diffusers.training_utils import compute_density_for_timestep_sampling, compute_loss_weighting_for_sd3, free_memory
|
from diffusers.training_utils import compute_density_for_timestep_sampling, compute_loss_weighting_for_sd3, free_memory
|
||||||
from diffusers.utils import check_min_version, is_wandb_available, make_image_grid
|
from diffusers.utils import check_min_version, is_wandb_available, make_image_grid
|
||||||
from diffusers.utils.hub_utils import load_or_create_model_card, populate_model_card
|
from diffusers.utils.hub_utils import load_or_create_model_card, populate_model_card
|
||||||
from diffusers.utils.testing_utils import backend_empty_cache
|
from diffusers.utils.torch_utils import backend_empty_cache, is_compiled_module
|
||||||
from diffusers.utils.torch_utils import is_compiled_module
|
|
||||||
|
|
||||||
|
|
||||||
if is_wandb_available():
|
if is_wandb_available():
|
||||||
|
|||||||
@@ -24,12 +24,18 @@ import tempfile
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import VQModel
|
from diffusers import VQModel
|
||||||
from diffusers.utils.testing_utils import require_timm
|
|
||||||
|
|
||||||
|
|
||||||
|
# Add parent directories to path to import from tests
|
||||||
sys.path.append("..")
|
sys.path.append("..")
|
||||||
|
repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
||||||
|
if repo_root not in sys.path:
|
||||||
|
sys.path.insert(0, repo_root)
|
||||||
|
|
||||||
from test_examples_utils import ExamplesTestsAccelerate, run_command # noqa: E402
|
from test_examples_utils import ExamplesTestsAccelerate, run_command # noqa: E402
|
||||||
|
|
||||||
|
from tests.testing_utils import require_timm # noqa
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,10 @@ else:
|
|||||||
global_rng = random.Random()
|
global_rng = random.Random()
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
logger.warning(
|
||||||
|
"diffusers.utils.testing_utils' is deprecated and will be removed in a future version. "
|
||||||
|
"Determinism and device backend utilities have been moved to `diffusers.utils.torch_utils`. "
|
||||||
|
)
|
||||||
_required_peft_version = is_peft_available() and version.parse(
|
_required_peft_version = is_peft_available() and version.parse(
|
||||||
version.parse(importlib.metadata.version("peft")).base_version
|
version.parse(importlib.metadata.version("peft")).base_version
|
||||||
) > version.parse("0.5")
|
) > version.parse("0.5")
|
||||||
@@ -801,10 +804,9 @@ def export_to_ply(mesh, output_ply_path: str = None):
|
|||||||
f.write(format.pack(*vertex))
|
f.write(format.pack(*vertex))
|
||||||
|
|
||||||
if faces is not None:
|
if faces is not None:
|
||||||
format = struct.Struct("<B3I")
|
|
||||||
for tri in faces.tolist():
|
for tri in faces.tolist():
|
||||||
f.write(format.pack(len(tri), *tri))
|
f.write(format.pack(len(tri), *tri))
|
||||||
|
format = struct.Struct("<B3I")
|
||||||
return output_ply_path
|
return output_ply_path
|
||||||
|
|
||||||
|
|
||||||
@@ -1144,23 +1146,23 @@ def enable_full_determinism():
|
|||||||
Helper function for reproducible behavior during distributed training. See
|
Helper function for reproducible behavior during distributed training. See
|
||||||
- https://pytorch.org/docs/stable/notes/randomness.html for pytorch
|
- https://pytorch.org/docs/stable/notes/randomness.html for pytorch
|
||||||
"""
|
"""
|
||||||
# Enable PyTorch deterministic mode. This potentially requires either the environment
|
from .torch_utils import enable_full_determinism as _enable_full_determinism
|
||||||
# variable 'CUDA_LAUNCH_BLOCKING' or 'CUBLAS_WORKSPACE_CONFIG' to be set,
|
|
||||||
# depending on the CUDA version, so we set them both here
|
|
||||||
os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
|
|
||||||
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":16:8"
|
|
||||||
torch.use_deterministic_algorithms(True)
|
|
||||||
|
|
||||||
# Enable CUDNN deterministic mode
|
logger.warning(
|
||||||
torch.backends.cudnn.deterministic = True
|
"enable_full_determinism has been moved to diffusers.utils.torch_utils. "
|
||||||
torch.backends.cudnn.benchmark = False
|
"Importing from diffusers.utils.testing_utils is deprecated and will be removed in a future version."
|
||||||
torch.backends.cuda.matmul.allow_tf32 = False
|
)
|
||||||
|
return _enable_full_determinism()
|
||||||
|
|
||||||
|
|
||||||
def disable_full_determinism():
|
def disable_full_determinism():
|
||||||
os.environ["CUDA_LAUNCH_BLOCKING"] = "0"
|
from .torch_utils import disable_full_determinism as _disable_full_determinism
|
||||||
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ""
|
|
||||||
torch.use_deterministic_algorithms(False)
|
logger.warning(
|
||||||
|
"disable_full_determinism has been moved to diffusers.utils.torch_utils. "
|
||||||
|
"Importing from diffusers.utils.testing_utils is deprecated and will be removed in a future version."
|
||||||
|
)
|
||||||
|
return _disable_full_determinism()
|
||||||
|
|
||||||
|
|
||||||
# Utils for custom and alternative accelerator devices
|
# Utils for custom and alternative accelerator devices
|
||||||
@@ -1282,43 +1284,85 @@ def _device_agnostic_dispatch(device: str, dispatch_table: Dict[str, Callable],
|
|||||||
|
|
||||||
# These are callables which automatically dispatch the function specific to the accelerator
|
# These are callables which automatically dispatch the function specific to the accelerator
|
||||||
def backend_manual_seed(device: str, seed: int):
|
def backend_manual_seed(device: str, seed: int):
|
||||||
return _device_agnostic_dispatch(device, BACKEND_MANUAL_SEED, seed)
|
from .torch_utils import backend_manual_seed as _backend_manual_seed
|
||||||
|
|
||||||
|
logger.warning(
|
||||||
|
"backend_manual_seed has been moved to diffusers.utils.torch_utils. "
|
||||||
|
"diffusers.utils.testing_utils is deprecated and will be removed in a future version."
|
||||||
|
)
|
||||||
|
return _backend_manual_seed(device, seed)
|
||||||
|
|
||||||
|
|
||||||
def backend_synchronize(device: str):
|
def backend_synchronize(device: str):
|
||||||
return _device_agnostic_dispatch(device, BACKEND_SYNCHRONIZE)
|
from .torch_utils import backend_synchronize as _backend_synchronize
|
||||||
|
|
||||||
|
logger.warning(
|
||||||
|
"backend_synchronize has been moved to diffusers.utils.torch_utils. "
|
||||||
|
"diffusers.utils.testing_utils is deprecated and will be removed in a future version."
|
||||||
|
)
|
||||||
|
return _backend_synchronize(device)
|
||||||
|
|
||||||
|
|
||||||
def backend_empty_cache(device: str):
|
def backend_empty_cache(device: str):
|
||||||
return _device_agnostic_dispatch(device, BACKEND_EMPTY_CACHE)
|
from .torch_utils import backend_empty_cache as _backend_empty_cache
|
||||||
|
|
||||||
|
logger.warning(
|
||||||
|
"backend_empty_cache has been moved to diffusers.utils.torch_utils. "
|
||||||
|
"diffusers.utils.testing_utils is deprecated and will be removed in a future version."
|
||||||
|
)
|
||||||
|
return _backend_empty_cache(device)
|
||||||
|
|
||||||
|
|
||||||
def backend_device_count(device: str):
|
def backend_device_count(device: str):
|
||||||
return _device_agnostic_dispatch(device, BACKEND_DEVICE_COUNT)
|
from .torch_utils import backend_device_count as _backend_device_count
|
||||||
|
|
||||||
|
logger.warning(
|
||||||
|
"backend_device_count has been moved to diffusers.utils.torch_utils. "
|
||||||
|
"diffusers.utils.testing_utils is deprecated and will be removed in a future version."
|
||||||
|
)
|
||||||
|
return _backend_device_count(device)
|
||||||
|
|
||||||
|
|
||||||
def backend_reset_peak_memory_stats(device: str):
|
def backend_reset_peak_memory_stats(device: str):
|
||||||
return _device_agnostic_dispatch(device, BACKEND_RESET_PEAK_MEMORY_STATS)
|
from .torch_utils import backend_reset_peak_memory_stats as _backend_reset_peak_memory_stats
|
||||||
|
|
||||||
|
logger.warning(
|
||||||
|
"backend_reset_peak_memory_stats has been moved to diffusers.utils.torch_utils. "
|
||||||
|
"diffusers.utils.testing_utils is deprecated and will be removed in a future version."
|
||||||
|
)
|
||||||
|
return _backend_reset_peak_memory_stats(device)
|
||||||
|
|
||||||
|
|
||||||
def backend_reset_max_memory_allocated(device: str):
|
def backend_reset_max_memory_allocated(device: str):
|
||||||
return _device_agnostic_dispatch(device, BACKEND_RESET_MAX_MEMORY_ALLOCATED)
|
from .torch_utils import backend_reset_max_memory_allocated as _backend_reset_max_memory_allocated
|
||||||
|
|
||||||
|
logger.warning(
|
||||||
|
"backend_reset_max_memory_allocated has been moved to diffusers.utils.torch_utils. "
|
||||||
|
"diffusers.utils.testing_utils is deprecated and will be removed in a future version."
|
||||||
|
)
|
||||||
|
return _backend_reset_max_memory_allocated(device)
|
||||||
|
|
||||||
|
|
||||||
def backend_max_memory_allocated(device: str):
|
def backend_max_memory_allocated(device: str):
|
||||||
return _device_agnostic_dispatch(device, BACKEND_MAX_MEMORY_ALLOCATED)
|
from .torch_utils import backend_max_memory_allocated as _backend_max_memory_allocated
|
||||||
|
|
||||||
|
logger.warning(
|
||||||
|
"backend_max_memory_allocated has been moved to diffusers.utils.torch_utils. "
|
||||||
|
"diffusers.utils.testing_utils is deprecated and will be removed in a future version."
|
||||||
|
)
|
||||||
|
return _backend_max_memory_allocated(device)
|
||||||
|
|
||||||
|
|
||||||
# These are callables which return boolean behaviour flags and can be used to specify some
|
# These are callables which return boolean behaviour flags and can be used to specify some
|
||||||
# device agnostic alternative where the feature is unsupported.
|
# device agnostic alternative where the feature is unsupported.
|
||||||
def backend_supports_training(device: str):
|
def backend_supports_training(device: str):
|
||||||
if not is_torch_available():
|
from .torch_utils import backend_supports_training as _backend_supports_training
|
||||||
return False
|
|
||||||
|
|
||||||
if device not in BACKEND_SUPPORTS_TRAINING:
|
logger.warning(
|
||||||
device = "default"
|
"backend_supports_training has been moved to diffusers.utils.torch_utils. "
|
||||||
|
"diffusers.utils.testing_utils is deprecated and will be removed in a future version."
|
||||||
return BACKEND_SUPPORTS_TRAINING[device]
|
)
|
||||||
|
return _backend_supports_training(device)
|
||||||
|
|
||||||
|
|
||||||
# Guard for when Torch is not available
|
# Guard for when Torch is not available
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ PyTorch utilities: Utilities related to PyTorch
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
from typing import List, Optional, Tuple, Union
|
import os
|
||||||
|
from typing import Callable, Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
from . import logging
|
from . import logging
|
||||||
from .import_utils import is_torch_available, is_torch_npu_available, is_torch_version
|
from .import_utils import is_torch_available, is_torch_npu_available, is_torch_version
|
||||||
@@ -26,6 +27,56 @@ if is_torch_available():
|
|||||||
import torch
|
import torch
|
||||||
from torch.fft import fftn, fftshift, ifftn, ifftshift
|
from torch.fft import fftn, fftshift, ifftn, ifftshift
|
||||||
|
|
||||||
|
BACKEND_SUPPORTS_TRAINING = {"cuda": True, "xpu": True, "cpu": True, "mps": False, "default": True}
|
||||||
|
BACKEND_EMPTY_CACHE = {
|
||||||
|
"cuda": torch.cuda.empty_cache,
|
||||||
|
"xpu": torch.xpu.empty_cache,
|
||||||
|
"cpu": None,
|
||||||
|
"mps": torch.mps.empty_cache,
|
||||||
|
"default": None,
|
||||||
|
}
|
||||||
|
BACKEND_DEVICE_COUNT = {
|
||||||
|
"cuda": torch.cuda.device_count,
|
||||||
|
"xpu": torch.xpu.device_count,
|
||||||
|
"cpu": lambda: 0,
|
||||||
|
"mps": lambda: 0,
|
||||||
|
"default": 0,
|
||||||
|
}
|
||||||
|
BACKEND_MANUAL_SEED = {
|
||||||
|
"cuda": torch.cuda.manual_seed,
|
||||||
|
"xpu": torch.xpu.manual_seed,
|
||||||
|
"cpu": torch.manual_seed,
|
||||||
|
"mps": torch.mps.manual_seed,
|
||||||
|
"default": torch.manual_seed,
|
||||||
|
}
|
||||||
|
BACKEND_RESET_PEAK_MEMORY_STATS = {
|
||||||
|
"cuda": torch.cuda.reset_peak_memory_stats,
|
||||||
|
"xpu": getattr(torch.xpu, "reset_peak_memory_stats", None),
|
||||||
|
"cpu": None,
|
||||||
|
"mps": None,
|
||||||
|
"default": None,
|
||||||
|
}
|
||||||
|
BACKEND_RESET_MAX_MEMORY_ALLOCATED = {
|
||||||
|
"cuda": torch.cuda.reset_max_memory_allocated,
|
||||||
|
"xpu": getattr(torch.xpu, "reset_peak_memory_stats", None),
|
||||||
|
"cpu": None,
|
||||||
|
"mps": None,
|
||||||
|
"default": None,
|
||||||
|
}
|
||||||
|
BACKEND_MAX_MEMORY_ALLOCATED = {
|
||||||
|
"cuda": torch.cuda.max_memory_allocated,
|
||||||
|
"xpu": getattr(torch.xpu, "max_memory_allocated", None),
|
||||||
|
"cpu": 0,
|
||||||
|
"mps": 0,
|
||||||
|
"default": 0,
|
||||||
|
}
|
||||||
|
BACKEND_SYNCHRONIZE = {
|
||||||
|
"cuda": torch.cuda.synchronize,
|
||||||
|
"xpu": getattr(torch.xpu, "synchronize", None),
|
||||||
|
"cpu": None,
|
||||||
|
"mps": None,
|
||||||
|
"default": None,
|
||||||
|
}
|
||||||
logger = logging.get_logger(__name__) # pylint: disable=invalid-name
|
logger = logging.get_logger(__name__) # pylint: disable=invalid-name
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -36,6 +87,62 @@ except (ImportError, ModuleNotFoundError):
|
|||||||
return cls
|
return cls
|
||||||
|
|
||||||
|
|
||||||
|
# This dispatches a defined function according to the accelerator from the function definitions.
|
||||||
|
def _device_agnostic_dispatch(device: str, dispatch_table: Dict[str, Callable], *args, **kwargs):
|
||||||
|
if device not in dispatch_table:
|
||||||
|
return dispatch_table["default"](*args, **kwargs)
|
||||||
|
|
||||||
|
fn = dispatch_table[device]
|
||||||
|
|
||||||
|
# Some device agnostic functions return values. Need to guard against 'None' instead at
|
||||||
|
# user level
|
||||||
|
if not callable(fn):
|
||||||
|
return fn
|
||||||
|
|
||||||
|
return fn(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
# These are callables which automatically dispatch the function specific to the accelerator
|
||||||
|
def backend_manual_seed(device: str, seed: int):
|
||||||
|
return _device_agnostic_dispatch(device, BACKEND_MANUAL_SEED, seed)
|
||||||
|
|
||||||
|
|
||||||
|
def backend_synchronize(device: str):
|
||||||
|
return _device_agnostic_dispatch(device, BACKEND_SYNCHRONIZE)
|
||||||
|
|
||||||
|
|
||||||
|
def backend_empty_cache(device: str):
|
||||||
|
return _device_agnostic_dispatch(device, BACKEND_EMPTY_CACHE)
|
||||||
|
|
||||||
|
|
||||||
|
def backend_device_count(device: str):
|
||||||
|
return _device_agnostic_dispatch(device, BACKEND_DEVICE_COUNT)
|
||||||
|
|
||||||
|
|
||||||
|
def backend_reset_peak_memory_stats(device: str):
|
||||||
|
return _device_agnostic_dispatch(device, BACKEND_RESET_PEAK_MEMORY_STATS)
|
||||||
|
|
||||||
|
|
||||||
|
def backend_reset_max_memory_allocated(device: str):
|
||||||
|
return _device_agnostic_dispatch(device, BACKEND_RESET_MAX_MEMORY_ALLOCATED)
|
||||||
|
|
||||||
|
|
||||||
|
def backend_max_memory_allocated(device: str):
|
||||||
|
return _device_agnostic_dispatch(device, BACKEND_MAX_MEMORY_ALLOCATED)
|
||||||
|
|
||||||
|
|
||||||
|
# These are callables which return boolean behaviour flags and can be used to specify some
|
||||||
|
# device agnostic alternative where the feature is unsupported.
|
||||||
|
def backend_supports_training(device: str):
|
||||||
|
if not is_torch_available():
|
||||||
|
return False
|
||||||
|
|
||||||
|
if device not in BACKEND_SUPPORTS_TRAINING:
|
||||||
|
device = "default"
|
||||||
|
|
||||||
|
return BACKEND_SUPPORTS_TRAINING[device]
|
||||||
|
|
||||||
|
|
||||||
def randn_tensor(
|
def randn_tensor(
|
||||||
shape: Union[Tuple, List],
|
shape: Union[Tuple, List],
|
||||||
generator: Optional[Union[List["torch.Generator"], "torch.Generator"]] = None,
|
generator: Optional[Union[List["torch.Generator"], "torch.Generator"]] = None,
|
||||||
@@ -197,3 +304,31 @@ def device_synchronize(device_type: Optional[str] = None):
|
|||||||
device_type = get_device()
|
device_type = get_device()
|
||||||
device_mod = getattr(torch, device_type, torch.cuda)
|
device_mod = getattr(torch, device_type, torch.cuda)
|
||||||
device_mod.synchronize()
|
device_mod.synchronize()
|
||||||
|
|
||||||
|
|
||||||
|
def enable_full_determinism():
|
||||||
|
"""
|
||||||
|
Helper function for reproducible behavior during distributed training. See
|
||||||
|
- https://pytorch.org/docs/stable/notes/randomness.html for pytorch
|
||||||
|
"""
|
||||||
|
# Enable PyTorch deterministic mode. This potentially requires either the environment
|
||||||
|
# variable 'CUDA_LAUNCH_BLOCKING' or 'CUBLAS_WORKSPACE_CONFIG' to be set,
|
||||||
|
# depending on the CUDA version, so we set them both here
|
||||||
|
os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
|
||||||
|
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":16:8"
|
||||||
|
torch.use_deterministic_algorithms(True)
|
||||||
|
|
||||||
|
# Enable CUDNN deterministic mode
|
||||||
|
torch.backends.cudnn.deterministic = True
|
||||||
|
torch.backends.cudnn.benchmark = False
|
||||||
|
torch.backends.cuda.matmul.allow_tf32 = False
|
||||||
|
|
||||||
|
|
||||||
|
def disable_full_determinism():
|
||||||
|
os.environ["CUDA_LAUNCH_BLOCKING"] = "0"
|
||||||
|
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ""
|
||||||
|
torch.use_deterministic_algorithms(False)
|
||||||
|
|
||||||
|
|
||||||
|
if is_torch_available():
|
||||||
|
torch_device = get_device()
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ def pytest_configure(config):
|
|||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
from diffusers.utils.testing_utils import pytest_addoption_shared
|
from .testing_utils import pytest_addoption_shared
|
||||||
|
|
||||||
pytest_addoption_shared(parser)
|
pytest_addoption_shared(parser)
|
||||||
|
|
||||||
|
|
||||||
def pytest_terminal_summary(terminalreporter):
|
def pytest_terminal_summary(terminalreporter):
|
||||||
from diffusers.utils.testing_utils import pytest_terminal_summary_main
|
from .testing_utils import pytest_terminal_summary_main
|
||||||
|
|
||||||
make_reports = terminalreporter.config.getoption("--make-reports")
|
make_reports = terminalreporter.config.getoption("--make-reports")
|
||||||
if make_reports:
|
if make_reports:
|
||||||
|
|||||||
0
tests/hooks/__init__.py
Normal file
0
tests/hooks/__init__.py
Normal file
@@ -24,7 +24,8 @@ from diffusers.models import ModelMixin
|
|||||||
from diffusers.pipelines.pipeline_utils import DiffusionPipeline
|
from diffusers.pipelines.pipeline_utils import DiffusionPipeline
|
||||||
from diffusers.utils import get_logger
|
from diffusers.utils import get_logger
|
||||||
from diffusers.utils.import_utils import compare_versions
|
from diffusers.utils.import_utils import compare_versions
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
backend_max_memory_allocated,
|
backend_max_memory_allocated,
|
||||||
backend_reset_peak_memory_stats,
|
backend_reset_peak_memory_stats,
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ import torch
|
|||||||
from diffusers.hooks import HookRegistry, ModelHook
|
from diffusers.hooks import HookRegistry, ModelHook
|
||||||
from diffusers.training_utils import free_memory
|
from diffusers.training_utils import free_memory
|
||||||
from diffusers.utils.logging import get_logger
|
from diffusers.utils.logging import get_logger
|
||||||
from diffusers.utils.testing_utils import CaptureLogger, torch_device
|
|
||||||
|
from ..testing_utils import CaptureLogger, torch_device
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__) # pylint: disable=invalid-name
|
logger = get_logger(__name__) # pylint: disable=invalid-name
|
||||||
|
|||||||
0
tests/lora/__init__.py
Normal file
0
tests/lora/__init__.py
Normal file
@@ -23,7 +23,8 @@ from diffusers import (
|
|||||||
AuraFlowTransformer2DModel,
|
AuraFlowTransformer2DModel,
|
||||||
FlowMatchEulerDiscreteScheduler,
|
FlowMatchEulerDiscreteScheduler,
|
||||||
)
|
)
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
is_peft_available,
|
is_peft_available,
|
||||||
require_peft_backend,
|
require_peft_backend,
|
||||||
@@ -35,7 +36,7 @@ if is_peft_available():
|
|||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ from diffusers import (
|
|||||||
CogVideoXPipeline,
|
CogVideoXPipeline,
|
||||||
CogVideoXTransformer3DModel,
|
CogVideoXTransformer3DModel,
|
||||||
)
|
)
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
require_peft_backend,
|
require_peft_backend,
|
||||||
require_torch_accelerator,
|
require_torch_accelerator,
|
||||||
@@ -35,7 +36,7 @@ from diffusers.utils.testing_utils import (
|
|||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ from parameterized import parameterized
|
|||||||
from transformers import AutoTokenizer, GlmModel
|
from transformers import AutoTokenizer, GlmModel
|
||||||
|
|
||||||
from diffusers import AutoencoderKL, CogView4Pipeline, CogView4Transformer2DModel, FlowMatchEulerDiscreteScheduler
|
from diffusers import AutoencoderKL, CogView4Pipeline, CogView4Transformer2DModel, FlowMatchEulerDiscreteScheduler
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
require_peft_backend,
|
require_peft_backend,
|
||||||
require_torch_accelerator,
|
require_torch_accelerator,
|
||||||
@@ -33,7 +34,7 @@ from diffusers.utils.testing_utils import (
|
|||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
class TokenizerWrapper:
|
class TokenizerWrapper:
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ from transformers import AutoTokenizer, CLIPTextModel, CLIPTokenizer, T5EncoderM
|
|||||||
|
|
||||||
from diffusers import FlowMatchEulerDiscreteScheduler, FluxControlPipeline, FluxPipeline, FluxTransformer2DModel
|
from diffusers import FlowMatchEulerDiscreteScheduler, FluxControlPipeline, FluxPipeline, FluxTransformer2DModel
|
||||||
from diffusers.utils import load_image, logging
|
from diffusers.utils import load_image, logging
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
CaptureLogger,
|
CaptureLogger,
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
@@ -48,7 +49,7 @@ if is_peft_available():
|
|||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests, check_if_lora_correctly_set # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests, check_if_lora_correctly_set # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ from diffusers import (
|
|||||||
HunyuanVideoPipeline,
|
HunyuanVideoPipeline,
|
||||||
HunyuanVideoTransformer3DModel,
|
HunyuanVideoTransformer3DModel,
|
||||||
)
|
)
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
Expectations,
|
Expectations,
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
@@ -42,7 +43,7 @@ from diffusers.utils.testing_utils import (
|
|||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
|
|||||||
@@ -24,12 +24,13 @@ from diffusers import (
|
|||||||
LTXPipeline,
|
LTXPipeline,
|
||||||
LTXVideoTransformer3DModel,
|
LTXVideoTransformer3DModel,
|
||||||
)
|
)
|
||||||
from diffusers.utils.testing_utils import floats_tensor, require_peft_backend
|
|
||||||
|
from ..testing_utils import floats_tensor, require_peft_backend
|
||||||
|
|
||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
|
|||||||
@@ -26,12 +26,13 @@ from diffusers import (
|
|||||||
Lumina2Pipeline,
|
Lumina2Pipeline,
|
||||||
Lumina2Transformer2DModel,
|
Lumina2Transformer2DModel,
|
||||||
)
|
)
|
||||||
from diffusers.utils.testing_utils import floats_tensor, is_torch_version, require_peft_backend, skip_mps, torch_device
|
|
||||||
|
from ..testing_utils import floats_tensor, is_torch_version, require_peft_backend, skip_mps, torch_device
|
||||||
|
|
||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests, check_if_lora_correctly_set # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests, check_if_lora_correctly_set # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ import torch
|
|||||||
from transformers import AutoTokenizer, T5EncoderModel
|
from transformers import AutoTokenizer, T5EncoderModel
|
||||||
|
|
||||||
from diffusers import AutoencoderKLMochi, FlowMatchEulerDiscreteScheduler, MochiPipeline, MochiTransformer3DModel
|
from diffusers import AutoencoderKLMochi, FlowMatchEulerDiscreteScheduler, MochiPipeline, MochiTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
require_peft_backend,
|
require_peft_backend,
|
||||||
skip_mps,
|
skip_mps,
|
||||||
@@ -28,7 +29,7 @@ from diffusers.utils.testing_utils import (
|
|||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
|
|||||||
@@ -24,12 +24,13 @@ from diffusers import (
|
|||||||
QwenImagePipeline,
|
QwenImagePipeline,
|
||||||
QwenImageTransformer2DModel,
|
QwenImageTransformer2DModel,
|
||||||
)
|
)
|
||||||
from diffusers.utils.testing_utils import floats_tensor, require_peft_backend
|
|
||||||
|
from ..testing_utils import floats_tensor, require_peft_backend
|
||||||
|
|
||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
|
|||||||
@@ -19,12 +19,13 @@ import torch
|
|||||||
from transformers import Gemma2Model, GemmaTokenizer
|
from transformers import Gemma2Model, GemmaTokenizer
|
||||||
|
|
||||||
from diffusers import AutoencoderDC, FlowMatchEulerDiscreteScheduler, SanaPipeline, SanaTransformer2DModel
|
from diffusers import AutoencoderDC, FlowMatchEulerDiscreteScheduler, SanaPipeline, SanaTransformer2DModel
|
||||||
from diffusers.utils.testing_utils import floats_tensor, require_peft_backend
|
|
||||||
|
from ..testing_utils import floats_tensor, require_peft_backend
|
||||||
|
|
||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ from diffusers import (
|
|||||||
StableDiffusionPipeline,
|
StableDiffusionPipeline,
|
||||||
)
|
)
|
||||||
from diffusers.utils.import_utils import is_accelerate_available
|
from diffusers.utils.import_utils import is_accelerate_available
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
Expectations,
|
Expectations,
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
load_image,
|
load_image,
|
||||||
@@ -47,7 +48,7 @@ from diffusers.utils.testing_utils import (
|
|||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests, check_if_lora_correctly_set # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests, check_if_lora_correctly_set # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
if is_accelerate_available():
|
if is_accelerate_available():
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ from diffusers import (
|
|||||||
)
|
)
|
||||||
from diffusers.utils import load_image
|
from diffusers.utils import load_image
|
||||||
from diffusers.utils.import_utils import is_accelerate_available
|
from diffusers.utils.import_utils import is_accelerate_available
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
is_flaky,
|
is_flaky,
|
||||||
nightly,
|
nightly,
|
||||||
@@ -42,7 +43,7 @@ from diffusers.utils.testing_utils import (
|
|||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
if is_accelerate_available():
|
if is_accelerate_available():
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ from diffusers import (
|
|||||||
)
|
)
|
||||||
from diffusers.utils import logging
|
from diffusers.utils import logging
|
||||||
from diffusers.utils.import_utils import is_accelerate_available
|
from diffusers.utils.import_utils import is_accelerate_available
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
CaptureLogger,
|
CaptureLogger,
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
is_flaky,
|
is_flaky,
|
||||||
@@ -51,7 +52,7 @@ from diffusers.utils.testing_utils import (
|
|||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests, check_if_lora_correctly_set, state_dicts_almost_equal # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests, check_if_lora_correctly_set, state_dicts_almost_equal # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
if is_accelerate_available():
|
if is_accelerate_available():
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ from diffusers import (
|
|||||||
WanPipeline,
|
WanPipeline,
|
||||||
WanTransformer3DModel,
|
WanTransformer3DModel,
|
||||||
)
|
)
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
require_peft_backend,
|
require_peft_backend,
|
||||||
skip_mps,
|
skip_mps,
|
||||||
@@ -33,7 +34,7 @@ from diffusers.utils.testing_utils import (
|
|||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ from transformers import AutoTokenizer, T5EncoderModel
|
|||||||
|
|
||||||
from diffusers import AutoencoderKLWan, FlowMatchEulerDiscreteScheduler, WanVACEPipeline, WanVACETransformer3DModel
|
from diffusers import AutoencoderKLWan, FlowMatchEulerDiscreteScheduler, WanVACEPipeline, WanVACETransformer3DModel
|
||||||
from diffusers.utils.import_utils import is_peft_available
|
from diffusers.utils.import_utils import is_peft_available
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
is_flaky,
|
is_flaky,
|
||||||
require_peft_backend,
|
require_peft_backend,
|
||||||
@@ -40,7 +41,7 @@ if is_peft_available():
|
|||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
|
|
||||||
from utils import PeftLoraLoaderMixinTests # noqa: E402
|
from .utils import PeftLoraLoaderMixinTests # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ from diffusers import (
|
|||||||
)
|
)
|
||||||
from diffusers.utils import logging
|
from diffusers.utils import logging
|
||||||
from diffusers.utils.import_utils import is_peft_available
|
from diffusers.utils.import_utils import is_peft_available
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
CaptureLogger,
|
CaptureLogger,
|
||||||
check_if_dicts_are_equal,
|
check_if_dicts_are_equal,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ from parameterized import parameterized
|
|||||||
|
|
||||||
from diffusers import AsymmetricAutoencoderKL
|
from diffusers import AsymmetricAutoencoderKL
|
||||||
from diffusers.utils.import_utils import is_xformers_available
|
from diffusers.utils.import_utils import is_xformers_available
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
Expectations,
|
Expectations,
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
@@ -34,7 +35,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
torch_all_close,
|
torch_all_close,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from diffusers import AutoencoderKLCosmos
|
from diffusers import AutoencoderKLCosmos
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, floats_tensor, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, floats_tensor, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from diffusers import AutoencoderDC
|
from diffusers import AutoencoderDC
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ import torch
|
|||||||
|
|
||||||
from diffusers import AutoencoderKLHunyuanVideo
|
from diffusers import AutoencoderKLHunyuanVideo
|
||||||
from diffusers.models.autoencoders.autoencoder_kl_hunyuan_video import prepare_causal_attention_mask
|
from diffusers.models.autoencoders.autoencoder_kl_hunyuan_video import prepare_causal_attention_mask
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ from parameterized import parameterized
|
|||||||
|
|
||||||
from diffusers import AutoencoderKL
|
from diffusers import AutoencoderKL
|
||||||
from diffusers.utils.import_utils import is_xformers_available
|
from diffusers.utils.import_utils import is_xformers_available
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
@@ -34,7 +35,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
torch_all_close,
|
torch_all_close,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import AutoencoderKLCogVideoX
|
from diffusers import AutoencoderKLCogVideoX
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from diffusers import AutoencoderKLTemporalDecoder
|
from diffusers import AutoencoderKLTemporalDecoder
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import AutoencoderKLLTXVideo
|
from diffusers import AutoencoderKLLTXVideo
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from diffusers import AutoencoderKLMagvit
|
from diffusers import AutoencoderKLMagvit
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, floats_tensor, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, floats_tensor, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,12 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from diffusers import AutoencoderKLMochi
|
from diffusers import AutoencoderKLMochi
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ from datasets import load_dataset
|
|||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
|
|
||||||
from diffusers import AutoencoderOobleck
|
from diffusers import AutoencoderOobleck
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
@@ -29,7 +30,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
torch_all_close,
|
torch_all_close,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ import torch
|
|||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
|
|
||||||
from diffusers import AutoencoderTiny
|
from diffusers import AutoencoderTiny
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
@@ -30,7 +31,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
torch_all_close,
|
torch_all_close,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import AutoencoderKLWan
|
from diffusers import AutoencoderKLWan
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, floats_tensor, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, floats_tensor, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ import numpy as np
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import ConsistencyDecoderVAE, StableDiffusionPipeline
|
from diffusers import ConsistencyDecoderVAE, StableDiffusionPipeline
|
||||||
from diffusers.utils.testing_utils import (
|
from diffusers.utils.torch_utils import randn_tensor
|
||||||
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
load_image,
|
load_image,
|
||||||
@@ -28,8 +30,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
torch_all_close,
|
torch_all_close,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
from diffusers.utils.torch_utils import randn_tensor
|
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import VQModel
|
from diffusers import VQModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_manual_seed,
|
backend_manual_seed,
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import torch
|
|||||||
|
|
||||||
from diffusers import DiffusionPipeline
|
from diffusers import DiffusionPipeline
|
||||||
from diffusers.models.attention_processor import Attention, AttnAddedKVProcessor
|
from diffusers.models.attention_processor import Attention, AttnAddedKVProcessor
|
||||||
from diffusers.utils.testing_utils import torch_device
|
|
||||||
|
from ..testing_utils import torch_device
|
||||||
|
|
||||||
|
|
||||||
class AttnAddedKVProcessorTests(unittest.TestCase):
|
class AttnAddedKVProcessorTests(unittest.TestCase):
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ from diffusers.models.attention import GEGLU, AdaLayerNorm, ApproximateGELU
|
|||||||
from diffusers.models.embeddings import get_timestep_embedding
|
from diffusers.models.embeddings import get_timestep_embedding
|
||||||
from diffusers.models.resnet import Downsample2D, ResnetBlock2D, Upsample2D
|
from diffusers.models.resnet import Downsample2D, ResnetBlock2D, Upsample2D
|
||||||
from diffusers.models.transformers.transformer_2d import Transformer2DModel
|
from diffusers.models.transformers.transformer_2d import Transformer2DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
backend_manual_seed,
|
backend_manual_seed,
|
||||||
require_torch_accelerator_with_fp64,
|
require_torch_accelerator_with_fp64,
|
||||||
require_torch_version_greater_equal,
|
require_torch_version_greater_equal,
|
||||||
|
|||||||
@@ -59,7 +59,10 @@ from diffusers.utils import (
|
|||||||
logging,
|
logging,
|
||||||
)
|
)
|
||||||
from diffusers.utils.hub_utils import _add_variant
|
from diffusers.utils.hub_utils import _add_variant
|
||||||
from diffusers.utils.testing_utils import (
|
from diffusers.utils.torch_utils import get_torch_cuda_device_capability
|
||||||
|
|
||||||
|
from ..others.test_utils import TOKEN, USER, is_staging_test
|
||||||
|
from ..testing_utils import (
|
||||||
CaptureLogger,
|
CaptureLogger,
|
||||||
_check_safetensors_serialization,
|
_check_safetensors_serialization,
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
@@ -82,9 +85,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
torch_all_close,
|
torch_all_close,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
from diffusers.utils.torch_utils import get_torch_cuda_device_capability
|
|
||||||
|
|
||||||
from ..others.test_utils import TOKEN, USER, is_staging_test
|
|
||||||
|
|
||||||
|
|
||||||
if is_peft_available():
|
if is_peft_available():
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import DiTTransformer2DModel, Transformer2DModel
|
from diffusers import DiTTransformer2DModel, Transformer2DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
slow,
|
slow,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import PixArtTransformer2DModel, Transformer2DModel
|
from diffusers import PixArtTransformer2DModel, Transformer2DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
slow,
|
slow,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ import torch
|
|||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
|
|
||||||
from diffusers import PriorTransformer
|
from diffusers import PriorTransformer
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
@@ -29,7 +30,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
torch_all_close,
|
torch_all_close,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import AllegroTransformer3DModel
|
from diffusers import AllegroTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import AuraFlowTransformer2DModel
|
from diffusers import AuraFlowTransformer2DModel
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import torch
|
|||||||
from diffusers import BriaTransformer2DModel
|
from diffusers import BriaTransformer2DModel
|
||||||
from diffusers.models.attention_processor import FluxIPAdapterJointAttnProcessor2_0
|
from diffusers.models.attention_processor import FluxIPAdapterJointAttnProcessor2_0
|
||||||
from diffusers.models.embeddings import ImageProjection
|
from diffusers.models.embeddings import ImageProjection
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, torch_device
|
||||||
from ..test_modeling_common import LoraHotSwappingForModelTesterMixin, ModelTesterMixin, TorchCompileTesterMixin
|
from ..test_modeling_common import LoraHotSwappingForModelTesterMixin, ModelTesterMixin, TorchCompileTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import torch
|
|||||||
from diffusers import ChromaTransformer2DModel
|
from diffusers import ChromaTransformer2DModel
|
||||||
from diffusers.models.attention_processor import FluxIPAdapterJointAttnProcessor2_0
|
from diffusers.models.attention_processor import FluxIPAdapterJointAttnProcessor2_0
|
||||||
from diffusers.models.embeddings import ImageProjection
|
from diffusers.models.embeddings import ImageProjection
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, torch_device
|
||||||
from ..test_modeling_common import LoraHotSwappingForModelTesterMixin, ModelTesterMixin, TorchCompileTesterMixin
|
from ..test_modeling_common import LoraHotSwappingForModelTesterMixin, ModelTesterMixin, TorchCompileTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import CogVideoXTransformer3DModel
|
from diffusers import CogVideoXTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import CogView3PlusTransformer2DModel
|
from diffusers import CogView3PlusTransformer2DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import CogView4Transformer2DModel
|
from diffusers import CogView4Transformer2DModel
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import ConsisIDTransformer3DModel
|
from diffusers import ConsisIDTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import CosmosTransformer3DModel
|
from diffusers import CosmosTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import EasyAnimateTransformer3DModel
|
from diffusers import EasyAnimateTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import torch
|
|||||||
from diffusers import FluxTransformer2DModel
|
from diffusers import FluxTransformer2DModel
|
||||||
from diffusers.models.attention_processor import FluxIPAdapterJointAttnProcessor2_0
|
from diffusers.models.attention_processor import FluxIPAdapterJointAttnProcessor2_0
|
||||||
from diffusers.models.embeddings import ImageProjection
|
from diffusers.models.embeddings import ImageProjection
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, is_peft_available, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, is_peft_available, torch_device
|
||||||
from ..test_modeling_common import LoraHotSwappingForModelTesterMixin, ModelTesterMixin, TorchCompileTesterMixin
|
from ..test_modeling_common import LoraHotSwappingForModelTesterMixin, ModelTesterMixin, TorchCompileTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import HiDreamImageTransformer2DModel
|
from diffusers import HiDreamImageTransformer2DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import HunyuanDiT2DModel
|
from diffusers import HunyuanDiT2DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import HunyuanVideoTransformer3DModel
|
from diffusers import HunyuanVideoTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, TorchCompileTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, TorchCompileTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import HunyuanVideoFramepackTransformer3DModel
|
from diffusers import HunyuanVideoFramepackTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import LatteTransformer3DModel
|
from diffusers import LatteTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import LTXVideoTransformer3DModel
|
from diffusers import LTXVideoTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin, TorchCompileTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, TorchCompileTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import LuminaNextDiT2DModel
|
from diffusers import LuminaNextDiT2DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import Lumina2Transformer2DModel
|
from diffusers import Lumina2Transformer2DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import MochiTransformer3DModel
|
from diffusers import MochiTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import OmniGenTransformer2DModel
|
from diffusers import OmniGenTransformer2DModel
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import pytest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import QwenImageTransformer2DModel
|
from diffusers import QwenImageTransformer2DModel
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin, TorchCompileTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, TorchCompileTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import SanaTransformer2DModel
|
from diffusers import SanaTransformer2DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ import torch
|
|||||||
|
|
||||||
from diffusers import SD3Transformer2DModel
|
from diffusers import SD3Transformer2DModel
|
||||||
from diffusers.utils.import_utils import is_xformers_available
|
from diffusers.utils.import_utils import is_xformers_available
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import SkyReelsV2Transformer3DModel
|
from diffusers import SkyReelsV2Transformer3DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, TorchCompileTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, TorchCompileTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers.models.transformers import TransformerTemporalModel
|
from diffusers.models.transformers import TransformerTemporalModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin
|
from ..test_modeling_common import ModelTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ import unittest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import WanTransformer3DModel
|
from diffusers import WanTransformer3DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, TorchCompileTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, TorchCompileTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ import pytest
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers import UNet1DModel
|
from diffusers import UNet1DModel
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_manual_seed,
|
backend_manual_seed,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
slow,
|
slow,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ import torch
|
|||||||
|
|
||||||
from diffusers import UNet2DModel
|
from diffusers import UNet2DModel
|
||||||
from diffusers.utils import logging
|
from diffusers.utils import logging
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
@@ -30,7 +31,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
torch_all_close,
|
torch_all_close,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ from diffusers.models.attention_processor import (
|
|||||||
from diffusers.models.embeddings import ImageProjection, IPAdapterFaceIDImageProjection, IPAdapterPlusImageProjection
|
from diffusers.models.embeddings import ImageProjection, IPAdapterFaceIDImageProjection, IPAdapterPlusImageProjection
|
||||||
from diffusers.utils import logging
|
from diffusers.utils import logging
|
||||||
from diffusers.utils.import_utils import is_xformers_available
|
from diffusers.utils.import_utils import is_xformers_available
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
backend_max_memory_allocated,
|
backend_max_memory_allocated,
|
||||||
backend_reset_max_memory_allocated,
|
backend_reset_max_memory_allocated,
|
||||||
@@ -51,7 +52,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
torch_all_close,
|
torch_all_close,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import (
|
from ..test_modeling_common import (
|
||||||
LoraHotSwappingForModelTesterMixin,
|
LoraHotSwappingForModelTesterMixin,
|
||||||
ModelTesterMixin,
|
ModelTesterMixin,
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ import torch
|
|||||||
from diffusers.models import ModelMixin, UNet3DConditionModel
|
from diffusers.models import ModelMixin, UNet3DConditionModel
|
||||||
from diffusers.utils import logging
|
from diffusers.utils import logging
|
||||||
from diffusers.utils.import_utils import is_xformers_available
|
from diffusers.utils.import_utils import is_xformers_available
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, floats_tensor, skip_mps, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, floats_tensor, skip_mps, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ from torch import nn
|
|||||||
|
|
||||||
from diffusers import ControlNetXSAdapter, UNet2DConditionModel, UNetControlNetXSModel
|
from diffusers import ControlNetXSAdapter, UNet2DConditionModel, UNetControlNetXSModel
|
||||||
from diffusers.utils import logging
|
from diffusers.utils import logging
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, floats_tensor, is_flaky, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import enable_full_determinism, floats_tensor, is_flaky, torch_device
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ import torch
|
|||||||
from diffusers import MotionAdapter, UNet2DConditionModel, UNetMotionModel
|
from diffusers import MotionAdapter, UNet2DConditionModel, UNetMotionModel
|
||||||
from diffusers.utils import logging
|
from diffusers.utils import logging
|
||||||
from diffusers.utils.import_utils import is_xformers_available
|
from diffusers.utils.import_utils import is_xformers_available
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ import torch
|
|||||||
from diffusers import UNetSpatioTemporalConditionModel
|
from diffusers import UNetSpatioTemporalConditionModel
|
||||||
from diffusers.utils import logging
|
from diffusers.utils import logging
|
||||||
from diffusers.utils.import_utils import is_xformers_available
|
from diffusers.utils.import_utils import is_xformers_available
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
skip_mps,
|
skip_mps,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
from ..test_modeling_common import ModelTesterMixin, UNetTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from diffusers.models.unets.unet_2d_blocks import * # noqa F403
|
from diffusers.models.unets.unet_2d_blocks import * # noqa F403
|
||||||
from diffusers.utils.testing_utils import torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import torch_device
|
||||||
from .test_unet_blocks_common import UNetBlockTesterMixin
|
from .test_unet_blocks_common import UNetBlockTesterMixin
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,15 @@ from typing import Tuple
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from diffusers.utils.testing_utils import (
|
from diffusers.utils.torch_utils import randn_tensor
|
||||||
|
|
||||||
|
from ...testing_utils import (
|
||||||
floats_tensor,
|
floats_tensor,
|
||||||
require_torch,
|
require_torch,
|
||||||
require_torch_accelerator_with_training,
|
require_torch_accelerator_with_training,
|
||||||
torch_all_close,
|
torch_all_close,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
from diffusers.utils.torch_utils import randn_tensor
|
|
||||||
|
|
||||||
|
|
||||||
@require_torch
|
@require_torch
|
||||||
|
|||||||
@@ -27,15 +27,15 @@ from diffusers import (
|
|||||||
StableDiffusionXLModularPipeline,
|
StableDiffusionXLModularPipeline,
|
||||||
)
|
)
|
||||||
from diffusers.loaders import ModularIPAdapterMixin
|
from diffusers.loaders import ModularIPAdapterMixin
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
enable_full_determinism,
|
|
||||||
floats_tensor,
|
|
||||||
torch_device,
|
|
||||||
)
|
|
||||||
|
|
||||||
from ...models.unets.test_models_unet_2d_condition import (
|
from ...models.unets.test_models_unet_2d_condition import (
|
||||||
create_ip_adapter_state_dict,
|
create_ip_adapter_state_dict,
|
||||||
)
|
)
|
||||||
|
from ...testing_utils import (
|
||||||
|
enable_full_determinism,
|
||||||
|
floats_tensor,
|
||||||
|
torch_device,
|
||||||
|
)
|
||||||
from ..test_modular_pipelines_common import (
|
from ..test_modular_pipelines_common import (
|
||||||
ModularPipelineTesterMixin,
|
ModularPipelineTesterMixin,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import torch
|
|||||||
import diffusers
|
import diffusers
|
||||||
from diffusers import ComponentsManager, ModularPipeline, ModularPipelineBlocks
|
from diffusers import ComponentsManager, ModularPipeline, ModularPipelineBlocks
|
||||||
from diffusers.utils import logging
|
from diffusers.utils import logging
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ..testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
numpy_cosine_similarity_distance,
|
numpy_cosine_similarity_distance,
|
||||||
require_accelerator,
|
require_accelerator,
|
||||||
|
|||||||
0
tests/others/__init__.py
Normal file
0
tests/others/__init__.py
Normal file
@@ -28,7 +28,8 @@ from diffusers import (
|
|||||||
logging,
|
logging,
|
||||||
)
|
)
|
||||||
from diffusers.configuration_utils import ConfigMixin, register_to_config
|
from diffusers.configuration_utils import ConfigMixin, register_to_config
|
||||||
from diffusers.utils.testing_utils import CaptureLogger
|
|
||||||
|
from ..testing_utils import CaptureLogger
|
||||||
|
|
||||||
|
|
||||||
class SampleObject(ConfigMixin):
|
class SampleObject(ConfigMixin):
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ import torch
|
|||||||
|
|
||||||
from diffusers import UNet2DConditionModel
|
from diffusers import UNet2DConditionModel
|
||||||
from diffusers.training_utils import EMAModel
|
from diffusers.training_utils import EMAModel
|
||||||
from diffusers.utils.testing_utils import enable_full_determinism, skip_mps, torch_device
|
|
||||||
|
from ..testing_utils import enable_full_determinism, skip_mps, torch_device
|
||||||
|
|
||||||
|
|
||||||
enable_full_determinism()
|
enable_full_determinism()
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import numpy as np
|
|||||||
import PIL.Image
|
import PIL.Image
|
||||||
|
|
||||||
from diffusers.utils.outputs import BaseOutput
|
from diffusers.utils.outputs import BaseOutput
|
||||||
from diffusers.utils.testing_utils import require_torch
|
|
||||||
|
from ..testing_utils import require_torch
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ import torch
|
|||||||
|
|
||||||
from diffusers import DDIMScheduler, DDPMScheduler, UNet2DModel
|
from diffusers import DDIMScheduler, DDPMScheduler, UNet2DModel
|
||||||
from diffusers.training_utils import set_seed
|
from diffusers.training_utils import set_seed
|
||||||
from diffusers.utils.testing_utils import slow
|
|
||||||
|
from ..testing_utils import slow
|
||||||
|
|
||||||
|
|
||||||
torch.backends.cuda.matmul.allow_tf32 = False
|
torch.backends.cuda.matmul.allow_tf32 = False
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ import pytest
|
|||||||
|
|
||||||
from diffusers import __version__
|
from diffusers import __version__
|
||||||
from diffusers.utils import deprecate
|
from diffusers.utils import deprecate
|
||||||
from diffusers.utils.testing_utils import Expectations, str_to_bool
|
|
||||||
|
from ..testing_utils import Expectations, str_to_bool
|
||||||
|
|
||||||
|
|
||||||
# Used to test the hub
|
# Used to test the hub
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ import torch
|
|||||||
from transformers import AutoTokenizer, T5Config, T5EncoderModel
|
from transformers import AutoTokenizer, T5Config, T5EncoderModel
|
||||||
|
|
||||||
from diffusers import AllegroPipeline, AllegroTransformer3DModel, AutoencoderKLAllegro, DDIMScheduler
|
from diffusers import AllegroPipeline, AllegroTransformer3DModel, AutoencoderKLAllegro, DDIMScheduler
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
numpy_cosine_similarity_distance,
|
numpy_cosine_similarity_distance,
|
||||||
@@ -33,7 +34,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
slow,
|
slow,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_IMAGE_PARAMS, TEXT_TO_IMAGE_PARAMS
|
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_IMAGE_PARAMS, TEXT_TO_IMAGE_PARAMS
|
||||||
from ..test_pipelines_common import PipelineTesterMixin, PyramidAttentionBroadcastTesterMixin, to_np
|
from ..test_pipelines_common import PipelineTesterMixin, PyramidAttentionBroadcastTesterMixin, to_np
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ from diffusers import (
|
|||||||
)
|
)
|
||||||
from diffusers.models.attention import FreeNoiseTransformerBlock
|
from diffusers.models.attention import FreeNoiseTransformerBlock
|
||||||
from diffusers.utils import is_xformers_available, logging
|
from diffusers.utils import is_xformers_available, logging
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
numpy_cosine_similarity_distance,
|
numpy_cosine_similarity_distance,
|
||||||
require_accelerator,
|
require_accelerator,
|
||||||
@@ -27,7 +28,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
slow,
|
slow,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS
|
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS
|
||||||
from ..test_pipelines_common import (
|
from ..test_pipelines_common import (
|
||||||
IPAdapterTesterMixin,
|
IPAdapterTesterMixin,
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ from diffusers import (
|
|||||||
from diffusers.models.attention import FreeNoiseTransformerBlock
|
from diffusers.models.attention import FreeNoiseTransformerBlock
|
||||||
from diffusers.utils import logging
|
from diffusers.utils import logging
|
||||||
from diffusers.utils.import_utils import is_xformers_available
|
from diffusers.utils.import_utils import is_xformers_available
|
||||||
from diffusers.utils.testing_utils import require_accelerator, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import require_accelerator, torch_device
|
||||||
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS
|
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS
|
||||||
from ..test_pipelines_common import (
|
from ..test_pipelines_common import (
|
||||||
IPAdapterTesterMixin,
|
IPAdapterTesterMixin,
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ from diffusers import (
|
|||||||
UNetMotionModel,
|
UNetMotionModel,
|
||||||
)
|
)
|
||||||
from diffusers.utils import is_xformers_available, logging
|
from diffusers.utils import is_xformers_available, logging
|
||||||
from diffusers.utils.testing_utils import require_accelerator, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import require_accelerator, torch_device
|
||||||
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_CALLBACK_CFG_PARAMS, TEXT_TO_IMAGE_PARAMS
|
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_CALLBACK_CFG_PARAMS, TEXT_TO_IMAGE_PARAMS
|
||||||
from ..test_pipelines_common import (
|
from ..test_pipelines_common import (
|
||||||
IPAdapterTesterMixin,
|
IPAdapterTesterMixin,
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ from diffusers import (
|
|||||||
)
|
)
|
||||||
from diffusers.utils import logging
|
from diffusers.utils import logging
|
||||||
from diffusers.utils.import_utils import is_xformers_available
|
from diffusers.utils.import_utils import is_xformers_available
|
||||||
from diffusers.utils.testing_utils import require_accelerator, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import require_accelerator, torch_device
|
||||||
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS
|
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS
|
||||||
from ..test_pipelines_common import (
|
from ..test_pipelines_common import (
|
||||||
IPAdapterTesterMixin,
|
IPAdapterTesterMixin,
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ from diffusers import (
|
|||||||
)
|
)
|
||||||
from diffusers.models.attention import FreeNoiseTransformerBlock
|
from diffusers.models.attention import FreeNoiseTransformerBlock
|
||||||
from diffusers.utils import is_xformers_available, logging
|
from diffusers.utils import is_xformers_available, logging
|
||||||
from diffusers.utils.testing_utils import require_accelerator, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import require_accelerator, torch_device
|
||||||
from ..pipeline_params import TEXT_TO_IMAGE_PARAMS, VIDEO_TO_VIDEO_BATCH_PARAMS
|
from ..pipeline_params import TEXT_TO_IMAGE_PARAMS, VIDEO_TO_VIDEO_BATCH_PARAMS
|
||||||
from ..test_pipelines_common import IPAdapterTesterMixin, PipelineFromPipeTesterMixin, PipelineTesterMixin
|
from ..test_pipelines_common import IPAdapterTesterMixin, PipelineFromPipeTesterMixin, PipelineTesterMixin
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ from diffusers import (
|
|||||||
)
|
)
|
||||||
from diffusers.models.attention import FreeNoiseTransformerBlock
|
from diffusers.models.attention import FreeNoiseTransformerBlock
|
||||||
from diffusers.utils import is_xformers_available, logging
|
from diffusers.utils import is_xformers_available, logging
|
||||||
from diffusers.utils.testing_utils import require_accelerator, torch_device
|
|
||||||
|
|
||||||
|
from ...testing_utils import require_accelerator, torch_device
|
||||||
from ..pipeline_params import TEXT_TO_IMAGE_PARAMS, VIDEO_TO_VIDEO_BATCH_PARAMS
|
from ..pipeline_params import TEXT_TO_IMAGE_PARAMS, VIDEO_TO_VIDEO_BATCH_PARAMS
|
||||||
from ..test_pipelines_common import IPAdapterTesterMixin, PipelineFromPipeTesterMixin, PipelineTesterMixin
|
from ..test_pipelines_common import IPAdapterTesterMixin, PipelineFromPipeTesterMixin, PipelineTesterMixin
|
||||||
|
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ from diffusers import (
|
|||||||
PNDMScheduler,
|
PNDMScheduler,
|
||||||
)
|
)
|
||||||
from diffusers.utils import is_transformers_version
|
from diffusers.utils import is_transformers_version
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
is_torch_version,
|
is_torch_version,
|
||||||
nightly,
|
nightly,
|
||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..pipeline_params import TEXT_TO_AUDIO_BATCH_PARAMS, TEXT_TO_AUDIO_PARAMS
|
from ..pipeline_params import TEXT_TO_AUDIO_BATCH_PARAMS, TEXT_TO_AUDIO_PARAMS
|
||||||
from ..test_pipelines_common import PipelineTesterMixin
|
from ..test_pipelines_common import PipelineTesterMixin
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,11 @@ from diffusers import (
|
|||||||
FlowMatchEulerDiscreteScheduler,
|
FlowMatchEulerDiscreteScheduler,
|
||||||
)
|
)
|
||||||
from diffusers.pipelines.bria import BriaPipeline
|
from diffusers.pipelines.bria import BriaPipeline
|
||||||
from diffusers.utils.testing_utils import (
|
|
||||||
|
# from ..test_pipelines_common import PipelineTesterMixin, check_qkv_fused_layers_exist
|
||||||
|
from tests.pipelines.test_pipelines_common import PipelineTesterMixin, to_np
|
||||||
|
|
||||||
|
from ...testing_utils import (
|
||||||
backend_empty_cache,
|
backend_empty_cache,
|
||||||
enable_full_determinism,
|
enable_full_determinism,
|
||||||
numpy_cosine_similarity_distance,
|
numpy_cosine_similarity_distance,
|
||||||
@@ -36,9 +40,6 @@ from diffusers.utils.testing_utils import (
|
|||||||
torch_device,
|
torch_device,
|
||||||
)
|
)
|
||||||
|
|
||||||
# from ..test_pipelines_common import PipelineTesterMixin, check_qkv_fused_layers_exist
|
|
||||||
from tests.pipelines.test_pipelines_common import PipelineTesterMixin, to_np
|
|
||||||
|
|
||||||
|
|
||||||
enable_full_determinism()
|
enable_full_determinism()
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user