* fix: SDXL DoRA LoRA fails with enable_partial_loading=true
cast_to_device returns plain torch.Tensor instead of torch.nn.Parameter,
causing _aggregate_patch_parameters to replace valid weights with meta
device dummies, falsely triggering DoRA's quantization guard.
Fixes invoke-ai/InvokeAI#8624
* test: regression coverage for DoRA + partial-loading + CPU→device autocast
Adds targeted coverage for the bug fixed in a0a87212 (#8624, PR #9063):
- test_aggregate_patch_parameters_preserves_plain_tensor_with_dora:
CPU-only unit test that feeds a plain torch.Tensor (as handed in by
_cast_weight_bias_for_input) into _aggregate_patch_parameters with a
DoRA patch. Pre-fix, the tensor was replaced by a meta-device dummy,
tripping DoRA's quantization guard.
- "single_dora" variant in the patch_under_test fixture: exercises the
full CUDA/MPS autocast hot path via
test_linear_sidecar_patches_with_autocast_from_cpu_to_device.
---------
Co-authored-by: Jonathan <34005131+JPPhoto@users.noreply.github.com>
* Repair partially loaded Qwen models after cancel to avoid device mismatches
* ruff
* Repair CogView4 text encoder after canceled partial loads
* Avoid MPS CI crash in repair regression test
* Fix MPS device assertion in repair test
Configure mock logger to return a valid log level for getEffectiveLevel()
to prevent TypeError when comparing with logging.DEBUG constant.
The issue was that ModelCache._log_cache_state() checks
self._logger.getEffectiveLevel() > logging.DEBUG, and when the logger
is a MagicMock without configuration, getEffectiveLevel() returns another
MagicMock, causing a TypeError when compared with an int.
Fixes all 4 test failures in test_model_cache_timeout.py
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
- Remove all trailing whitespace (W293 errors)
- Add debug logging when timeout fires but activity detected
- Add debug logging when timeout fires but cache is empty
- Only log "Clearing model cache" message when actually clearing
- Prevents misleading timeout messages during active generation
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>