Does torch-mlir support input binary TorchScript model (*.pt) and convert it to Torch Dialect MLIR directly (not python)

Hi, friends.

Does torch-mlir support import binary TorchScript model (*.pt) and convert it to Torch Dialect MLIR directly (not python)?

I have implemented the above feature with python: import .pt file via Python’s torch.jit.load (model) and convert it to torch dialect MLIR via torch_mlir.compile().

Now I want to make a tool with C++, I can use libTorch to import .pt file via torch::jit::load(), but how to convert it to RAW MLIR? Please help me?

If I can convert the .pt file to RAW MLIR, then I can convert it to other dialect mlir via torch-mlir-opt tool.

As far as I know, torch-mlir-opt tool does not support .pt file, it only supports .mlir files, as follows:

torch-mlir-opt -pass-pipeline='builtin.module(torchscript-module-to-torch-backend-pipeline{backend-legal-ops=torch.aten.flatten.using_ints})' ./raw.mlir >torch.mlir

thanks.

Can you ask this on our Discord or via a github issue? We generally prefer to take such questions there.

See GitHub - llvm/torch-mlir: The Torch-MLIR project aims to provide first class support from the PyTorch ecosystem to the MLIR ecosystem.

Thank you.
This is the Issue: How to input TorchScript model file (*.pt) and convert it to Torch MLIR directly (not python) · Issue #2099 · llvm/torch-mlir (github.com)