[Core] Fix torch.dynamo compatibility for Qwen models on vllm-gaudi #25761
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.
Purpose
Fix critical
torch.dynamo
compatibility issues that prevent Qwen2.5 models from running on vllm-gaudi.This PR addresses three interconnected issues identified during investigation:
make_tensor_with_pad
usedtorch.from_numpy()
, creating tensors incompatible withtorch.dynamo
compilationtorch.dynamo
couldn't compilemax(..., default=0)
syntaxNone
inputs during warmup scenariosError Messages Fixed:
AssertionError: Guard check failed! tensor_from_numpy(stack[0]): dispatch key set mismatch
incorrect arg count <bound method BuiltinVariable._call_min_max of BuiltinVariable(max)> got an unexpected keyword argument 'default'
AttributeError: 'NoneType' object has no attribute 'device'
Test Plan
Local Testing Environment
Qwen/Qwen2.5-14B-Instruct
vllm serve Qwen/Qwen2.5-14B-Instruct --max-model-len 4096 --max-num-seqs 32
Test Result
Before Fix
Server crashed on first inference request.
After Fix
Changes Summary
make_tensor_with_pad
(vllm/utils/init.py): Pure PyTorch implementation eliminates NumPy interop issuesmax(..., default=0)
with conditional expressionEssential Elements Checklist: