пытается экспортировать
https://github.com/minivision-ai/photo2cartoon
в onnx, используя шаги от
https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html
args = parse_args()
torch_model = UgatitSadalinHourglass(args)
torch_model.build_model()
random_input = torch.randn(1, 3, 64, 64, dtype=torch.float32)
input_names = ["image"]
output_names = ["image"]
torch.onnx.export(torch_model, random_input, './model.onnx', verbose=False,
input_names=input_names, output_names=output_names,
opset_version=11)
AttributeError Traceback (most recent call last)
in ()
8 torch.onnx.export(torch_model, random_input, './model.onnx', verbose=False,
9 input_names=input_names, output_names=output_names,
---> 10 opset_version=11)
4 frames
/usr/local/lib/python3.6/dist-packages/torch/onnx/utils.py in select_model_mode_for_export(model, mode)
34 def select_model_mode_for_export(model, mode):
35 if not isinstance(model, torch.jit.ScriptFunction):
---> 36 is_originally_training = model.training
37
38 if mode is None:
AttributeError: 'UgatitSadalinHourglass' object has no attribute 'training'