mirror of
https://github.com/Comfy-Org/comfy-kitchen.git
synced 2026-11-04 23:37:42 +00:00
[GH-ISSUE #27] Clarification regarding the readme example #13
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#13
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?
Originally created by @sayakpaul on GitHub (Jan 29, 2026).
Original GitHub issue: https://github.com/Comfy-Org/comfy-kitchen/issues/27
How is
weight_qtcomputed in this case?Also, is it recommended to quantize the input (which seems to be
qtin this case) instead of the weights?@contentis commented on GitHub (Feb 2, 2026):
The
from_floatfunction calls into thequantizefunction from the provided LayoutCls. In this case it would call thisHere we assume that
weight_qtis already an instance ofQuantizedTensor. Usually we have a checkpoint that already has the weights quantized and load them as such directly by creating an instance. If you have a high-precision tensor/weight you could also leveragefrom_floatto quantize it.This entirely depends on your goal and dosen't have a short answer. The TLDR is that we can distinguish between Weight-Only (WoQ) and Weigth+Activation. When using WoQ methods we only quantize the weights and keep the input in high-precision float. When runnning an operation (e.g. MatMul) we upcast the weight into an intermediate buffer and perform the math in high-precision.
out = x @ weight_qt.dequantize()This saved VRAM but has no performance impact (usually a bit slower than high precision) but its easy to do.
For the other we can make use of dedicated Hardware like FP8 Tensor Cores. And this is where we see the performance gains, although often a bit harder to get good quality out of the box.
Here is some more in-depth explaination if you're interested: https://developer.nvidia.com/blog/model-quantization-concepts-methods-and-why-it-matters/
@sayakpaul commented on GitHub (Feb 2, 2026):
Thanks so much!
Oh? I was under the impression that even for weight-only FP8, there can still be kernels written to utilize the dedicated FP8 tensor cores. I guess you meant a workflow like so?
That's what I had assumed but having a fully complete example (potentially with a checkpoint) would have been great as a starting point I believe.
@contentis commented on GitHub (Feb 2, 2026):
Yeah, documentation and tooling could be improved and is something to be looked at. One last minor note, this:
x.cast_to_fp8()is not a cast operation in the classcial sense but a scaled transformation where the tensor is first resaled to match the lower-precisions dynamic range and then catsted (round nearest).@sayakpaul commented on GitHub (Feb 2, 2026):
Yes, of course. Lots of configurations there two in terms of how much granularity one wants (per-row vs. per-tensor, etc.).
Maybe we could keep this thread open till then?