Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

test(quantization): give the loader fixtures their torch device

Alexander Eichhornc93747582900
diff --git a/tests/backend/model_manager/load/test_krea2_nvfp4_loader.py b/tests/backend/model_manager/load/test_krea2_nvfp4_loader.py
index f9fd7fcea9..bb622ac258 100644
--- a/tests/backend/model_manager/load/test_krea2_nvfp4_loader.py
+++ b/tests/backend/model_manager/load/test_krea2_nvfp4_loader.py
@@ -126,6 +126,9 @@ def loaded(request, monkeypatch: pytest.MonkeyPatch, tmp_path) -> SimpleNamespac
loader = object.__new__(Krea2CheckpointModel)
loader._ram_cache = SimpleNamespace(make_room=MagicMock())
loader._logger = MagicMock()
+ # Supplied because the loader reads it when it decides whether to keep fp8 weights packed:
+ # a fixture built with `object.__new__` has to provide every attribute that path touches.
+ loader._torch_device = torch.device("cpu")
loader._apply_fp8_layerwise_casting = lambda model, _config, _submodel: model
monkeypatch.setattr(diffusers, "Krea2Transformer2DModel", _TinyKrea2, raising=False)
diff --git a/tests/backend/model_manager/load/test_mistral_encoder_checkpoint_loader.py b/tests/backend/model_manager/load/test_mistral_encoder_checkpoint_loader.py
index ef21086ea1..df379d7e19 100644
--- a/tests/backend/model_manager/load/test_mistral_encoder_checkpoint_loader.py
+++ b/tests/backend/model_manager/load/test_mistral_encoder_checkpoint_loader.py
@@ -119,6 +119,9 @@ def _loader(monkeypatch: pytest.MonkeyPatch, keep_fp8: bool) -> tuple[MistralEnc
monkeypatch.setattr(mistral_encoder, "should_keep_fp8_weights", lambda _device: keep_fp8)
loader = object.__new__(MistralEncoderCheckpointLoader)
loader._ram_cache = SimpleNamespace(make_room=MagicMock())
+ # Supplied because the loader reads it when it decides whether to keep fp8 weights packed:
+ # a fixture built with `object.__new__` has to provide every attribute that path touches.
+ loader._torch_device = torch.device("cpu")
widening: list[str] = []
for name in ("_drop_quantization_metadata", "split_fp8_scaled_layers"):