Skip to content

tbfang/steganography-lstm

Repository files navigation

Steganography LSTM

Code for the paper Generating Steganographic Text with LSTMs. The LSTM is based on the Word Language Model example from PyTorch (http://pytorch.org/).

Requirements

Data

A small sample of Penn Treebank and Tweets. pre-process.py is tokenization of punctuation.

Training

python main.py --cuda --nhid 600 --nlayers 3 --epochs 6 --data './data/tweets --save './models/twitter-model.pt' For the full list of arguments, check the PyTorch example README.

Text Generation

One of our key original contributions. After we train our model, we generate words and restrict the output based on the secret text. generate.py is modified such that it takes the secret text and modifies the probabilities based on the "bins" as described in our paper.

Example generation with 4 bins: python generate.py --data './data/tweets' --checkpoint './models/twitter-model.pt' --cuda --outf 'outputs/stegotweets.txt' --words 1000 --temperature 0.8 --bins 4 --common_bin_factor 4 --num_tokens 20

See the arguments in generate.py or refer to the PyTorch example README.

Evaluation

We proposed and implemented an alternate measure of perplexity in Section 3.2 of our paper. The code is in evaluate.py.

Example evaluation: python evaluate.py --cuda --data './data/tweets' --model './models/twitter-model.pt' --bins 4

Contact

If there are any questions or concerns about the code or paper, please contact Tina Fang at fang.tina1@gmail.com. We would love to hear your feedback!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages