Commit dd5758b
fix: SDXL DoRA LoRA fails with enable_partial_loading=true (invoke-ai#9063)
* 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#8624
* test: regression coverage for DoRA + partial-loading + CPU→device autocast
Adds targeted coverage for the bug fixed in a0a8721 (invoke-ai#8624, PR invoke-ai#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>1 parent 0531108 commit dd5758b
2 files changed
Lines changed: 59 additions & 0 deletions
File tree
- invokeai/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules
- tests/backend/model_manager/load/model_cache/torch_module_autocast/custom_modules
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
346 | 347 | | |
347 | 348 | | |
348 | 349 | | |
| 350 | + | |
349 | 351 | | |
350 | 352 | | |
351 | 353 | | |
| |||
432 | 434 | | |
433 | 435 | | |
434 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
435 | 451 | | |
436 | 452 | | |
437 | 453 | | |
| |||
676 | 692 | | |
677 | 693 | | |
678 | 694 | | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
0 commit comments