mirror of
https://github.com/huggingface/diffusers.git
synced 2025-12-14 00:14:23 +08:00
Compare commits
8 Commits
cache-docs
...
reconfigur
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4841e2ea6 | ||
|
|
72ce96ae5a | ||
|
|
3f8759e240 | ||
|
|
3716e91e6e | ||
|
|
cee42bcfa6 | ||
|
|
d7d76c5034 | ||
|
|
650d327b9c | ||
|
|
b7f535fcca |
2
.github/workflows/nightly_tests.yml
vendored
2
.github/workflows/nightly_tests.yml
vendored
@@ -198,7 +198,7 @@ jobs:
|
|||||||
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
|
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
|
||||||
RUN_COMPILE: yes
|
RUN_COMPILE: yes
|
||||||
run: |
|
run: |
|
||||||
pytest -n 1 --max-worker-restart=0 --dist=loadfile -s -v -k "compile" --make-reports=tests_torch_compile_cuda tests/
|
pytest -n 1 --max-worker-restart=0 --dist=loadfile -s -v -m "is_torch_compile" --make-reports=tests_torch_compile_cuda tests/
|
||||||
- name: Failure short reports
|
- name: Failure short reports
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
run: cat reports/tests_torch_compile_cuda_failures_short.txt
|
run: cat reports/tests_torch_compile_cuda_failures_short.txt
|
||||||
|
|||||||
42
.github/workflows/push_tests.yml
vendored
42
.github/workflows/push_tests.yml
vendored
@@ -156,48 +156,6 @@ jobs:
|
|||||||
name: torch_cuda_test_reports_${{ matrix.module }}
|
name: torch_cuda_test_reports_${{ matrix.module }}
|
||||||
path: reports
|
path: reports
|
||||||
|
|
||||||
run_torch_compile_tests:
|
|
||||||
name: PyTorch Compile CUDA tests
|
|
||||||
|
|
||||||
runs-on:
|
|
||||||
group: aws-g4dn-2xlarge
|
|
||||||
|
|
||||||
container:
|
|
||||||
image: diffusers/diffusers-pytorch-cuda
|
|
||||||
options: --gpus all --shm-size "16gb" --ipc host
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout diffusers
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
|
|
||||||
- name: NVIDIA-SMI
|
|
||||||
run: |
|
|
||||||
nvidia-smi
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
uv pip install -e ".[quality,training]"
|
|
||||||
- name: Environment
|
|
||||||
run: |
|
|
||||||
python utils/print_env.py
|
|
||||||
- name: Run example tests on GPU
|
|
||||||
env:
|
|
||||||
HF_TOKEN: ${{ secrets.DIFFUSERS_HF_HUB_READ_TOKEN }}
|
|
||||||
RUN_COMPILE: yes
|
|
||||||
run: |
|
|
||||||
pytest -n 1 --max-worker-restart=0 --dist=loadfile -s -v -k "compile" --make-reports=tests_torch_compile_cuda tests/
|
|
||||||
- name: Failure short reports
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: cat reports/tests_torch_compile_cuda_failures_short.txt
|
|
||||||
|
|
||||||
- name: Test suite reports artifacts
|
|
||||||
if: ${{ always() }}
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: torch_compile_test_reports
|
|
||||||
path: reports
|
|
||||||
|
|
||||||
run_xformers_tests:
|
run_xformers_tests:
|
||||||
name: PyTorch xformers CUDA tests
|
name: PyTorch xformers CUDA tests
|
||||||
|
|
||||||
|
|||||||
94
.github/workflows/push_tests_fast.yml
vendored
94
.github/workflows/push_tests_fast.yml
vendored
@@ -1,94 +0,0 @@
|
|||||||
name: Fast tests on main
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- "src/diffusers/**.py"
|
|
||||||
- "examples/**.py"
|
|
||||||
- "tests/**.py"
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
env:
|
|
||||||
DIFFUSERS_IS_CI: yes
|
|
||||||
HF_HOME: /mnt/cache
|
|
||||||
OMP_NUM_THREADS: 8
|
|
||||||
MKL_NUM_THREADS: 8
|
|
||||||
HF_HUB_ENABLE_HF_TRANSFER: 1
|
|
||||||
PYTEST_TIMEOUT: 600
|
|
||||||
RUN_SLOW: no
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run_fast_tests:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
config:
|
|
||||||
- name: Fast PyTorch CPU tests on Ubuntu
|
|
||||||
framework: pytorch
|
|
||||||
runner: aws-general-8-plus
|
|
||||||
image: diffusers/diffusers-pytorch-cpu
|
|
||||||
report: torch_cpu
|
|
||||||
- name: PyTorch Example CPU tests on Ubuntu
|
|
||||||
framework: pytorch_examples
|
|
||||||
runner: aws-general-8-plus
|
|
||||||
image: diffusers/diffusers-pytorch-cpu
|
|
||||||
report: torch_example_cpu
|
|
||||||
|
|
||||||
name: ${{ matrix.config.name }}
|
|
||||||
|
|
||||||
runs-on:
|
|
||||||
group: ${{ matrix.config.runner }}
|
|
||||||
|
|
||||||
container:
|
|
||||||
image: ${{ matrix.config.image }}
|
|
||||||
options: --shm-size "16gb" --ipc host -v /mnt/hf_cache:/mnt/cache/
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout diffusers
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
uv pip install -e ".[quality]"
|
|
||||||
|
|
||||||
- name: Environment
|
|
||||||
run: |
|
|
||||||
python utils/print_env.py
|
|
||||||
|
|
||||||
- name: Run fast PyTorch CPU tests
|
|
||||||
if: ${{ matrix.config.framework == 'pytorch' }}
|
|
||||||
run: |
|
|
||||||
pytest -n 4 --max-worker-restart=0 --dist=loadfile \
|
|
||||||
-s -v -k "not Flax and not Onnx" \
|
|
||||||
--make-reports=tests_${{ matrix.config.report }} \
|
|
||||||
tests/
|
|
||||||
|
|
||||||
- name: Run example PyTorch CPU tests
|
|
||||||
if: ${{ matrix.config.framework == 'pytorch_examples' }}
|
|
||||||
run: |
|
|
||||||
uv pip install ".[training]"
|
|
||||||
pytest -n 4 --max-worker-restart=0 --dist=loadfile \
|
|
||||||
--make-reports=tests_${{ matrix.config.report }} \
|
|
||||||
examples
|
|
||||||
|
|
||||||
- name: Failure short reports
|
|
||||||
if: ${{ failure() }}
|
|
||||||
run: cat reports/tests_${{ matrix.config.report }}_failures_short.txt
|
|
||||||
|
|
||||||
- name: Test suite reports artifacts
|
|
||||||
if: ${{ always() }}
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: pr_${{ matrix.config.report }}_test_reports
|
|
||||||
path: reports
|
|
||||||
@@ -32,6 +32,7 @@ warnings.simplefilter(action="ignore", category=FutureWarning)
|
|||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
config.addinivalue_line("markers", "big_accelerator: marks tests as requiring big accelerator resources")
|
config.addinivalue_line("markers", "big_accelerator: marks tests as requiring big accelerator resources")
|
||||||
|
config.addinivalue_line("markers", "is_torch_compile: marks torch compilation tests")
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
|
|||||||
@@ -69,13 +69,12 @@ from ..testing_utils import (
|
|||||||
backend_synchronize,
|
backend_synchronize,
|
||||||
check_if_dicts_are_equal,
|
check_if_dicts_are_equal,
|
||||||
get_python_version,
|
get_python_version,
|
||||||
is_torch_compile,
|
|
||||||
numpy_cosine_similarity_distance,
|
numpy_cosine_similarity_distance,
|
||||||
require_peft_backend,
|
require_peft_backend,
|
||||||
require_peft_version_greater,
|
|
||||||
require_torch_2,
|
require_torch_2,
|
||||||
require_torch_accelerator,
|
require_torch_accelerator,
|
||||||
require_torch_accelerator_with_training,
|
require_torch_accelerator_with_training,
|
||||||
|
require_torch_compile,
|
||||||
require_torch_multi_accelerator,
|
require_torch_multi_accelerator,
|
||||||
require_torch_version_greater,
|
require_torch_version_greater,
|
||||||
run_test_in_subprocess,
|
run_test_in_subprocess,
|
||||||
@@ -783,7 +782,7 @@ class ModelTesterMixin:
|
|||||||
max_diff = (image - new_image).abs().max().item()
|
max_diff = (image - new_image).abs().max().item()
|
||||||
self.assertLessEqual(max_diff, expected_max_diff, "Models give different forward passes")
|
self.assertLessEqual(max_diff, expected_max_diff, "Models give different forward passes")
|
||||||
|
|
||||||
@is_torch_compile
|
@require_torch_compile
|
||||||
@require_torch_2
|
@require_torch_2
|
||||||
@unittest.skipIf(
|
@unittest.skipIf(
|
||||||
get_python_version == (3, 12),
|
get_python_version == (3, 12),
|
||||||
@@ -2038,7 +2037,7 @@ class ModelPushToHubTester(unittest.TestCase):
|
|||||||
|
|
||||||
@require_torch_accelerator
|
@require_torch_accelerator
|
||||||
@require_torch_2
|
@require_torch_2
|
||||||
@is_torch_compile
|
@require_torch_compile
|
||||||
@slow
|
@slow
|
||||||
@require_torch_version_greater("2.7.1")
|
@require_torch_version_greater("2.7.1")
|
||||||
class TorchCompileTesterMixin:
|
class TorchCompileTesterMixin:
|
||||||
@@ -2160,9 +2159,8 @@ class TorchCompileTesterMixin:
|
|||||||
@require_torch_2
|
@require_torch_2
|
||||||
@require_torch_accelerator
|
@require_torch_accelerator
|
||||||
@require_peft_backend
|
@require_peft_backend
|
||||||
@require_peft_version_greater("0.14.0")
|
|
||||||
@require_torch_version_greater("2.7.1")
|
@require_torch_version_greater("2.7.1")
|
||||||
@is_torch_compile
|
@require_torch_compile
|
||||||
class LoraHotSwappingForModelTesterMixin:
|
class LoraHotSwappingForModelTesterMixin:
|
||||||
"""Test that hotswapping does not result in recompilation on the model directly.
|
"""Test that hotswapping does not result in recompilation on the model directly.
|
||||||
|
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ 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
|
||||||
|
|
||||||
|
|
||||||
enable_full_determinism()
|
enable_full_determinism()
|
||||||
|
|
||||||
|
|
||||||
class SkyReelsV2Transformer3DTests(ModelTesterMixin, TorchCompileTesterMixin, unittest.TestCase):
|
class SkyReelsV2Transformer3DTests(ModelTesterMixin, unittest.TestCase):
|
||||||
model_class = SkyReelsV2Transformer3DModel
|
model_class = SkyReelsV2Transformer3DModel
|
||||||
main_input_name = "hidden_states"
|
main_input_name = "hidden_states"
|
||||||
uses_custom_attn_processor = True
|
uses_custom_attn_processor = True
|
||||||
|
|||||||
@@ -447,6 +447,25 @@ def require_big_accelerator(test_case):
|
|||||||
)(test_case)
|
)(test_case)
|
||||||
|
|
||||||
|
|
||||||
|
def require_torch_compile(test_case):
|
||||||
|
"""
|
||||||
|
Decorator marking compilation test.
|
||||||
|
"""
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
test_case = pytest.mark.is_torch_compile(test_case)
|
||||||
|
|
||||||
|
if not is_torch_available():
|
||||||
|
return unittest.skip("test requires PyTorch")(test_case)
|
||||||
|
|
||||||
|
import torch
|
||||||
|
|
||||||
|
if not (torch.cuda.is_available() or torch.xpu.is_available()):
|
||||||
|
return unittest.skip("test requires PyTorch CUDA")(test_case)
|
||||||
|
|
||||||
|
return unittest.skipUnless(_run_compile_tests, "test is torch compile")(test_case)
|
||||||
|
|
||||||
|
|
||||||
def require_torch_accelerator_with_training(test_case):
|
def require_torch_accelerator_with_training(test_case):
|
||||||
"""Decorator marking a test that requires an accelerator with support for training."""
|
"""Decorator marking a test that requires an accelerator with support for training."""
|
||||||
return unittest.skipUnless(
|
return unittest.skipUnless(
|
||||||
|
|||||||
Reference in New Issue
Block a user