mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[PR #52] Fix crash when running quantized models through torch.compile #107
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-kitchen#107
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-kitchen/pull/52
Author: @jtreminio
Created: 6/25/2026
Status: 🔄 Open
Base:
main← Head:fix-quantized-tensor-torch-compile📝 Commits (3)
54d5cacFix crash when running quantized models through torch.compile9789130Merge branch 'main' into fix-quantized-tensor-torch-compile1f3910aMake CodeRabbit happy📊 Changes
2 files changed (+186 additions, -0 deletions)
View changed files
📝
comfy_kitchen/tensor/base.py(+15 -0)➕
tests/test_unflatten_dynamic_shapes.py(+171 -0)📄 Description
Quantized models could crash during
torch.compilewhenever the input size changes between runs, for example an image model where the prompt length varies, because the quantized tensor wasn't reporting its shape the way PyTorch's compiler expects when it rebuilds the tensor.This change makes that step pass the requested shape and stride through correctly, so compiling quantized models (including mxfp8) now works instead of erroring out, with no change to normal non-compiled use. Includes a regression test that reproduces the original failure.
An example model that crashed is https://huggingface.co/Comfy-Org/Krea-2/blob/main/diffusion_models/krea2_turbo_mxfp8.safetensors
Full disclosure: I am a software engineer but Torch internals are a mystery to me. This PR was heavily assisted with Claude, but I did the code review, I did the testing, I verified this works as intended, and minimized the area of impact for the fix.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.