PyTorch code for neural text generation research
Top 88.0% on sourcepulse
This repository provides a PyTorch implementation of unlikelihood training for neural text generation, as described in the paper "Neural Text Generation with Unlikelihood Training." It offers tools for researchers and practitioners to fine-tune language models to avoid generating undesirable tokens or sequences, leading to more controlled and higher-quality text outputs.
How It Works
The core of the implementation is a custom fairseq module that integrates unlikelihood training objectives. This approach modifies the standard maximum likelihood estimation (MLE) training by adding a penalty term that discourages the model from assigning high probability to specific "unlikely" tokens or sequences. This allows for fine-grained control over generation, such as reducing repetition or avoiding specific phrases.
Quick Start & Requirements
git clone https://github.com/pytorch/fairseq.git && cd fairseq && git checkout 2b68e91f231a2b7997664e1418f30b808d889963 && pip install --editable .
pip install nltk pandas pytorch-transformers tensorflow=1.14 tensorboardX torch==1.4.0
custom
directory from this repo into your fairseq installation.wikitext-103_v0.tar.gz
.checkpoints_v0.tar.gz
(16GB).Highlighted Details
Maintenance & Community
This project is from Facebook AI Research (FAIR). Specific community channels are not explicitly mentioned in the README.
Licensing & Compatibility
Limitations & Caveats
The CC-BY-NC 4.0 license restricts commercial use. The setup requires specific versions of PyTorch (1.4.0) and TensorFlow (1.14), which may conflict with other projects. The large download size for pre-trained models (16GB) is also a consideration.
3 years ago
Inactive