Commit Graph
212 Commits
Author SHA1 Message Date
rdp c0cc2805e9 Fix "addmm_cuda" not implemented for 'Char' crash when using INT8GroupedLora 2026-06-10 15:28:17 +03:00
BobJohnson24 d3e64e6be2 Update README.md 2026-06-08 16:54:42 +07:00
BobJohnson24 cdf266597a Update pyproject.toml 2026-06-08 16:53:42 +07:00
BobJohnson24 2acbfdade7 Merge pull request #67 from BobJohnson24/Dtype-fix
Make the dtype setting functional
2026-06-08 16:49:55 +07:00
BobJohnson24 639ee8148f Update README.md 2026-06-08 16:36:43 +07:00
BobJohnson24 11444c6270 Update README.md 2026-06-08 16:35:27 +07:00
BobJohnson24 1a13309ba4 Update README.md 2026-06-08 16:32:28 +07:00
BobJohnson24 156ce18037 Update README.md 2026-06-08 16:32:17 +07:00
BobJohnson24 ea2d097f12 Update README.md 2026-06-08 16:32:06 +07:00
BobJohnson24 06e1afbabf Create Speed.md 2026-06-08 16:30:15 +07:00
BobJohnson24 0865ca0111 Create Models.md 2026-06-08 16:29:17 +07:00
BobJohnson24 041148b096 Handle disabling of offloading after dynamic model load 2026-06-08 15:40:17 +07:00
BobJohnson24 8202d5aeb5 actually do the thing instead of comitting the wrong version 2026-06-08 00:39:19 +07:00
BobJohnson24 cdc0989b0c Determine device for dtype 2026-06-08 00:23:14 +07:00
BobJohnson24 7fd94ceb1b Merge branch 'main' into Dtype-fix 2026-06-07 23:17:53 +07:00
BobJohnson24 0e973d85c1 Update convrot.py 2026-06-05 14:41:24 +07:00
BobJohnson24 440f080ecc Update README.md 2026-06-04 03:55:30 +07:00
BobJohnson24 a23db4daf4 Update pyproject.toml 2026-06-04 02:09:29 +07:00
BobJohnson24 588e8724ed Update README.md 2026-06-04 01:51:42 +07:00
BobJohnson24 d79cd6e81a Migh as well 2026-06-04 01:26:43 +07:00
BobJohnson24 38c1ec3d4f initial ideogram support 2026-06-04 01:23:51 +07:00
BobJohnson24 319deac131 Make the dtype setting functional 2026-06-03 02:56:11 +07:00
BobJohnson24 c62b72835e Merge pull request #66 from Ph0rk0z/compilefix
Fix post compile nodes from failing/recompiling
2026-06-03 02:15:22 +07:00
Your Name 0873d36736 Fix line endings error hopefully 2026-05-31 14:56:41 -05:00
BobJohnson24 c30fbaa251 Update pyproject.toml 2026-05-25 17:13:15 +07:00
BobJohnson24 fa9e6aa94f Additional fixes for lora 2026-05-25 17:11:39 +07:00
BobJohnson24 2ed1a51610 Merge pull request #55 from L33chKing/main
Several bug fixes
2026-05-25 17:10:45 +07:00
BobJohnson24 b606a7501a Merge pull request #57 from BobJohnson24/Fixing-The-Damn-RAM-usage-for-real
Finally
2026-05-24 19:52:40 +07:00
BobJohnson24 c4335ae250 Update pyproject.toml 2026-05-24 19:51:45 +07:00
BobJohnson24 b4d952c0be Update README.md 2026-05-24 18:52:21 +07:00
BobJohnson24 13bd50ad7c Update README.md 2026-05-24 18:52:01 +07:00
BobJohnson24 5e278e8669 Update README.md 2026-05-24 18:47:16 +07:00
BobJohnson24 e4d3045fbb Update README.md 2026-05-24 18:46:53 +07:00
BobJohnson24 274c62f514 Update README.md 2026-05-24 18:40:41 +07:00
BobJohnson24 0785f63ccd Fallback for comfy <0.22.0 2026-05-24 02:03:03 +07:00
BobJohnson24 0d3c0dfbe8 forgor to add pin state needed for big models 2026-05-24 01:35:34 +07:00
BobJohnson24 b4f4200e1b Fix for loras on models with .bias weights (WAN) 2026-05-23 23:49:49 +07:00
BobJohnson24 bc2e049725 Get rid of b16 weights during on the fly quant 2026-05-23 18:26:22 +07:00
BobJohnson24 c1f8cae2f4 Add files via upload 2026-05-23 17:09:17 +07:00
l33chKing 8e772b2283 Summary of Changes
Bug 1 — Save after INT8 Grouped LoRA produces corrupted/unloadable checkpoint
Root cause: ModelPatcher.clone() constructs a fresh patcher and does not carry over arbitrary attributes that the loader had attached to the source patcher (_safetensors_metadata). After INT8GroupedLora.apply_loras() calls model.clone(), the metadata stash is gone, so INT8ModelSave writes a checkpoint with empty safetensors metadata.
Some model types (notably LTX2 — which keeps its transformer config in metadata) then fail to redetect on reload, and the file appears smaller because the metadata header is empty.

