Skip to content

fix(sglang): tolerate missing CUDA graph memory tag - #2358

Open
YeonwooSung wants to merge 1 commit into
THUDM:mainfrom
YeonwooSung:fix/1462-optional-cuda-graph-tag
Open

fix(sglang): tolerate missing CUDA graph memory tag#2358
YeonwooSung wants to merge 1 commit into
THUDM:mainfrom
YeonwooSung:fix/1462-optional-cuda-graph-tag

Conversation

@YeonwooSung

Copy link
Copy Markdown

Summary

Hard-importing GPU_MEMORY_TYPE_CUDA_GRAPH from sglang.srt.constants crashes on the official AMD image, whose sglang build does not define that constant. Resolve the tag with getattr and omit it from KV onload when it is missing so train.py can import.

Fixes #1462

Changes

  • Import sglang.srt.constants as a module and bind GPU_MEMORY_TYPE_CUDA_GRAPH with getattr(..., None) instead of a hard import.
  • RolloutServer.onload_kv includes the CUDA graph tag only when the symbol exists; KV cache is always requested.
  • Add a CPU unit test (NUM_GPUS = 0) that loads engine_group with a stubbed sglang.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)

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

cannot import name 'GPU_MEMORY_TYPE_CUDA_GRAPH' from 'sglang.srt.constants'

1 participant