title: How to load and use a pretained PyTorch InceptionV3 model to classify an image
body: <p>I have the same problem as <a href="https://stackoverflow.com/questions/51857274/how-can-i-load-and-use-a-pytorch-pth-tar-model">How can I load and use a PyTorch (.pth.tar) model</a> which does not have an accepted answer or one I can figure out how to follow the advice given.</p>
  
  <p>I'm new to PyTorch. I am trying to load the pretrained PyTorch model referenced here: <a href="https://github.com/macaodha/inat_comp_2018" rel="noreferrer">https://github.com/macaodha/inat_comp_2018</a> </p>
  
  <p>I'm pretty sure I am missing some glue.</p>
  
  <pre><code># load the model
  import torch
  model=torch.load("iNat_2018_InceptionV3.pth.tar",map_location='cpu')
  
  # try to get it to classify an image
  imsize = 256
  loader = transforms.Compose([transforms.Scale(imsize), transforms.ToTensor()])
  
  def image_loader(image_name):
      """load image, returns cuda tensor"""
      image = Image.open(image_name)
      image = loader(image).float()
      image = Variable(image, requires_grad=True)
      image = image.unsqueeze(0)  
      return image.cpu()  #assumes that you're using CPU
  
  image = image_loader("test-image.jpg")
  </code></pre>
  
  <p>Produces the error:</p>
  
  <blockquote>
    <p> in ()
    ----> 1 model.predict(image)</p>
    
    <p>AttributeError: 'dict' object has no attribute 'predict</p>
  </blockquote>