{{ message }}
Repository navigation
[staging CI] unslothai/unsloth#14510 - #511
Closed
danielhanchen wants to merge 10 commits into
Closed
danielhanchen wants to merge 10 commits into
danielhanchen wants to merge 10 commits into
Conversation
An fp8 or fp8_scaled ComfyUI Krea 2 file (13 GB) on a GPU with no fp8 runtime is widened to bf16 in host RAM (about 26 GB) before the denoiser is placed. With too little free memory the process was killed (Linux OOM killer, Windows commit limit), taking the whole app down instead of failing the load. Price the new host memory from the safetensors header (tensors already at the compute dtype stay memory-mapped and cost nothing) and refuse with a readable message before any widening, in both the original-layout loader and the ComfyUI-quantized loader. UNSLOTH_DIFFUSION_HOST_RAM_CHECK=0 skips the check.
for more information, see https://pre-commit.ci
With an fp16 pipeline and _keep_in_fp32_modules the ComfyUI loader only postpones the dtype choice; with no fp8 runtime (never available off bf16) every quantized layer is still expanded. Price those layers as widened, and block formats under a key map, which are always dequantized.
An nvfp4 header describes packed uint8 with K / 2 columns, while the dequantization allocates the dense N x K weight, so the check counted half of it. nvfp4 is the only packed ComfyUI format the loader reads; int8, fp8 and mxfp8 store one code per element.
The header estimate could not see per-layer choices the loader makes later, so it kept drifting from what was really written: layers a runtime filter rejects are still dequantized, a kept nvfp4 weight gets a nibble-swapped copy plus untiled scales, and FNUZ float8 tensors were skipped entirely. A HostRamBudget now holds free RAM minus the small-host reserve for the whole load. The header estimate still refuses up front (it now prices FNUZ float8 too), and every allocating helper (dequant, dequant_block, the nibble swap, scale untiling, dtype casts, segment joins) charges the budget before it allocates, so the load is refused before the allocation that would not fit instead of running the host out of memory.
With UNSLOTH_DIFFUSION_HOST_RAM_CHECK=0 (or host RAM unreadable) the budget could never refuse, but it was still installed and charged by every helper. Leave it inactive so the kill switch costs nothing. [skip ci]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Disposable CI run for unslothai#14510. Do not merge; closed after CI.