title: How to use a bert pretrained model somewhere else?
body: <p>I followed this course <a href="https://www.coursera.org/learn/sentiment-analysis-bert" rel="nofollow noreferrer">https://www.coursera.org/learn/sentiment-analysis-bert</a> about building a pretrained model for sentiment analysis. During the trining, at each epoch they saved the model using <code>torch.save(model.state_dict(), f'BERT_ft_epoch{epoch}.model')</code>. Now I want to use one of these models (the best one obviously) elsewhere, for example where a user can paste a tweet as an input and get the emotion of the writer. But I don't know how to load the model and predict, here's what I tried:</p>
  <pre><code>import torchvision.models as models
  import torch
  
  model = models.resnet101(pretrained=False)
  model.load_state_dict(torch.load('Models/BERT_ft_epoch15.model'), strict=False)
  model_ft.eval()
  output = model_ft(input) #input is a tweets list
  </code></pre>
  <p>I get this error: <code>TypeError: conv2d(): argument 'input' (position 1) must be Tensor, not list</code></p>