You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
torch.aten.as_strided operation in torch dialect fails to get converted to StableHLO.
This is preventing the conversion of many PyTorch models to StableHLO. I checked that torch.nn.MultiheadAttention operation fails to get converted because of this. Language models from transformers library (e.g., Bert, Qwen) also fail, though I haven't checked whether the underlying cause is same.
How should I enable the conversion?
Runnable example:
PyTorch to StableHLO
There are some PyTorch operations that uses torch.aten.as_strided when converted to torch dialect. One example is torch.chunk.
When I run the code below, I get the error: error: failed to legalize operation 'torch.constant.int'
torch.aten.as_strided
operation in torch dialect fails to get converted to StableHLO.This is preventing the conversion of many PyTorch models to StableHLO. I checked that
torch.nn.MultiheadAttention
operation fails to get converted because of this. Language models from transformers library (e.g., Bert, Qwen) also fail, though I haven't checked whether the underlying cause is same.How should I enable the conversion?
Runnable example:
There are some PyTorch operations that uses
torch.aten.as_strided
when converted to torch dialect. One example istorch.chunk
.When I run the code below, I get the error:
error: failed to legalize operation 'torch.constant.int'
When I change the output_type to
torch
, the resultingmodel.mlir
file is as follows:With the above
model.mlir
file, I ranThe output tmp file shows that the torch dialect operations fail to get converted to stablehlo operations.
Below is the content of the tmp file:
The text was updated successfully, but these errors were encountered: