waleedka / hiddenlayer

Neural network graphs and training metrics for PyTorch, Tensorflow, and Keras.
MIT License
1.79k stars 266 forks source link

Possible to use with pytorch model generated by fastai? #36

Open lminer opened 5 years ago

lminer commented 5 years ago

Is it possible to use this on the models generated by fastai? If I run it on the pytorch model stored by the learner object, I get an error that it isn't a valid model.

ValueError: `model` input param must be a PyTorch, TensorFlow, or Keras-with-TensorFlow-backend model.
swaroopkml96 commented 5 years ago

@lminer, I'm using fastai version 1.0.50 and

hl.build_graph(learn.model, torch.zeros([1, 3, 224, 224]).cuda())

works fine.

Can you confirm which version you're using?

amitkayal commented 5 years ago

I am getting following error while generating model image. It is not clear what I need to pass into torch.zeros([1, 3, 32, 32]..Documentation does not state from where values 1, 3, 32, 32 came from?

----> 1 hl.build_graph(learn1.model, torch.zeros([1, 3, 32, 32]).cuda()) 2 3 currentDT = datetime.datetime.now() 4 print("Current time:", currentDT)

10 frames /usr/local/lib/python3.6/dist-packages/torch/nn/modules/conv.py in forward(self, input) 336 _pair(0), self.dilation, self.groups) 337 return F.conv2d(input, self.weight, self.bias, self.stride, --> 338 self.padding, self.dilation, self.groups) 339 340

RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.cuda.HalfTensor) should be the same