| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
fix(gguf): honor ComfyUI's comfy.gguf.orig_shape metadata (#9564) * fix(gguf): honor ComfyUI's comfy.gguf.orig_shape metadata ComfyUI's GGUF converter can only quantize 2-D tensors, so it reshapes any tensor the quantizer rejects and records the native shape under a `comfy.gguf.orig_shape.<tensor name>` KV entry. `gguf_sd_loader` ignored those entries and used the stored shape, so such a checkpoint failed at load with a size mismatch. Concretely, Krea-2's `first.weight` is (6144, 64) but is stored as (1536, 256), which produced: size mismatch for img_in.weight: copying a param with shape torch.Size([1536, 256]) from checkpoint, the shape in current model is torch.Size([6144, 64]) The loader now reads the metadata and uses the declared native shape, rejecting an entry whose element count doesn't match the stored tensor and warning on a malformed one. This is architecture-agnostic, not a Krea-2 special case. Verified end-to-end: the affected checkpoint from the issue installs, loads and generates a coherent image. Closes #9537 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(gguf): reshape numpy dequant fallback and harden orig_shape parsing Follow-up to the comfy.gguf.orig_shape support, addressing review feedback. Qtypes without a torch dequantize kernel fall back to gguf's numpy implementation, which infers the output shape from the stored data. That matched the logical shape only as long as both were identical -- with a ComfyUI-reshaped tensor the fallback returned the stored shape, so loading succeeded and inference then failed. Reshape the fallback output to tensor_shape, as the torch path already does via oshape. Dimension values from comfy.gguf.orig_shape.* were passed straight to int(), which truncates non-integral values (int(2.5) == 2) and raises an uncaught OverflowError on inf. Both contradict the documented warn-and-ignore behaviour. Reject anything that is not a finite, integral, positive number, and verify that the metadata is an array at all. Tests cover the fallback qtype shape and the malformed-metadata cases. --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Jonathan <34005131+JPPhoto@users.noreply.github.com> | 13 天前 | |
fix(gguf): honor ComfyUI's comfy.gguf.orig_shape metadata (#9564) * fix(gguf): honor ComfyUI's comfy.gguf.orig_shape metadata ComfyUI's GGUF converter can only quantize 2-D tensors, so it reshapes any tensor the quantizer rejects and records the native shape under a `comfy.gguf.orig_shape.<tensor name>` KV entry. `gguf_sd_loader` ignored those entries and used the stored shape, so such a checkpoint failed at load with a size mismatch. Concretely, Krea-2's `first.weight` is (6144, 64) but is stored as (1536, 256), which produced: size mismatch for img_in.weight: copying a param with shape torch.Size([1536, 256]) from checkpoint, the shape in current model is torch.Size([6144, 64]) The loader now reads the metadata and uses the declared native shape, rejecting an entry whose element count doesn't match the stored tensor and warning on a malformed one. This is architecture-agnostic, not a Krea-2 special case. Verified end-to-end: the affected checkpoint from the issue installs, loads and generates a coherent image. Closes #9537 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(gguf): reshape numpy dequant fallback and harden orig_shape parsing Follow-up to the comfy.gguf.orig_shape support, addressing review feedback. Qtypes without a torch dequantize kernel fall back to gguf's numpy implementation, which infers the output shape from the stored data. That matched the logical shape only as long as both were identical -- with a ComfyUI-reshaped tensor the fallback returned the stored shape, so loading succeeded and inference then failed. Reshape the fallback output to tensor_shape, as the torch path already does via oshape. Dimension values from comfy.gguf.orig_shape.* were passed straight to int(), which truncates non-integral values (int(2.5) == 2) and raises an uncaught OverflowError on inf. Both contradict the documented warn-and-ignore behaviour. Reject anything that is not a finite, integral, positive number, and verify that the metadata is an array at all. Tests cover the fallback qtype shape and the malformed-metadata cases. --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Jonathan <34005131+JPPhoto@users.noreply.github.com> | 13 天前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 13 天前 | ||
| 13 天前 |