{"record":{"id":"35914f866afbd525","repo":"Comfy-Org/ComfyUI","slug":"comfy-kitchen-does-not-support-stochastic-fp8-roun","errorCode":null,"errorMessage":"comfy_kitchen does not support stochastic FP8 rounding","messagePattern":"comfy_kitchen does not support stochastic FP8 rounding","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"warning","filePath":"comfy/float.py","lineNumber":15,"sourceCode":"import logging\n\nimport torch\n\n_CK_STOCHASTIC_ROUNDING_AVAILABLE = False\ntry:\n    import comfy_kitchen as ck\n    _ck_stochastic_rounding_fp8 = ck.stochastic_rounding_fp8\n    _CK_STOCHASTIC_ROUNDING_AVAILABLE = True\nexcept (AttributeError, ImportError):\n    logging.warning(\"comfy_kitchen does not support stochastic FP8 rounding, please update comfy_kitchen.\")\n\nif not _CK_STOCHASTIC_ROUNDING_AVAILABLE:\n    def _ck_stochastic_rounding_fp8(value, rng, dtype):\n        raise NotImplementedError(\"comfy_kitchen does not support stochastic FP8 rounding\")\n\n\ndef calc_mantissa(abs_x, exponent, normal_mask, MANTISSA_BITS, EXPONENT_BIAS, generator=None):\n    mantissa_scaled = torch.where(\n        normal_mask,\n        (abs_x / (2.0 ** (exponent - EXPONENT_BIAS)) - 1.0) * (2**MANTISSA_BITS),\n        (abs_x / (2.0 ** (-EXPONENT_BIAS + 1 - MANTISSA_BITS)))\n    )\n\n    mantissa_scaled += torch.rand(mantissa_scaled.size(), dtype=mantissa_scaled.dtype, layout=mantissa_scaled.layout, device=mantissa_scaled.device, generator=generator)\n    return mantissa_scaled.floor() / (2**MANTISSA_BITS)\n\n#Not 100% sure about this\ndef manual_stochastic_round_to_float8(x, dtype, generator=None):\n    if dtype == torch.float8_e4m3fn:\n        EXPONENT_BITS, MANTISSA_BITS, EXPONENT_BIAS = 4, 3, 7\n    elif dtype == torch.float8_e5m2:\n        EXPONENT_BITS, MANTISSA_BITS, EXPONENT_BIAS = 5, 2, 15","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/float.py#L1-L33","documentation":"Logged (logging.warning) at import time of comfy/float.py when the installed comfy_kitchen package either is missing or lacks the stochastic_rounding_fp8 attribute. The module then installs a stub that raises NotImplementedError('comfy_kitchen does not support stochastic FP8 rounding') if any code path attempts stochastic FP8 rounding. It is an environment/version signal, not a runtime exception at import.","triggerScenarios":"Importing comfy.float with an old comfy_kitchen (or none installed, though core normally pins it) that predates the stochastic_rounding_fp8 API. The later NotImplementedError fires only when a code path calls _ck_stochastic_rounding_fp8 (FP8 training/quantization paths that use stochastic rounding).","commonSituations":"Downgrading or skipping comfy_kitchen during a partial ComfyUI update; a custom environment with a manually installed older comfy_kitchen wheel; portable installs where the embedded python libraries got out of sync with the ComfyUI frontend/repo version.","solutions":["Update comfy_kitchen: pip install -U comfy_kitchen (or update ComfyUI which manages the pinned requirement)","If using a portable release, re-run its update script so the embedded packages match the repo commit","If the warning appears but you never use stochastic FP8 rounding, it can be safely ignored"],"exampleFix":"# before (stale env)\npip show comfy_kitchen   # old version, no stochastic_rounding_fp8\n# after\npip install --upgrade comfy_kitchen","handlingStrategy":"validation","validationCode":"import comfy_kitchen as ck\nif not hasattr(ck, 'stochastic_rounding_fp8'):\n    raise RuntimeError('Update comfy_kitchen: pip install -U comfy_kitchen')","typeGuard":null,"tryCatchPattern":"try:\n    from comfy.float import _ck_stochastic_rounding_fp8\nexcept NotImplementedError:\n    log.warning('stochastic FP8 rounding unavailable; update comfy_kitchen')\n    use_deterministic_rounding = True","preventionTips":["Keep comfy_kitchen pinned in lockstep with the ComfyUI version","Update portable installs via their update script, not partial pip installs"],"tags":["environment","fp8","comfy-kitchen","version-mismatch","import-warning"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}