Browse Source

fix crf

tags/v0.2.0
yunfan 5 years ago
parent
commit
a6ab34fd38
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      fastNLP/modules/decoder/CRF.py
  2. +1
    -1
      reproduction/Biaffine_parser/run.py

+ 1
- 1
fastNLP/modules/decoder/CRF.py View File

@@ -89,7 +89,7 @@ class ConditionalRandomField(nn.Module):
score = score.sum(0) + emit_score[-1]
if self.include_start_end_trans:
st_scores = self.start_scores.view(1, -1).repeat(batch_size, 1)[batch_idx, tags[0]]
last_idx = masks.long().sum(0)
last_idx = mask.long().sum(0)
ed_scores = self.end_scores.view(1, -1).repeat(batch_size, 1)[batch_idx, tags[last_idx, batch_idx]]
score += st_scores + ed_scores
# return [B,]


+ 1
- 1
reproduction/Biaffine_parser/run.py View File

@@ -352,7 +352,7 @@ if __name__ == "__main__":
elif args.mode == 'test':
test(args.path)
elif args.mode == 'infer':
infer()
pass
else:
print('no mode specified for model!')
parser.print_help()

Loading…
Cancel
Save