pytorch / pytorch/TensorRT

❓ [Question] How to save the compiled while using torch.compile

Open
#3,525 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question story: Documentation & Examples
Dominant language
Python
Stars
3k
Forks
410
Avg merge
3d 18h
Merged PRs (30d)
78

Description

For the example below, how do I save the compiled model?

backend = "torch_tensorrt"
tp_model = torch.compile(
tp_model,
backend=backend,
options={
"truncate_long_and_double": True,
"enabled_precisions": {torch.float32, torch.float16},
"use_python_runtime": True,
"min_block_size": 1,
},
dynamic=False,
)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the torch.compile entry point and the options shown in the issue, then determine how a model compiled with the torch_tensorrt backend can be persisted. Done means documenting a reproducible save-and-reload procedure, including any limitations of the shown configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.