nanguoshun / LSR

Pytorch Implementation of our ACL 2020 Paper "Reasoning with Latent Structure Refinement for Document-Level Relation Extraction"
127 stars 22 forks source link

Questions about the code. #11

Closed longlongman closed 4 years ago

longlongman commented 4 years ago

I found that some parts of the code were confusing.

  1. 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 argument batch_first=True?

  2. 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, like f_ij = self.bilinear(tp, tc.permute(0, 2, 1, 3).contiguous()).squeeze()

nanguoshun commented 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.

slzbywdf commented 3 years ago

Hi, @longlongman @nanguoshun , the loss become "nan" when runing the code(batch_size=10), do you meet this problem? image

nanguoshun commented 3 years ago

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.

LawsonAbs commented 1 year ago

It's really sad that I also encounted this problem. ┭┮﹏┭┮