1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

Test sequential cpu offload for torchao quantization (#10506)

test sequential cpu offload
This commit is contained in:
Aryan
2025-01-14 09:54:06 +05:30
committed by GitHub
parent 74b67524b5
commit aa79d7da46

View File

@@ -476,6 +476,18 @@ class TorchAoTest(unittest.TestCase):
with self.assertRaises(ValueError):
self.get_dummy_components(TorchAoConfig("int42"))
def test_sequential_cpu_offload(self):
r"""
A test that checks if inference runs as expected when sequential cpu offloading is enabled.
"""
quantization_config = TorchAoConfig("int8wo")
components = self.get_dummy_components(quantization_config)
pipe = FluxPipeline(**components)
pipe.enable_sequential_cpu_offload()
inputs = self.get_dummy_inputs(torch_device)
_ = pipe(**inputs)
# Slices for these tests have been obtained on our aws-g6e-xlarge-plus runners
@require_torch