Skip to content

Commit d3010dd

Browse files
committed
xfail
1 parent 0e4f152 commit d3010dd

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

tests/quantization/bnb/test_4bit.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,9 +878,10 @@ def test_torch_compile(self):
878878
super()._test_torch_compile(quantization_config=self.quantization_config)
879879

880880
def test_torch_compile_with_cpu_offload(self):
881-
torch._dynamo.config.capture_dynamic_output_shape_ops = True
882881
super()._test_torch_compile_with_cpu_offload(quantization_config=self.quantization_config)
883882

883+
@pytest.mark.xfail(
884+
reason="Test fails because of an illegal memory access.",
885+
)
884886
def test_torch_compile_with_group_offload(self):
885-
torch._dynamo.config.capture_dynamic_output_shape_ops = True
886887
super()._test_torch_compile_with_group_offload(quantization_config=self.quantization_config)

tests/quantization/bnb/test_mixed_int8.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,13 +792,12 @@ def test_torch_compile(self):
792792
super()._test_torch_compile(quantization_config=self.quantization_config, torch_dtype=torch.float16)
793793

794794
def test_torch_compile_with_cpu_offload(self):
795-
torch._dynamo.config.capture_dynamic_output_shape_ops = True
796795
super()._test_torch_compile_with_cpu_offload(
797796
quantization_config=self.quantization_config, torch_dtype=torch.float16
798797
)
799798

799+
@pytest.mark.xfail(reason="Test fails because of an offloading problem from Accelerate with confusion in hooks.")
800800
def test_torch_compile_with_group_offload(self):
801-
torch._dynamo.config.capture_dynamic_output_shape_ops = True
802801
super()._test_torch_compile_with_group_offload(
803802
quantization_config=self.quantization_config, torch_dtype=torch.float16
804803
)

tests/quantization/test_torch_compile_utils.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,23 @@ def _test_torch_compile_with_cpu_offload(self, quantization_config, torch_dtype=
6565
pipe("a dog", num_inference_steps=3, max_sequence_length=16, height=256, width=256)
6666

6767
def _test_torch_compile_with_group_offload(self, quantization_config, torch_dtype=torch.bfloat16):
68+
torch._dynamo.config.cache_size_limit = 10000
69+
6870
pipe = self._init_pipeline(quantization_config, torch_dtype)
6971
group_offload_kwargs = {
70-
"onload_device": "cuda",
71-
"offload_device": "cpu",
72+
"onload_device": torch.device("cuda"),
73+
"offload_device": torch.device("cpu"),
7274
"offload_type": "block_level",
7375
"num_blocks_per_group": 1,
7476
"use_stream": True,
7577
"non_blocking": True,
7678
}
77-
pipe.enable_group_offload(**group_offload_kwargs)
79+
pipe.transformer.enable_group_offload(**group_offload_kwargs)
7880
pipe.transformer.compile()
81+
for name, component in pipe.components.items():
82+
if name != "transformer" and isinstance(component, torch.nn.Module):
83+
if torch.device(component.device).type == "cpu":
84+
component.to("cuda")
7985

8086
for _ in range(2):
8187
# small resolutions to ensure speedy execution.

0 commit comments

Comments
 (0)