Is there a way to build Pytorch with ONNX/protobuf deps

Hi folks,
We try to build pytorch without ONNX as its protobuf tends to conflict with other libs. I’ve seen ONNX_ML and INTERN_DISABLE_ONNX. But there are a bunch of references to onnx proto in jit export (pytorch/torch/csrc/jit/serialization/export.cpp at b608ff3bea7799f76a2293f362f949851ab547b0 · pytorch/pytorch · GitHub).

Can we juse something like

#ifdef ONNX_ML

to also make jit to onnx export optional? Thanks!

hmm it’s overall the place :confused: pytorch/cmake/TorchConfig.cmake.in at a00faf440888ffb724bad413f329a49e2b6388e7 · pytorch/pytorch · GitHub