Nodes/RES4LYF/Set Precision
ComfyUI Node Runs on cloud

Set Precision

Run RES4LYF sampling in float32 or float64

By ClownsharkBatwing·Created 2 years ago·Updated 18 days ago· 1,222
Set Precision
  • latent_image
  • passthrough
precision
set_defaultfalse

RES4LYF is unusual in that it cares about numeric precision more than almost any other node pack. Its high-order and implicit solvers do a lot of small arithmetic per step, and rounding error compounds - so the pack lets you crank the working precision up past the fp16 everyone normally samples at. Set Precision is the node that does it: it tags a latent so the sampler runs it at 16-, 32-, or 64-bit float.

If you've ever wondered why a RES4LYF workflow you copied has this odd little node wired near the empty latent, that's why. The author's other nodes default to float64 for exactly this reason - accuracy first, speed second.

How it works

It sits on the latent path and stamps the requested precision onto the latent as it passes through. The sampler downstream reads that and does its math in the chosen float type. More bits means each sampling step is computed more accurately, which matters most for the pack's fancier solvers (the res_s family, the implicit ones) where error accumulates fastest. It's a passthrough - the latent goes in one side and comes out the other unchanged except for the precision tag.

The inputs and outputs that matter

Three inputs, one latent out:

  • latent_image (LATENT) - the latent to tag. Output is passthrough (LATENT), which continues to your sampler.
  • precision - 16, 32, or 64. This is the whole node. 32 is the sensible middle ground: clearly more accurate than 16, far cheaper than 64. 64 is maximum accuracy for when you're chasing the last bit of quality out of an implicit sampler. 16 is fastest and lightest on VRAM.
  • set_default (default false) - flip to true to make this the global default precision for the run rather than just this latent. Handy if you want everything downstream at the same precision without threading it through every node.

How to install it

ComfyUI Manager: search RES4LYF, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ClownsharkBatwing/RES4LYF
cd RES4LYF
pip install -r requirements.txt

Portable ComfyUI: use the embedded pip. Restart, hard-refresh with F5. No downloads.

Common issues & troubleshooting

float64 tanked my speed. Expected, and sometimes dramatically so. Consumer GPUs are built for fp16/fp32; their fp64 throughput can be a small fraction of that, so 64-bit sampling can be many times slower. If a workflow crawled after you set 64, drop to 32 - the visible quality gap between 32 and 64 is usually tiny, and 32 is already a big step up from 16.

Out of memory. Higher precision means bigger tensors. If 64 OOMs on a large image, go to 32, or shrink the resolution.

No visible difference. On the plain converging samplers (euler, res_2m) at normal step counts, you may not see much between 32 and 64. Precision pays off most with the slow implicit solvers and very low step counts, where every step has to be accurate. If you're on a simple sampler, don't sweat it - 32 is plenty.

Where to put it. Keep it on the latent line feeding the sampler. It's a passthrough, so it won't alter your image on its own - if you removed it and nothing changed, you were probably already at a precision the sampler was happy with.

CategoryRES4LYF/precision

Inputs (3)

NameTypeDefaultDescription
latent_imageLATENT
precisionCOMBO3 options: 16, 32, 64
set_defaultBOOLEANfalse

Outputs (1)

NameTypeDescription
passthroughLATENT