fix(converter): detect SGLang device backend - #116
Merged
chaokunyang merged 1 commit intoAug 19, 2026
Conversation
Le8r0nJames
marked this pull request as ready for review
August 17, 2026 07:18
chaokunyang
approved these changes
Aug 19, 2026
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.
What does this PR do?
This PR makes the SGLang weight converter use AWEX's shared runtime device
detection instead of inferring the device backend from visibility environment
variables.
Explicit
device_backend/device_typeconfiguration and the HCCL backendcontinue to take precedence. When they are absent, the converter now delegates
to
device_util.get_device_type().Some launchers export both
CUDA_VISIBLE_DEVICESandASCEND_RT_VISIBLE_DEVICES. Previously, the presence of the Ascend variablecaused a CUDA process to be misclassified as NPU, which could incorrectly apply
NPU-specific weight conversion behavior.
A regression test covers the case where both visibility variables are present
while CUDA is the available runtime device.
Related issues
None.
Does this PR introduce any user-facing change?
No public API or binary protocol changes. Device backend selection now reflects
the configured or actually available runtime device instead of relying on
visibility environment variables.
Validation
ruff check awex/converter/sglang_converter.py awex/tests/test_qwen3_moe_sglang_converter.pyruff format --check awex/converter/sglang_converter.py awex/tests/test_qwen3_moe_sglang_converter.pypytest awex/tests/test_qwen3_moe_sglang_converter.py awex/tests/test_qwen3_dense_sglang_converter.py awex/tests/test_meta_resolver.py awex/tests/test_model_registry.py -q