fix(sglang): tolerate missing CUDA graph memory tag - #2358
Open
YeonwooSung wants to merge 1 commit into
Open
Conversation
Official AMD images ship an sglang whose constants module lacks GPU_MEMORY_TYPE_CUDA_GRAPH. Resolve that tag with getattr and omit it from KV onload when absent so train.py can import on those images. Fixes THUDM#1462
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
Hard-importing
GPU_MEMORY_TYPE_CUDA_GRAPHfromsglang.srt.constantscrashes on the official AMD image, whose sglang build does not define that constant. Resolve the tag withgetattrand omit it from KV onload when it is missing sotrain.pycan import.Fixes #1462
Changes
sglang.srt.constantsas a module and bindGPU_MEMORY_TYPE_CUDA_GRAPHwithgetattr(..., None)instead of a hard import.RolloutServer.onload_kvincludes the CUDA graph tag only when the symbol exists; KV cache is always requested.NUM_GPUS = 0) that loadsengine_groupwith a stubbedsglang.srt.constants(and ray) and checks both the missing-tag and present-tag cases.Test plan
python -m pytest tests/test_engine_group_memory_tags.py -q(2 passed)