Actually, with ONNX-Caffe2 package, you can easily turn an ONNX model to a Caffe2 model, then dump it into pb files.
Here is an example:
import onnx
from onnx_caffe2.backend import Caffe2Backend

onnx_proto_file = "/onnx.proto"
torch.onnx.export(G, x, onnx_proto_file, verbose=True)
onnx_model = onnx.load(onnx_proto_file)
init_net, predict_net = Caffe2Backend.onnx_graph_to_caffe2_net(onnx_model.graph)
with open("onnx-init.pb", "wb") as f:
    f.write(init_net.SerializeToString())
with open("onnx-init.pbtxt", "w") as f:
    f.write(str(init_net))
with open(, "onnx-predict.pb", "wb") as f:
    f.write(predict_net.SerializeToString())
with open("onnx-predict.pbtxt", "w") as f:
    f.write(str(predict_net))