I am using Google colab. I want to convert .pt model from my google drive to .h5 model. I follow link https://github.com/gmalivenko/pytorch2keras and https://www.programmersought.com/article/57938937172/ and install libraries and also write code as below:
%pip install pytorch2keras
%pip install onnx==1.8.1
import numpy as np
from numpy import random
from random import uniform
import torch
from torch.autograd import Variable
input_np = np.random.uniform(0, 1, (1, 10, 32, 32))
input_var = Variable(torch.FloatTensor(input_np))
model='/content/gdrive/MyDrive/model.pt'
pytorch_to_keras(model,input_var,input_shapes= [(10, 32, 32,)], verbose=True)
but it gives me error like:
WARNING:pytorch2keras:Custom shapes isn't supported now.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-53-eef217a11c8a> in <module>()
8 input_var = Variable(torch.FloatTensor(input_np))
9 model='/content/gdrive/MyDrive/model.pt'
---> 10 pytorch_to_keras(model,input_np,input_shapes= [(10, 32, 32,)], verbose=True)
11
12
/usr/local/lib/python3.7/dist-packages/pytorch2keras/converter.py in pytorch_to_keras(model, args, input_shapes, change_ordering, verbose, name_policy, use_optimizer, do_constant_folding)
51 args = tuple(args)
52
---> 53 dummy_output = model(*args)
54
55 if isinstance(dummy_output, torch.autograd.Variable):
TypeError: 'str' object is not callable