Skip to content

Gemma 4 vLLM fallback: check the engine's GPU, not the current one - #14778

Merged
danielhanchen merged 2 commits into
mainfrom
dh/s3-gemma-fallback-engine-gpu
Oct 22, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
dh/s3-gemma-fallback-engine-gpu

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

The Gemma 4 fast_inference fallback (vLLM has no attention backend for it below
sm80) asked torch.cuda.get_device_capability() with no device, which reads the
current card. The vLLM engine runs on unsloth_zoo's target device instead
(cuda:0: unsloth passes no device, and vLLM's UniProcExecutor takes the device
config's index, 0 when unset). On a host with two GPU models the check could
answer for the wrong card:

Current card Engine card (cuda:0) Before After
T4 (sm75) A100 (sm80) vLLM switched off vLLM kept
H100 (sm90) T4 (sm75) vLLM kept, cannot run Gemma 4 falls back

Changes

  • New _vllm_engine_device(): unsloth_zoo.vllm_utils.get_target_device(), or
    cuda:0 when an older zoo lacks it.
  • _vllm_needs_newer_gpu probes that device's capability.

One GPU hosts are unchanged: the engine card is the current card. Non CUDA
devices and a failed probe behave as before.

Tests: tests/test_fast_inference_old_gpu_fallback.py now mocks a per device
capability. The four mixed GPU cases fail on main and pass here; the single GPU
and existing cases pass on both, with a GPU visible and with
CUDA_VISIBLE_DEVICES="".

_vllm_needs_newer_gpu read torch.cuda.get_device_capability() with no
device, which is the current card. fast_inference's vLLM engine runs on
unsloth_zoo's target device (cuda:0; vLLM's UniProcExecutor takes the
device config's index, 0 when unset). With a T4 current and an A100 as
cuda:0 the check switched vLLM off for nothing, and the reverse kept vLLM
on for a card that cannot run Gemma 4. Ask on get_target_device(), falling
back to cuda:0 for an older zoo. One GPU: same card, same answer.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T18:46:01.159998Z b4ecf3c Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: b4ecf3cf1f

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

@danielhanchen
danielhanchen merged commit ad814c6 into main Oct 22, 2026
3 of 29 checks passed
@danielhanchen
danielhanchen deleted the dh/s3-gemma-fallback-engine-gpu branch October 22, 2026 21:13
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