harvardnlp/pytorch-struct
GPU-accelerated differentiable implementations of conditional random fields and structured prediction algorithms for PyTorch.

This library provides fast, tested, GPU-optimized implementations of core structured prediction algorithms designed as efficient batched layers for PyTorch deep learning models. It includes LinearChain-CRF, DependencyTree-CRF, PCFG, HMM, and SemiMarkov-CRF variants. The algorithms are fully differentiable, supporting backpropagation through partition, marginals, and argmax operations. A tutorial paper on arXiv describes the methodology behind the library.
Frequently asked
- What is harvardnlp/pytorch-struct?
- GPU-accelerated differentiable implementations of conditional random fields and structured prediction algorithms for PyTorch.
- Is pytorch-struct open source?
- Yes — harvardnlp/pytorch-struct is open source, released under the MIT license.
- What language is pytorch-struct written in?
- harvardnlp/pytorch-struct is primarily written in Jupyter Notebook.
- How popular is pytorch-struct?
- harvardnlp/pytorch-struct has 1.1k stars on GitHub.
- Where can I find pytorch-struct?
- harvardnlp/pytorch-struct is on GitHub at https://github.com/harvardnlp/pytorch-struct.