← all repositories
PetrochukM/PyTorch-NLP

A PyTorch NLP utility belt that retired itself

It was a lightweight grab-bag of PyTorch NLP utilities—datasets, encoders, samplers, word vectors, and metrics—built in 2018 when basic PyTorch NLP plumbing was still scarce.

2.2k stars Python Data ToolingML Frameworks
PyTorch-NLP
Not currently ranked — collecting fresh signals.
star history

What it does PyTorch-NLP (torchnlp) was a collection of basic utilities for building NLP pipelines in PyTorch. It covered standard data plumbing: loading datasets like IMDB, encoding text to tensors, batching variable-length sequences, and computing metrics such as BLEU. The library also included pre-trained GloVe embeddings, a deterministic RNG wrapper (fork_rng), and neural network layers like LockedDropout.

The interesting bit The README itself is the standout feature: the author archived the project and mapped every module to a modern successor. Rather than letting it bit-rot quietly, it explicitly points you to Hugging Face Datasets, Tokenizers, and Evaluate, plus PyTorch Datapipes and TorchText. That kind of graceful exit is rare in open source.

Key highlights

  • Positioned itself as a lightweight, low-coupling alternative to torchtext and AllenNLP.
  • Bundled practical pipeline pieces: dataset loaders, a WhitespaceEncoder, BucketBatchSampler, and a collate_tensors helper for padding variable-length inputs.
  • Included a fork_rng context manager to synchronize randomness across Python, NumPy, and PyTorch.
  • Provided pre-trained GloVe embeddings and a LockedDropout layer.
  • The author explicitly recommends modern replacements for every component.

Caveats

  • The repository is archived and no longer maintained; the author recommends Hugging Face and PyTorch-first alternatives instead.
  • Some tools, like the WhitespaceEncoder, are deliberately basic by modern standards.

Verdict Worth a look if you are maintaining legacy code that depends on torchnlp, or if you want a historical snapshot of 2018-era PyTorch NLP plumbing. Everyone else should follow the author’s own advice and use the modern tools listed in the archive notice.

Frequently asked

What is PetrochukM/PyTorch-NLP?
It was a lightweight grab-bag of PyTorch NLP utilities—datasets, encoders, samplers, word vectors, and metrics—built in 2018 when basic PyTorch NLP plumbing was still scarce.
Is PyTorch-NLP open source?
Yes — PetrochukM/PyTorch-NLP is open source, released under the BSD-3-Clause license.
What language is PyTorch-NLP written in?
PetrochukM/PyTorch-NLP is primarily written in Python.
How popular is PyTorch-NLP?
PetrochukM/PyTorch-NLP has 2.2k stars on GitHub.
Where can I find PyTorch-NLP?
PetrochukM/PyTorch-NLP is on GitHub at https://github.com/PetrochukM/PyTorch-NLP.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.