Skip to content

Latest commit

 

History

History
36 lines (31 loc) · 1.19 KB

README.md

File metadata and controls

36 lines (31 loc) · 1.19 KB

BOLT

This is the implementation of ACL 2023 paper BOLT: Fast Energy-based Controlled Text Generation with Tunable Biases.

Environment Setup

cd ./transformers
pip install -e .
cd -

Download Discriminators

You can download the discriminators from here and put them under ./checkpoints. These roberta-based discriminators are trained on the Yelp dataset and the Jigsaw dataset, whose embeddings are replaced with the GPT2-large embeddings.

Sentiment Control

SENTIMENT=pos
# SENTIMENT=neg
SEQLEN=20
python sentiment_generate_with_bias.py $SEQLEN $SENTIMENT

The generated sentences will be saved in ./sentiment/sentiment/.

Toxicity Avoidance

SEQLEN=20
python detoxic_generate_with_bias.py $SEQLEN

The generated sentences will be saved in ./detoxic/detoxic/.

Keyword-guided Topic Control

SEQLEN=20
TOPIC=computer
python keywords_generate_with_bias.py $SEQLEN $TOPIC

The generated sentences will be saved in ./keywords/keywords/.