Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion tests/quantization/bnb/test_mixed_int8.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

from ...testing_utils import (
CaptureLogger,
Expectations,
backend_empty_cache,
is_bitsandbytes_available,
is_torch_available,
Expand Down Expand Up @@ -693,7 +694,16 @@ def test_lora_loading(self):
generator=torch.Generator().manual_seed(42),
).images
out_slice = output[0, -3:, -3:, -1].flatten()
expected_slice = np.array([0.2029, 0.2136, 0.2268, 0.1921, 0.1997, 0.2185, 0.2021, 0.2183, 0.2292])
# Hardware-dependent: the Control LoRA dequantizes and expands `x_embedder`, and the error
# accumulates over the 8 denoising steps enough that even different CUDA GPUs disagree, so
# reference slices are stored per accelerator backend.
expected_slices = Expectations(
{
(None, None): np.array([0.2029, 0.2136, 0.2268, 0.1921, 0.1997, 0.2185, 0.2021, 0.2183, 0.2292]),
("xpu", 5): np.array([0.0955, 0.1223, 0.1509, 0.0872, 0.1155, 0.1890, 0.0754, 0.1028, 0.2178]),
}
)
expected_slice = expected_slices.get_expectation()

max_diff = numpy_cosine_similarity_distance(expected_slice, out_slice)
assert max_diff < 1e-3, f"{out_slice=} != {expected_slice=}"
Expand Down
Loading