Module names under the scope column of the RAM profile table do not work for YOLO models due to the failed capture of the Sequential module. In the case where the Sequential module is iterated over with a for loop, the module was not captured, because its forward function was not called.
From torch 1.13, scope name tracing is natively supported with torch.onnx.utils._setup_trace_module_map, so I added that option to our trace handling for torch versions that support it. This change handles the Sequential module edge case and resolves the issue with the YOLO module name tracing. However, this fix only resolves the case where users are using torch>=1.13 (most users)
Module names under the
scope
column of the RAM profile table do not work for YOLO models due to the failed capture of the Sequential module. In the case where the Sequential module is iterated over with a for loop, the module was not captured, because its forward function was not called.From torch 1.13, scope name tracing is natively supported with
torch.onnx.utils._setup_trace_module_map
, so I added that option to our trace handling for torch versions that support it. This change handles the Sequential module edge case and resolves the issue with the YOLO module name tracing. However, this fix only resolves the case where users are usingtorch>=1.13
(most users)