Fixes:

int8_unet_loader.py:225-235 — Stash metadata in two places: on the patcher (legacy) and on the inner model.model object (_int8_source_metadata). Inner-model attributes survive clone() because it shares the inner model by reference.
int8_lora.py:31-45 — Best-effort copy of _safetensors_metadata / _int8_source_metadata from the source patcher onto the cloned one in INT8GroupedLora.apply_loras.
int8_save.py:12-40 — New _resolve_source_metadata() that walks the patcher → parent chain and the inner-model fallback, plus a warning when nothing is found.
Bug 2 — Save node was collecting extra_keys BEFORE LoRA bake
comfy.sd.save_checkpoint internally triggers load_models_gpu, which is when the INT8ModelPatcher actually bakes LoRA patches into the int8 weights. The previous save node iterated modules before that, so on the LoRA-stacked path:

mark_module_for_direct_save was being called against the pre-bake module identity.
comfy_quant extra_keys were emitted against pre-bake state.
After save_checkpoint baked patches via set_attr(module, "weight", new_int8_param), the saved bytes were the patched int8 weights but with metadata that may or may not have observed the post-bake state cleanly.
Fix (int8_save.py:120-154): Pre-call comfy.model_management.load_models_gpu([model], force_full_load=True) so all LoRA patches are baked and comfy_patched_weights = True is set on every module before we walk it. Then re-finalize any aimdo-deferred layers, then collect extra_keys.

Bug 3 — OTF quantization round-trip was fragile
OTF-quantized layers were never stamping _convrot_groupsize on the module, so the save side fell back to the loader-time default (currently CONVROT_GROUP_SIZE = 256). It happened to match on reload, but any future change to the default would silently corrupt round-trips, and the saved comfy_quant JSON had no convrot_groupsize field at all.

Fixes:

int8_quant.py:254-257 and int8_quant.py:443-454 — Set self._convrot_groupsize = CONVROT_GROUP_SIZE whenever OTF (or the deferred aimdo finalize) actually applies a Hadamard rotation.
int8_save.py:166-187 — Always emit convrot_groupsize in comfy_quant whenever convrot=True, falling back to the module-level constant if _convrot_groupsize is somehow missing. Also emit per_row so the loader can pick the matching forward kernel without re-inspecting tensor shapes.
int8_quant.py:340-396 — Parse the new per_row hint in comfy_quant and use it to override the shape-based heuristic in _load_from_state_dict. Existing files (without per_row) continue to work via the original shape heuristic.
Files changed
int8_save.py — Restructured save flow, added metadata resolver, save convrot_groupsize and per_row deterministically, pre-load patches before extra_keys collection, robust fallback path.
int8_unet_loader.py:225-235 — Stash _int8_source_metadata on the inner model so it survives clone().
int8_lora.py:31-45 — Copy metadata attributes onto the cloned patcher in INT8GroupedLora.apply_loras.
int8_quant.py:240-256, 340-352, 371-401, 443-454 — Stamp _convrot_groupsize during OTF and aimdo-deferred finalize, parse per_row hint from comfy_quant.
Notes on the OTF "worse quality than pre-quantized" report
After re-tracing the OTF → save → reload path carefully (Hadamard rotation, per-row scale, bias preservation, dtype tracking) I was not able to find a save-side bug that would degrade quality.
The OTF and pre-quantized paths use the same quantize_int8_axiswise(weight, dim=1) code, the same forward kernels, and now write the same comfy_quant payload.
The most plausible source of the perceived quality gap is that pre-quantized HF checkpoints were calibrated with a different excluded_names list per model than what Int8TensorwiseOps.excluded_names uses for the same model in this loader; that is a calibration choice, not a bug in the save/reload path.
If a concrete reproduction (same workflow, same seed, OTF-then-save vs HF-prequant) shows a measurable delta, the fix would belong in the per-model excluded_names table in int8_unet_loader.py, not in the save node.
2026-05-20 17:27:21 +03:00
BobJohnson24 7ff676cbf2 Update pyproject.toml 2026-05-16 14:58:16 +07:00
BobJohnson24 09a5d43b7b LTXV2 Workflow 2026-05-16 02:32:50 +07:00
BobJohnson24 13a51334e4 Fixes for LTXV2 2026-05-16 00:46:21 +07:00
BobJohnson24 9f9e980b4d Update pyproject.toml 2026-05-15 19:10:57 +07:00
BobJohnson24 fe86aca296 No need for debug print 2026-05-15 19:10:28 +07:00
BobJohnson24 db81b4e123 Fix saving with our new loader approach 2026-05-15 19:09:02 +07:00
BobJohnson24 cdc481f5c5 Update README.md 2026-05-15 18:26:27 +07:00
BobJohnson24 81c854f0c1 Update README.md 2026-05-15 14:32:40 +07:00
BobJohnson24 6df0e8c23f Update pyproject.toml 2026-05-15 13:54:06 +07:00
BobJohnson24 59ef554a09 Merge pull request #46 from BobJohnson24/RAMExp
Better RAM Management
2026-05-15 13:53:34 +07:00