This is what’s returned using detect_anomaly()

i: 1, Loss: 0.6978
i: 2, Loss: 0.5917
sys:1: RuntimeWarning: Traceback of forward call that caused the error:
File “/neural-composer/legacy.py”, line 69, in 
outputs, hidden = model(features, hidden)  # Runs forward()
File “\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py”, line 477, in call
result = self.forward(*input, **kwargs)
File “/neural-composer/legacy.py”, line 35, in forward
output, hidden = self.rnn(input_sequence, hidden)
File “\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py”, line 477, in call
result = self.forward(*input, **kwargs)
File “\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\rnn.py”, line 192, in forward
output, hidden = func(input, self.all_weights, hx, batch_sizes)
File “\Anaconda3\envs\pytorch\lib\site-packages\torch\nn_functions\rnn.py”, line 324, in forward
return func(input, *fargs, **fkwargs)
File “\Anaconda3\envs\pytorch\lib\site-packages\torch\nn_functions\rnn.py”, line 288, in forward
dropout_ts)
Traceback (most recent call last):
File “/neural-composer/legacy.py”, line 74, in 
loss.backward(retain_graph=True)
File “\pirar\Anaconda3\envs\pytorch\lib\site-packages\torch\tensor.py”, line 93, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File “\Anaconda3\envs\pytorch\lib\site-packages\torch\autograd_init_.py”, line 90, in backward
allow_unreachable=True)  # allow_unreachable flag
RuntimeError: Function ‘CudnnRnnBackward’ returned nan values in its 1th output.