[torch-mlir][onnx] how to run torch-mlir python lit unittest

When I build torch-mlir, I hope to be able to use its torch-mlir-import-onnx. How do I build it?
Or how can I go through “python -m torch_mlir.tools.import_onnx xxx.onnx”, but for the latter method, I encountered a python problem when running: TypeError: ‘type’ object is not subscriptable

I also encountered this problem when running the lit use case of torch-mlir.

Can you please file an issue in the project with repro steps (full list of versions as from pip freeze and an ONNX file from a public source which exhibits the issue)?

thanks for reply,
here is full list as from pip freeze :
dataclasses==0.6
filelock==3.16.0
fsspec==2024.9.0
Jinja2==3.1.4
MarkupSafe==2.1.5
mpmath==1.3.0
networkx==3.1
numpy==1.24.4
onnx==1.16.2
packaging==24.1
protobuf==5.28.0
pybind11==2.10.3
PyYAML==6.0.1
sympy==1.13.2
torch @ file:///home/zsh/workspaces/deep-learn-env/mlir/torch-2.3.0.dev20240122%2Bcpu-cp38-cp38-linux_x86_64.whl#sha256=1fcd17e82b6e549e23a2bf21403e83d6c2555441f21a2301aff544d8dfdee86e
torch-mlir @ file:///home/zsh/workspaces/deep-learn-env/mlir/torch_mlir-20240127.1096-cp38-cp38-linux_x86_64.whl#sha256=73d233521f06741a758d4a8a235ffbc41554297fefb1012a9a3c78cb5531a683
typing_extensions==4.12.2


onnx file can find in troch-mlir project
“torch-mlir/test/python/onnx_importer/LeakyReLU.onnx”

run with “python -m torch_mlir.tools.import_onnx torch-mlir/test/python/onnx_importer/LeakyReLU.onnx”
result is

Please file issues in the project. It is not easy to route things reported one off on the mailing list.

In this case, I spotted the issue: the onnx importer is using a form of type annotation introduced with python 3.9.

Since python 3.8 is end of life in less than a month, it is unlikely that anyone will fix this. However, we are not intentionally trying to break 3.8 compatibility and if you absolutely need it, patches will be accepted to use the typing versions of containers like List vs list. Folks who need it have submitted patches in the past. At some point we may do a global cleanup to use the newer form but are in no hurry to do so.

Either upgrade to 3.9 or make the edits to the typing annotations to uppercase the collection names (and import them).

Upgrade python to 3.9 resolve this problem.
Thanks for answering.