Skip to content

✨[Feature] Support for 'extra_files' in torch_tensorrt.save/load #3979

@matteo-bruni

Description

@matteo-bruni

Is your feature request related to a problem? Please describe.
Currently, torch_tensorrt.save and torch_tensorrt.load do not expose the extra_files parameter. It is impossible to bundle metadata or configuration directly within the model artifact because these functions do not allow passing this argument to the underlying save/load mechanisms. (see as an example https://github.com/pytorch/TensorRT/blob/2e1fba66d8024ac719e15484d28d3f32fb8552bb/py/torch_tensorrt/_compile.py#L685C17-L685C22)

Describe the solution you'd like
I would like torch_tensorrt.save and torch_tensorrt.load to include the extra_files variable in their signature and pass it internally to the torch.jit.save/load and torch.export.save/load functions, which already support this functionality.

Describe alternatives you've considered
Manually wrapping the torch_tensorrt output into a ZIP archive, adding unnecessary boilerplate.

Additional context
The core PyTorch functions already implement this:

  • torch.jit.save/load (via _extra_files)
  • torch.export.save/load (via extra_files)

The request is simply to expose this existing capability through the torch_tensorrt API to allow for self-contained model packages.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions