You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/dynamo/refit_engine_example.py
+5-11Lines changed: 5 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -114,21 +114,15 @@
114
114
#
115
115
# There are a number of settings you can use to control the refit process
116
116
#
117
-
# Weight Map Cache
117
+
# Output Verification
118
118
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119
119
#
120
120
# Weight refitting works by matching the weights of the compiled module with the new weights from
121
-
# the user supplied ExportedProgram. Since 1:1 name matching from PyTorch to TensorRT is hard to accomplish,
122
-
# the only gaurenteed way to match weights at *refit-time* is to pass the new ExportedProgram through the
123
-
# early phases of the compilation process to generate near identical weight names. This can be expensive
124
-
# and is not always necessary.
121
+
# the user supplied ExportedProgram. To do this, the new ExportedProgram is passed through the early
122
+
# phases of the compilation process to generate near identical weight names, which are then used to
123
+
# refit the existing TensorRT engine in place without rebuilding it.
125
124
#
126
-
# To avoid this, **At initial compile**, Torch-TensorRt will attempt to cache a direct mapping from PyTorch
127
-
# weights to TensorRT weights. This cache is stored in the compiled module as metadata and can be used
128
-
# to speed up refit. If the cache is not present, the refit system will fallback to rebuilding the mapping at
129
-
# refit-time. Use of this cache is controlled by the ``use_weight_map_cache`` parameter.
130
-
#
131
-
# Since the cache uses a heuristic based system for matching PyTorch and TensorRT weights, you may want to verify the refitting. This can be done by setting
125
+
# You may want to verify the refitting. This can be done by setting
132
126
# ``verify_output`` to True and providing sample ``arg_inputs`` and ``kwarg_inputs``. When this is done, the refit
133
127
# system will run the refitted module and the user supplied module on the same inputs and compare the outputs.
Copy file name to clipboardExpand all lines: py/torch_tensorrt/dynamo/_engine_cache.py
+3-8Lines changed: 3 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,6 @@
24
24
List[str],
25
25
Sequence[Input],
26
26
CompilationSettings,
27
-
Optional[Dict[str, Any]],
28
27
bool,
29
28
bool,
30
29
]
@@ -108,19 +107,17 @@ def pack(
108
107
output_names: List[str],
109
108
input_specs: Sequence[Input],
110
109
compilation_settings: CompilationSettings,
111
-
weight_name_map: Optional[Dict[Any, Any]],
112
110
requires_output_allocator: bool,
113
111
requires_native_multidevice: bool,
114
112
) ->bytes:
115
-
"""Pack serialized engine, input names, output names, and weight map into a single blob
113
+
"""Pack serialized engine, input names, and output names into a single blob
116
114
117
115
Args:
118
116
serialized_engine (bytes): serialized TRT engine
119
117
input_names (List[str]): input names of TRT engine
120
118
output_names (List[str]): output names of TRT engine
121
119
input_specs (Sequence[Input]): input specs of TRT engine
122
120
compilation_settings (CompilationSettings): compilation settings of TRT engine
123
-
weight_name_map (Optional[Dict[Any, Any]]): weight name map for refitting
124
121
requires_output_allocator (bool): Boolean flag indicating if the converter creates operators which require an Output Allocator to run (e.g. data dependent operators)
125
122
requires_native_multidevice (bool): Boolean flag indicating if the converter creates operators which require multiple devices to run (e.g. multi-device collective operations)
0 commit comments