Skip to content

install torch-mlir from pip but nothing can run #4305

@YilanWang

Description

@YilanWang

thx for the great job! I install from pip and the torch-mlir cannot act anything,
the install cmd:

# I download the whl to the local machine
pip install ../../file/torch_mlir-20250607.491-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

and when I want to run the case in #3935 ,I find these bugs:

Python 3.11.13 | packaged by conda-forge | (main, Jun  4 2025, 14:48:23) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch_mlir
>>> torch_mlir.__
torch_mlir.__annotations__     torch_mlir.__eq__(             torch_mlir.__gt__(             torch_mlir.__lt__(             torch_mlir.__reduce__()        torch_mlir.__str__()
torch_mlir.__class__(          torch_mlir.__file__            torch_mlir.__hash__()          torch_mlir.__name__            torch_mlir.__reduce_ex__(      torch_mlir.__subclasshook__(
torch_mlir.__delattr__(        torch_mlir.__format__(         torch_mlir.__init__(           torch_mlir.__ne__(             torch_mlir.__repr__()          
torch_mlir.__dict__            torch_mlir.__ge__(             torch_mlir.__init_subclass__(  torch_mlir.__new__(            torch_mlir.__setattr__(        
torch_mlir.__dir__(            torch_mlir.__getattribute__(   torch_mlir.__le__(             torch_mlir.__package__         torch_mlir.__sizeof__()        
torch_mlir.__doc__             torch_mlir.__getstate__()      torch_mlir.__loader__          torch_mlir.__path__            torch_mlir.__spec__            
>>> torch_mlir.complile
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'torch_mlir' has no attribute 'complile'
>>> torch_mlir.
KeyboardInterrupt
>>> import torch
>>> class Wrapper(torch.nn.Module):
...     def __init__(self) -> None:
...         super().__init__()
...     
...     def forward(self, x, y):
...         self.res = torch.add(x,y)
...         return self.res
... 
>>> model = Wrapper()
>>> model.eval()
Wrapper()
>>> out_tosa_mlir_path = "./vecadd_tosa.mlir"
>>> x = torch.randn(64 * 1024)
>>> y = torch.randn(64 * 1024)
>>> alpha = 2
>>> module = torch_mlir.compile(model, [x,y],output_type=torch_mlir.OutputType.TOSA, use_tracing=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'torch_mlir' has no attribute 'compile'
>>> help(torch_mlir.fx_export_and_import)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'torch_mlir' has no attribute 'fx_export_and_import'
>>> help(torch_mlir.complie)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'torch_mlir' has no attribute 'complie'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions