parkermoe commited on
Commit
13d544c
·
1 Parent(s): f671f31

'update load'

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -36,10 +36,12 @@ class LSTMModel(nn.Module):
36
  # loading model from checkpoint
37
  model = LSTMModel(VOCAB_SIZE, EMBEDDING_DIM, N_UNITS).to(device)
38
 
 
39
 
40
  checkpoint_path = 'recipe_generator_LSTM.pth'
41
- checkpoint = torch.load(checkpoint_path)
42
- model.load_state_dict(checkpoint['model_state_dict'])
 
43
  print('Loaded model from checkpoint')
44
 
45
  def load_vocab(directory):
 
36
  # loading model from checkpoint
37
  model = LSTMModel(VOCAB_SIZE, EMBEDDING_DIM, N_UNITS).to(device)
38
 
39
+ device = 'cpu'
40
 
41
  checkpoint_path = 'recipe_generator_LSTM.pth'
42
+ checkpoint = torch.load(checkpoint_path, map_location=device)
43
+ model.load_state_dict(checkpoint)
44
+
45
  print('Loaded model from checkpoint')
46
 
47
  def load_vocab(directory):