Decorator marking a test that requires a bigger hardware accelerator (24GB) for execution. Some example pipelines: Flux, SD3, Cog, etc.
(test_case)
| 617 | |
| 618 | |
| 619 | def 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 | |
| 648 | def require_torch_accelerator_with_training(test_case): |
nothing calls this directly
no test coverage detected
searching dependent graphs…