Skip to content

tests: do not read a host refusal as an H3 reference-load regression - #8638

Merged
danielhanchen merged 2 commits into
mainfrom
ci/h3-reference-test-host-preconditions
Aug 13, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
ci/h3-reference-test-host-preconditions

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

test_a_quantized_reference_load_resolves_the_reference_denoiser treats any ValueError out of validate_load_request as "ref2va <scheme> should be loadable but was refused". Two of that function's refusals are about the machine rather than the request:

  • Metal cannot place the modular workflow at all. _load_h3_modular_pipeline hands every non-CPU device to ComponentsManager.enable_auto_cpu_offload, which reads torch.<device>.mem_get_info, and torch.mps has never exposed it (video.py:1040).
  • A diffusers without the bundled revision has no MiniMaxH3Transformer3DModel to build (video.py:1107).

On either host the test reports a regression in a pairing that was never in question.

Why it has not been seen in CI

studio-backend-ci.yml runs the backend suite on ubuntu-latest only, so test_video_backend.py has never run on macOS. Running it there is what surfaced this:

FAILED studio/backend/tests/test_video_backend.py::test_a_quantized_reference_load_resolves_the_reference_denoiser
  Failed: ref2va int8 should be loadable but was refused: 'minimax-h3' cannot run on Apple
  Silicon: its Modular Diffusers workflow places components through the Diffusers auto CPU
  offload, which needs a torch device exposing mem_get_info, and Metal (MPS) does not have it.

It also fires on any checkout carrying a different diffusers, which is the form it takes locally.

Changes

  • _h3_pipeline_load_is_attemptable(fam) evaluates the same two conditions the product tests: the resolved device target, and assert_pipeline_class_available plus the transformer class for a modular family.
  • The refusal check runs only where the load can actually be attempted. The prequant resolution is a registry lookup that holds on every host, so it stays unconditional and macOS keeps covering it.

The guard is not a blanket suppression. With it forced on, the test still fails on a genuine refusal, which is how I verified it:

Failed: ref2va int8 should be loadable but was refused: MiniMax-H3 needs the Diffusers
revision bundled with this Studio version.

Validation

  • tests/test_video_backend.py: 214 passed (the case was red on this checkout before the change, for the diffusers-revision form).
  • Ruff clean.

Worth considering separately: the reason this sat unnoticed is that the backend suite has no macOS leg. Adding one would catch this class of thing, at the cost of another job on an already busy queue, so I have left that call out of this PR.

test_a_quantized_reference_load_resolves_the_reference_denoiser fails any ValueError out of
validate_load_request as "ref2va <scheme> should be loadable but was refused". Two of that
function's refusals are about the machine rather than the request: Metal cannot place the modular
workflow at all, since torch.mps exposes no mem_get_info for the auto CPU offload, and a diffusers
without the bundled revision has no transformer class to build.

On either host the test reports a regression in a pairing that was never in question. It goes
unnoticed because studio-backend-ci.yml runs the backend suite on ubuntu-latest only, so the file
has never run on macOS; it shows up the moment it does, and on any checkout carrying a different
diffusers.

The refusal check is now gated on the same two conditions the product tests, so it runs wherever
the load can actually be attempted and is skipped where it cannot. The prequant resolution is a
registry lookup that holds on every host, so it stays unconditional and macOS keeps covering it.
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Aug 13, 2026
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Aug 13, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 316679984e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment on lines +2128 to +2129
import diffusers
return hasattr(diffusers, fam.transformer_class)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat unimportable diffusers as an unattemptable host

When diffusers is absent or its top-level import fails, assert_pipeline_class_available deliberately absorbs that error in non-strict mode and returns, so execution reaches this unguarded import and the test fails before the existing except Exception around validate_load_request can handle the host limitation. This regresses the test on supported torch-free/native-engine installations; wrap the import and transformer probe in the same host-availability guard and return False when either raises.

Useful? React with 👍 / 👎.

assert_pipeline_class_available answers only whether the installed diffusers is new
enough, so under its default non-strict mode an unimportable one returns instead of
raising. Control therefore reached the modular-workflow probe below it, whose bare
import diffusers raised ModuleNotFoundError straight out of the helper -- past the
caller's own except Exception -- and failed the test on a host that simply has no
diffusers. studio.txt does not install one, so that host is supported, not exotic.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79205069b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

except Exception:
# Anything past the quant check (the diffusers probe) is not this test's business.
pass
if check_refusal:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the validation assertion active in backend CI

In the Backend CI workflow (.github/workflows/studio-backend-ci.yml), every Python matrix job installs studio.txt, torch, and transformers, but not requirements/diffusers-pin.txt; since studio.txt deliberately does not install diffusers, this condition is false and validate_load_request is never called in the environment that runs this test. The remaining resolve_prequant_source assertion only checks the filename registry, so a regression that makes video_family_prequant_available reject either ref2va scheme would now pass all CI jobs. Stub the H3 diffusers/device prerequisites for this validation assertion rather than conditionally removing it.

Useful? React with 👍 / 👎.

@danielhanchen
danielhanchen merged commit 620bd47 into main Aug 13, 2026
36 of 41 checks passed
@danielhanchen
danielhanchen deleted the ci/h3-reference-test-host-preconditions branch August 13, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant