Is it possible to not save metadata when exporting?

The onnx model exported by torch.onnx.export is populated with metadata (like the path to several python modules.)

I do not want this information when distributing the model.

There are no details about this in the torch.onnx.export documentation at all.


To be clear this is what I am talking about, inside the onnx model (which is checked and works fine.) there are many lines that I do not want shared with the model:

/Users/username/miniconda3/envs/spotRotated/lib/python3.11/site-packages/torch/nn/modules/module.py(1488): _slow_forward
/Users/username/miniconda3/envs/spotRotated/lib/python3.11/site-packages/torch/nn/modules/module.py(1501): _call_impl
/Users/username/Documents/spotRotated/nn_arch/classifierV2.py(46): forward
/Users/username/miniconda3/envs/spotRotated/lib/python3.11/site-packages/torch/nn/modules/module.py(1488): _slow_forward
/Users/username/miniconda3/envs/spotRotated/lib/python3.11/site-packages/torch/nn/modules/module.py(1501): _call_impl
/Users/username/miniconda3/envs/spotRotated/lib/python3.11/site-packages/torch/jit/_trace.py(118): wrapper
/Users/username/miniconda3/envs/spotRotated/lib/python3.11/site-packages/torch/jit/_trace.py(127): forward
/Users/username/miniconda3/envs/spotRotated/lib/python3.11/site-packages/torch/nn/modules/module.py(1501): _call_impl
/Users/username/miniconda3/envs/spotRotated/lib/python3.11/site-
...
/Users/username/miniconda3/envs/spotRotated/lib/python3.11/site-packages/torch/onnx/utils.py(1548): _export
/Users/username/miniconda3/envs/spotRotated/lib/python3.11/site-packages/torch/onnx/utils.py(506): export
/Users/username/Documents/spotRotated/utils/onnx_conversion.py(12): to_onnx

Do you have any idea maybe @ptrblck ?