mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-08-30 06:30:37 +02:00
test(loader): isolate optional quantization dependency
This commit is contained in:
@@ -651,6 +651,7 @@ def test_cuda_quantization_builds_explicit_config(loader_boundary, monkeypatch,
|
||||
|
||||
monkeypatch.setattr(loader.dev, "get_device", lambda _preference="auto": "cuda")
|
||||
monkeypatch.setattr(loader.dev, "supports_bitsandbytes", lambda _device=None: True)
|
||||
monkeypatch.setitem(sys.modules, "bitsandbytes", ModuleType("bitsandbytes"))
|
||||
monkeypatch.setattr("transformers.BitsAndBytesConfig", fake_bnb)
|
||||
handle = loader.load_model("x", quantization=quantization, skip_snapshot=True)
|
||||
kwargs = loader_boundary.model_class.from_pretrained.call_args.kwargs
|
||||
@@ -743,6 +744,7 @@ def _enable_cuda_quantization(monkeypatch, estimate_gb: float) -> None:
|
||||
"get_device_properties",
|
||||
lambda _index: SimpleNamespace(total_memory=16 * gib),
|
||||
)
|
||||
monkeypatch.setitem(sys.modules, "bitsandbytes", ModuleType("bitsandbytes"))
|
||||
monkeypatch.setattr("transformers.BitsAndBytesConfig", lambda **kwargs: kwargs)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user