загрузить/преобразовать модель onnx в pytorch
Мне нужно использовать GNNExplainer, для которого требуется модель pytorch. Однако моя модель GNN написана в библиотеках keras.
Я попытался использовать эту библиотеку для загрузки моей модели onnx и преобразования в pytorch. Может ли кто-нибудь помочь мне решить эти ошибки? Вот ошибки, которые я получил от него.
`import tf2onnx
#from keras2onnx import convert_keras
#Load the Keras model
keras_model = model
#Convert the Keras model to ONNX format
onnx_model, _ = tf2onnx.convert.from_keras(model)
#Save the ONNX model to a file
with open('./my_onnx_model.onnx', 'wb') as f:
f.write(onnx_model.SerializeToString())
import onnx
onnx_model = onnx.load('./my_onnx_model.onnx')
import onnx
from onnx2torch import convert
torch_model_1 = convert(onnx_model)`
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-64-b734fd4e372a> in <module>
2 from onnx2torch import convert
3
----> 4 torch_model_1 = convert(onnx_model)
5
6 # from onnx2pytorch import ConvertModel
/working/Ali_code/custom_model_env/GNN/lib/python3.6/site-packages/onnx2torch/converter.py in convert(onnx_model_or_path, save_input_names, attach_onnx_mapping)
105 domain=onnx_node.domain,
106 operation_type=onnx_node.operation_type,
--> 107 version=version,
108 )
109
/working/Ali_code/custom_model_env/GNN/lib/python3.6/site-packages/onnx2torch/node_converters/registry.py in get_converter(operation_type, version, domain)
67 converter = _CONVERTER_REGISTRY.get(description, None)
68 if converter is None:
---> 69 raise NotImplementedError(f'Converter is not implemented ({description})')
70
71 return converter
NotImplementedError: Converter is not implemented (OperationDescription(domain='', operation_type='Loop', version=13))