🐛 [Bug] Exporting `OptimizedModule` compiled model
@peri044 is already working on this.
Since Apr 10, 2024.
- Dominant language
- Python
- Stars
- 3k
- Forks
- 410
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 78
Description
Bug Description
Hi All,
How are you?
I'm trying to save complied module but encountering errors. After I compiled my model I noticed that its type is OptimizedModule. Following this guide I was not sure how to save the model since there is no reference to OptimizedModule type. We tried to export the model using the following call trt_exp_program = torch_tensorrt.dynamo.export(trt_mod, [dummy_x.half(), dummy_embed.half()], "ep") but ended up with AttributeError: 'Model' object has no attribute 'graph'.
What is the correct way to save and load OptimizedModule?
Environment
We are using g4dn was machine with the following env:
- Torch-TensorRT:
2.2.0 - PyTorch Version:
2.2.0 - CPU Architecture:
x86_64 - OS (e.g., Linux):
Linux - How you installed PyTorch (
conda,pip,libtorch, source):pip - Python version:
3.9.16 - CUDA version:
11.8 - GPU models and configuration:
Tesla T4
Contributor guide
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.
Assessment
This issue has not been assessed yet.