Replies: 1 comment
-
The serializer specially cases on
Curious: in what context do you plan to load the serialized program? Are you loading it in an environment that doesn't have the torch_tensorrt library? In that case, do you not expect the ops/graph to be runnable? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Proposed workflow:
For a simple graph, input -> conv -> relu, here are the options
a) Case 1: Where output of TRT compilation is a TorchTRTModule, the graph looks as follows
Serializing this graph using
GraphModuleSerializer(graph_signature, call_spec).serialize(graph_module)
fails becausecall_module
cannot be serialized ascall_module
nodes cannot be handled currently inGraphModuleSerializer
.b) Case 2 : Where output of TRT compilation is a Node, the graph looks as follows
Now this
call_function
node can be serialized by handling it inhandle_call_function
. The following custom implementations are required for thisTorchTRTExportedProgramSerializer
which inheritsExportedProgramSerializer
TorchTRTSerializer
which inheritsGraphModuleSerializer
.TorchTRTExportedProgramDeserializer
which inheritsExportedProgramDeserializer
TorchTRTDeserializer
which inheritsGraphModuleSerializer
.torch_tensorrt.dynamo.serialize
- Custom version of torch._export.serde.serialize will dump thisserialized_exp_program
into bytestorch_tensorrt.dynamo.deserialize
- torch.export.serde.deserialize to deserialize accordinglySo the workflow would look like
Downsides of these custom versions:
TorchTRTExportedProgramDeserializer
accordingly (with custom implementation of torch.export.serde.deserialize . So to load an already compiled exported program, we need to import the entiretorch_tensorrt
library (which can pose memory constraints due to size)Question to Meta:
Beta Was this translation helpful? Give feedback.
All reactions