torch.export failed while exporting alpamayo model (Qwen3_vl) with symbolic error
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 736
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 15
Description
In export the Alpamayo-R1 model (which internally uses Qwen3-VL) using torch.export and then lower it to torch-mlir (ATen dialect).
The export fails due to torch.linspace being called with a data-dependent length, which becomes symbolic during export.
Error message :
During torch.export.export(...), the following error is raised:
torch.fx.experimental.symbolic_shapes.GuardOnDataDependentSymNode: Could not extract specialized integer from data-dependent expression u0
The error originates from a call to torch.linspace.
Problematic code:
`def fast_pos_embed_interpolate(self, grid_thw):
grid_ts, grid_hs, grid_ws = grid_thw[:, 0], grid_thw[:, 1], grid_thw[:, 2]
for t, h, w in zip(grid_ts, grid_hs, grid_ws):
h_idxs = torch.linspace(0, self.num_grid_per_side - 1, h)
w_idxs = torch.linspace(0, self.num_grid_per_side - 1, w)`
Here, h and w are derived from grid_thw and become symbolic integers during export, which causes torch.linspace(..., steps=h) to fail
Related issue:
This appears similar to the following PyTorch issue:
https://github.com/pytorch/pytorch/issues/138116
@zjgarvey , @penguin-wwy , @angelayi , @agunapal
Any guidance on how to resolve this would be very helpful and is the suggestable to modify the code in model
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with fast_pos_embed_interpolate in the Alpamayo-R1/Qwen3-VL model code and reproduce the failure during torch.export.export(...). Read the related PyTorch issue 138116 to compare handling of symbolic steps in torch.linspace. Done means the model exports successfully and can be lowered to the torch-mlir ATen dialect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- compilers, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100