Skip to content

Latest commit

 

History

History
33 lines (20 loc) · 1.05 KB

fast_crf.md

File metadata and controls

33 lines (20 loc) · 1.05 KB

Fast CRF Usage

Our implementation is inspired from the papers by Rush (2020).

  1. Move from Linear-CRF to Fast Linear-CRF.

For example, in src/model/transformers_nerualcrf.py

#import the module
from src.model.module.fast_linear_crf_inferencer import FastLinearCRF

#replace self.inferencer = LinearCRF in the init file.  
self.inferencer = FastLinearCRF(...)
  1. Revise evaluation in src/config/eval.py.

Remove the following line 54:

prediction = prediction[::-1] 

The reason of doing this is because the viterbi from FastLinearCRF already produce the standard order sequence, we do not have to do the reverse.

References

Alexander Rush, 2020, Torch-Struct: Deep Structured Prediction Library, Github

Simo Särkkä, Ángel F. García-Fernández. 2020, Temporal Parallelization of Bayesian Smoothers

Guy E. Blelloch, 1993, Prefix Sums and Their Applications