Repository navigation
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? |
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_modulecannot be serialized ascall_modulenodes cannot be handled currently inGraphModuleSerializer.b) Case 2 : Where output of TRT compilation is a Node, the graph looks as follows
Now this
call_functionnode can be serialized by handling it inhandle_call_function. The following custom implementations are required for thisTorchTRTExportedProgramSerializerwhich inheritsExportedProgramSerializerTorchTRTSerializerwhich inheritsGraphModuleSerializer.TorchTRTExportedProgramDeserializerwhich inheritsExportedProgramDeserializerTorchTRTDeserializerwhich inheritsGraphModuleSerializer.torch_tensorrt.dynamo.serialize- Custom version of torch._export.serde.serialize will dump thisserialized_exp_programinto bytestorch_tensorrt.dynamo.deserialize- torch.export.serde.deserialize to deserialize accordinglySo the workflow would look like
Downsides of these custom versions:
TorchTRTExportedProgramDeserializeraccordingly (with custom implementation of torch.export.serde.deserialize . So to load an already compiled exported program, we need to import the entiretorch_tensorrtlibrary (which can pose memory constraints due to size)Question to Meta:
All reactions