I have a popular .onnx ML model for weather forecasting and am trying to convert this to PyTorch for finetuning. I use the following code to convert this:
import osimport numpy as npimport onnxfrom onnx import numpy_helperimport onnxruntime as ortfrom onnx2torch import convertmodel_24 = onnx.load('pangu_weather_24.onnx')tm = convert(model_24) #Convert onnx model to torchFrom here, I want to access the weights of the model in the 'tm' object but I can't seem to find any resources online for this.
Trying to subscript it with tm[0] reveals the following error:
TypeError: 'GraphModule' object is not subscriptableand the dict for this object via 'tm.dict' is even more confusing (pasted in the image).
The normal methods online for accessing a PyTorch weight matrix also reveal the same error that the graphmodule is not subscriptable