Repository navigation
Studio video: refuse a NaN render on the native MiniMax-H3 route - #15394
Merged
Merged
Conversation
…ing it sd.cpp has no NaN check and exits 0 on a NaN render. Its VAE tails clamp on the device, and ggml's clamp maps NaN to the lower bound on CUDA and to the upper one on the CPU backend, so the clip comes back as flat black (or white) frames over a constant full-scale PCM soundtrack. Refuse exactly that fingerprint with the existing NonFiniteFramesError message, behind UNSLOTH_VIDEO_NONFINITE_CHECK. A flat black clip with real or silent audio, a dark clip, and a clip without audio are kept; an unreadable clip never fails the render.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Summary
The MiniMax-H3 native route (stable-diffusion.cpp sd-server / sd-cli) now refuses a NaN render with the same
NonFiniteFramesErrormessage the Diffusers path uses (#15339, #15374), instead of saving a black clip. The check is behind the existingUNSLOTH_VIDEO_NONFINITE_CHECKkill switch.Why a check on the returned clip
sd.cpp has no NaN / inf check of its own. A NaN render logs nothing unusual, exits 0, and writes the clip. Studio only gets an encoded container back (MJPEG + PCM in AVI from sd-server, VP8 + PCM in WebM from sd-cli), so there is no float clip to check.
What a NaN render turns into:
fminf/fmaxf) NaN becomes the lower bound. On the CPU backend (MIN/MAXmacros) it becomes the upper bound. This was measured against ggml on both backends.A flat-frame check alone is not safe. A legitimate night scene a few levels above black decodes almost flat after the lossy MJPEG / VP8 encode. The soundtrack is what tells the two apart: no generated soundtrack is a single full-scale DC level for the whole clip.
Change
h3_native_clip_is_nan_render(path)(video_minimax_h3.py, torch-free). It flags a clip only when it has an audio track whose every sample is one full-scale level, and every frame is exactly black (or white). It reads the audio first, so a normal clip costs one PCM decode._generate_h3_nativeruns it beforeinspect_video, which covers both the server and the CLI routes. A match raisesNonFiniteFramesError(NON_FINITE_FRAMES_MSG), whichvideo_failure_detailalready maps for the UI. A probe that cannot read the clip never fails the render.These clips are always kept: flat black with real or silent audio, a dark clip, a clip without audio, and real frames over a broken soundtrack.
Tests
tests/test_h3_native_nonfinite.pywrites clips the way sd.cpp writes them, in both containers.pytest -n 4over the new file, test_video_backend.py, test_video_static_skip.py, tests/test_sd_cpp*.py and tests/test_h3_native_*.py: 2205 passed, 1 skipped.Limits