Skip to content

Commit

Permalink
fix Making a prediction on CPU after training on GPU google#89
Browse files Browse the repository at this point in the history
  • Loading branch information
pthavarasa committed Aug 15, 2022
1 parent 91764ce commit 52fef26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion uisrnn/uisrnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def load(self, filepath):
Args:
filepath: the path of the file.
"""
var_dict = torch.load(filepath)
var_dict = torch.load(filepath, map_location=self.device)
self.rnn_model.load_state_dict(var_dict['rnn_state_dict'])
self.rnn_init_hidden = nn.Parameter(
torch.from_numpy(var_dict['rnn_init_hidden']).to(self.device))
Expand Down

0 comments on commit 52fef26

Please sign in to comment.