Nodes/RES4LYF/Set Precision Advanced
ComfyUI Node Runs on cloud

Set Precision Advanced

Casting a latent to a specific numeric precision, and inspecting all three at once

By ClownsharkBatwing·Created 2 years ago·Updated 21 days ago· 1,222
Set Precision Advanced
  • latent_image
  • passthrough
  • latent_cast_to_global
  • latent_16
  • latent_32
  • latent_64
global_precision
shark_precision

Most of the time, precision is something you set once for your model and forget about - fp16 or bf16 for generation, fp32 if you're training. RES4LYF's sampling machinery cares about it more granularly than that, because parts of its high-order and implicit solvers can genuinely benefit from more numeric headroom than a diffusion model's weights need, and the pack's Re*Patcher nodes default their own style-guide computations to float64 for exactly that reason. Set Precision Advanced is the debugging/utility node for that world: it takes a latent, casts it to whatever global precision you want to test, and simultaneously gives you all three common precisions as separate outputs so you can compare.

What it's for

This isn't something most RES4LYF users need to touch. It exists for the case where you're troubleshooting a numerical-stability issue - output that looks subtly wrong, NaNs creeping in on a long or high-order sampling run, or you're trying to isolate whether a precision mismatch somewhere in your graph is the actual cause of an artifact. Rather than guessing, you can route a latent through this node and get fp16, fp32, and fp64 versions of it side by side, plus a version cast to whatever your chosen "global" precision is, to compare downstream.

The inputs and outputs that matter

  • latent_image (LATENT, required) - the latent you want to inspect or cast.
  • global_precision - the precision used for the latent_cast_to_global output: 64, 32, or 16.
  • shark_precision - a second precision selector, presumably feeding RES4LYF's own internal ("Shark"-family) sampling precision rather than the plain cast output; treat it as the setting to align with whatever precision your ClownsharKSampler-based pipeline is using elsewhere.

Outputs: passthrough (your original latent, untouched - handy for keeping a reference point in a comparison graph), latent_cast_to_global (cast to global_precision), and latent_16 / latent_32 / latent_64 (the same latent, explicitly cast to each of the three precisions, all at once, so you don't need three separate cast nodes to compare them).

How to install it

Comes with RES4LYF - no separate install. Via 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

No extra dependencies or downloads beyond the pack itself - this is a pure tensor-precision utility, same install as everything else in RES4LYF.

Common issues & troubleshooting

You're not sure why you'd ever need this. Honestly, most people won't - if your sampling is producing clean output and you're not chasing a specific numerical artifact, there's nothing to fix here. It's a diagnostic tool, not something to insert into a normal workflow by default.

VRAM or performance drops when you use latent_64 output. That's expected - 64-bit floats take twice the memory of 32-bit and four times 16-bit, for the same tensor. Use the higher-precision outputs to diagnose a problem, not as your default working precision for an entire pipeline; drop back down once you've confirmed where the issue was.

Casting a latent to float16 introduces visible banding or artifacts on a large-dynamic-range image. That's a real, known cost of low precision, not a bug in this node - it's exactly the kind of thing this node is built to let you demonstrate and compare, by putting the fp16 and fp32/fp64 versions side by side in the same graph.

You expected this to change your sampler's behavior directly. It doesn't patch a sampler or a model - it only casts the latent tensor you feed it. If you're trying to change precision for RES4LYF's style-guide computations specifically, that's the style_dtype setting on the Re*Patcher nodes, not this one.

CategoryRES4LYF/precision

Inputs (3)

NameTypeDefaultDescription
latent_imageLATENT
global_precisionCOMBO3 options: 64, 32, 16
shark_precisionCOMBO3 options: 64, 32, 16

Outputs (5)

NameTypeDescription
passthroughLATENT
latent_cast_to_globalLATENT
latent_16LATENT
latent_32LATENT
latent_64LATENT