Skip to content
This repository was archived by the owner on Mar 31, 2019. It is now read-only.
/ torch-crf Public archive

Linear-chain LSTM-CRFs and Convolutional CRFs in PyTorch.

Notifications You must be signed in to change notification settings

paultsw/torch-crf

Repository files navigation

README --- Linear Chain Conditional Random Field

An implementation of a linear chain CRF in PyTorch.

Usage

To train a model, run python train_crf.py.

To set custom training parameters, create a config.json file (we recommend that you do this in the configs/ folder for record-keeping). Then, run: python train_crf.py --config config/path/to/config.json.

Features

There are two types of features: the transition features between different hidden states given by a transitions table, and features from observations to each hidden timestep given by either a stack of convolutional layers or by a stack of bidirectional LSTMs.

Dynamic Algorithms

  • Viterbi algorithm
  • Forward Algorithm

References

  • Sutton, McCallum, An Introduction to Conditional Random Fields, https://arxiv.org/abs/1011.4088

Credits

Credit to Robert Guthrie's PyTorch's NLP tutorial for insight into good ways of structuring a BiLSTM-based CRF code in PyTorch: http://pytorch.org/tutorials/beginner/nlp/advanced_tutorial.html

The functions in dynamic.py are also variations of code contained in the above tutorial.

About

Linear-chain LSTM-CRFs and Convolutional CRFs in PyTorch.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages