MCPcopy Index your code
hub / github.com/huggingface/diffusers / require_big_accelerator

Function require_big_accelerator

tests/testing_utils.py:619–645  ·  view source on GitHub ↗

Decorator marking a test that requires a bigger hardware accelerator (24GB) for execution. Some example pipelines: Flux, SD3, Cog, etc.

(test_case)

Source from the content-addressed store, hash-verified

617
618
619def require_big_accelerator(test_case):
620 """
621 Decorator marking a test that requires a bigger hardware accelerator (24GB) for execution. Some example pipelines:
622 Flux, SD3, Cog, etc.
623 """
624 import pytest
625
626 test_case = pytest.mark.big_accelerator(test_case)
627
628 if not is_torch_available():
629 return pytest.mark.skip(reason="test requires PyTorch")(test_case)
630
631 import torch
632
633 if not (torch.cuda.is_available() or torch.xpu.is_available()):
634 return pytest.mark.skip(reason="test requires PyTorch CUDA")(test_case)
635
636 if torch.xpu.is_available():
637 device_properties = torch.xpu.get_device_properties(0)
638 else:
639 device_properties = torch.cuda.get_device_properties(0)
640
641 total_memory = device_properties.total_memory / (1024**3)
642 return pytest.mark.skipif(
643 total_memory < BIG_GPU_MEMORY,
644 reason=f"test requires a hardware accelerator with at least {BIG_GPU_MEMORY} GB memory",
645 )(test_case)
646
647
648def require_torch_accelerator_with_training(test_case):

Callers

nothing calls this directly

Calls 1

is_torch_availableFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…