Skip to content

Refit Engine given PyTorch state_dict #2555

@nrakltx

Description

@nrakltx

I have a TensorRT model and I would like to refit some of its weights.

I created this model by exporting a PyTorch model to ONNX and from there compiling to TensorRT.
It would be impractical to re-compile (+re-export) the model to ONNX and TRT as it is big and this needs to happen many times.

Given my modified torch state_dict, I would like to be automatically able to refit the TRT engine's weights accordingly.

From my research, it seems exporting torch to ONNX doesn't provide a 1:1 mapping of weight names (or shapes), and even less so ONNX -> TRT. If no automatic method is found, it becomes far harder to refit, as a manual mapping of each of the (many) weights of the model would need to be computed by a human.

Is there some way this could still be done?
If not, could an ONNX -> TensorRT mapping be deduced somehow at least?

Thank you very much in advance,

N

Metadata

Metadata

Assignees

Labels

triagedIssue has been triaged by maintainers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions