Repository navigation
fix: AMD multi-GPU detection and misleading error message in tokenizer_utils.py - #4450
Closed
GoldenGrapeGentleman wants to merge 3 commits into
Closed
GoldenGrapeGentleman wants to merge 3 commits into
GoldenGrapeGentleman wants to merge 3 commits into
Conversation
GoldenGrapeGentleman
requested review from
danielhanchen and
mmathew23
as code owners
March 19, 2026 02:41
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
The check injected into SFTTrainer/DPOTrainer/KTOTrainer.train() had two bugs on AMD ROCm hosts: 1. nvidia-smi is absent on AMD systems, so the memory array 'a' was never populated — it stayed as np.array([0.]). This silently bypassed the multi-GPU guard for AMD users even when multiple GPUs were active, because ((a - PRE_CHECK) >= 1).sum() > 1 was always False regardless of actual GPU usage. 2. The error message 'We do not support AMD / Intel machines yet' is misleading: on properly installed ROCm, torch.cuda.is_available() returns True so the error is never raised, but the message still appears in the source and causes confusion. Fix: in the nvidia-smi except block, after confirming a GPU is present, populate 'a' via torch.cuda.memory_reserved() which works on ROCm via HIP, giving one entry per visible GPU. The multi-GPU check then correctly fires on AMD multi-GPU configurations. Update the error message to guide AMD users to install ROCm PyTorch. Tested on 8×AMD MI355X (ROCm 7.1): - nvidia-smi not found → falls through to torch.cuda.memory_reserved - a.shape = (8,) correctly reflects 8 GPUs - multi-GPU check fires as expected ✅ Co-authored-by: billishyahao <[email protected]>
GoldenGrapeGentleman
force-pushed
the
fix/tokenizer-amd-multigpu
branch
from
March 19, 2026 02:43
aa07010 to
fb50daf
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
5 of 7 tasks
This was referenced Apr 8, 2026
Closed
Closed
Closed
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.
Problem
The memory check injected into
SFTTrainer/DPOTrainer/KTOTrainer.train()has two bugs on AMD ROCm hosts:Silent multi-GPU bypass:
nvidia-smiis absent on AMD systems, so the memory arrayastays asnp.array([0.]). The multi-GPU guard((a - PRE_CHECK) >= 1).sum() > 1is alwaysFalseon AMD, regardless of actual GPU count.Misleading error message:
"We do not support AMD / Intel machines yet"appears in source code. On a properly installed ROCm system,torch.cuda.is_available()returnsTrueso this error is never raised — but it causes confusion and discourages AMD users.Fix
In the
nvidia-smiexcept block, after confirming a GPU is present, populateaviatorch.cuda.memory_reserved()— which works on ROCm via HIP — giving one entry per visible GPU. The multi-GPU check then correctly fires on AMD multi-GPU configurations.Update the error message to guide AMD users to install ROCm-enabled PyTorch.
Testing
Verified on 8×AMD MI355X (ROCm 7.1):
nvidia-sminot found → falls through totorch.cuda.memory_reserveda.shape = (8,)correctly reflects 8 GPUs ✅Co-authored-by: billishyahao [email protected]