-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Hi there,
Has anyone tried to update this code for pytorch 0.4? awd-lstm-lm repo recently upgraded to make the models work in 0.4.
I made some attempts but got stuck at gradstat(), since in this method the code calls model.eval(), I encountered the following error while running with a trained model. See code here
Traceback (most recent call last):
File "dynamiceval.py", line 299, in <module>
gradstat(args, corpus, model, train_data, criterion)
File "dynamiceval.py", line 83, in gradstat
loss.backward()
File "/usr/anaconda3/lib/python3.6/site-packages/torch/tensor.py", line 93, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/usr/anaconda3/lib/python3.6/site-packages/torch/autograd/__init__.py", line 89, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: backward_input can only be called in training mode
Looks like I cannot call loss.backward() when the model is set to eval mode. I've not tried running in with previous versions of pytorch. Is there a workaround for this in version 0.4?
Thanks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels