Skip to content

Studio: fix load_freeze audio-type tests for #6000's Gemma 4 <|audio|> probe - #6018

Merged
danielhanchen merged 2 commits into
mainfrom
fix/studio-load-orchestrator-audio-vlm-tests
Jun 5, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
fix/studio-load-orchestrator-audio-vlm-tests

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What

Update the load_freeze simulation suite (tests/studio/load_freeze/test_load_orchestrator.py) so it reflects the audio-detection behavior introduced by #6000.

Why

#6000 ("Studio: enable audio input for Gemma 4 GGUFs") extended LlamaCppBackend._detect_audio_type_strict's audio_vlm arm to also probe Gemma 4's <|audio|> token, in addition to Gemma 3n's <audio_soft_token>:

# Gemma 3n: <audio_soft_token>; Gemma 4: <|audio|> (not csm's <|AUDIO|>).
if len(_tok("<audio_soft_token>")) == 1 or len(_tok("<|audio|>")) == 1:
    return "audio_vlm"

That change is correct, but #6000 did not update this test file (last touched by #5922). Its "no-match" and "bicodec" fixtures only mapped <audio_soft_token> to a 2-token response to defeat the (pre-#6000) Gemma 3n arm. The new <|audio|> probe is left unmapped, so it falls through to FakeLlamaServer's default (tokens = list(range(max(1, len(content.split()) or 1))) → 1 token for a no-whitespace marker), which now satisfies the audio_vlm check.

As a result three equivalence/shape tests fail on main (4c06c1d), all because detect_audio_type now returns 'audio_vlm':

  • test_functional_equivalence_no_match — expected None
  • test_functional_equivalence_bicodec_match — expected 'bicodec' (audio_vlm matches before bicodec in detection order)
  • test_response_shape_matches_pre_fix_for_no_match — expected {'audio_type': None}

This isn't caught by main's push-CI because "Repo tests (CPU)" only runs on pull_request, so the breakage surfaces in every open PR's merge-ref (e.g. it's currently red on the unrelated AMD installer PR #5940).

Fix

Touches only the test file:

  • Map <|audio|> to a 2-token response in the three fixtures whose intent is a non-audio_vlm outcome (shim_no_match, the bicodec fixture, and the test_response_shape_matches_pre_fix_for_no_match fixture). This restores their original semantics now that <|audio|> is a probed marker — exactly mirroring how they already defeat <audio_soft_token>.
  • Add a positive test_functional_equivalence_audio_vlm_match that keeps <audio_soft_token> at 2 tokens and sets <|audio|> to 1 token, so it specifically exercises and locks in Studio: enable audio input for Gemma 4 GGUFs; default chat model to Qwen3.5-4B-MTP #6000's new Gemma 4 <|audio|> arm (sync == to_thread like the other per-codec cases).

Test

$ pytest tests/studio/load_freeze/test_load_orchestrator.py -q
23 passed

$ pytest tests/test_studio_install_workspace_guard.py -q
44 passed

🤖 Generated with Claude Code

danielhanchen and others added 2 commits June 4, 2026 22:37
…probe

#6000 extended LlamaCppBackend._detect_audio_type_strict audio_vlm arm to
also probe Gemma 4 `<|audio|>` (alongside Gemma 3n `<audio_soft_token>`),
but did not update the load_freeze simulation suite (last touched by #5922).
Its "no-match" and "bicodec" fixtures only defeat `<audio_soft_token>`; the
unmapped `<|audio|>` probe falls through to FakeLlamaServer 1-token default,
so detect_audio_type now returns audio_vlm where these tests expect
None / bicodec:

  - test_functional_equivalence_no_match
  - test_functional_equivalence_bicodec_match
  - test_response_shape_matches_pre_fix_for_no_match

main push-CI does not run "Repo tests (CPU)" (pull_request-only), so this
surfaces in every open PR merge-ref (e.g. #5940, which is unrelated to audio).

Fix: map `<|audio|>` to a 2-token response in the three fixtures that intend
a non-audio_vlm result (restoring their original semantics), and add a
positive test_functional_equivalence_audio_vlm_match locking in #6000 new
`<|audio|>` detection.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the test suite in test_load_orchestrator.py to add a new functional equivalence test (test_functional_equivalence_audio_vlm_match) verifying the behavior of the Gemma 4 <|audio|> probe. It also updates existing tests to include the <|audio|> token in their mock token response maps. I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@danielhanchen
danielhanchen merged commit fe37921 into main Jun 5, 2026
22 of 23 checks passed
@danielhanchen
danielhanchen deleted the fix/studio-load-orchestrator-audio-vlm-tests branch June 5, 2026 14:15
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