Closed longlongman closed 4 years ago
hi @longlongman thanks for the questions. I may check it in the future. I re-ran the code and it worked properly.
Hi, @longlongman @nanguoshun , the loss become "nan" when runing the code(batch_size=10), do you meet this problem?
hi @longlongman , thanks for your question. This is a known issue and will try to fix it in the future. To fix it temporarily, I suggest you change a different batch size, or learning rate, or random seed.
It's really sad that I also encounted this problem. ┭┮﹏┭┮
I found that some parts of the code were confusing.
In models/encoder.py, you define the encoder as follow:
self.encoder = nn.GRU(input_size,self.hidden_size, bidirectional=True)
Did you miss an argumentbatch_first=True
?In models/reasoner.py, you calculate the f_ij as follow:
f_ij = self.bilinear(tp, tc).squeeze()
I found the result of f_ij is kind of weird. I got the same score in each row. I guest that you may forget to permute the tc, likef_ij = self.bilinear(tp, tc.permute(0, 2, 1, 3).contiguous()).squeeze()