Code Monkey home page Code Monkey logo

ciphergan's Introduction

CipherGAN

Implementation of CipherGAN, used to obtain the results detailed in Unsupervised Cipher-Cracking Using Neural Networks.
Authors: Aidan N. Gomez, Sīcōng Huang, Ivan Zhang, Bryan M. Li, Muhammad Osama, Łukasz Kaiser

Citing this work

@inproceedings{
    n.2018unsupervised,
    title={Unsupervised Cipher Cracking Using Discrete {GAN}s},
    author={Aidan N. Gomez and Sicong Huang and Ivan Zhang and Bryan M. Li and Muhammad Osama and Lukasz Kaiser},
    booktitle={International Conference on Learning Representations},
    year={2018},
    url={https://openreview.net/forum?id=BkeqO7x0-},
}

Running this code

Call pip install -r CipherGAN/requirements.txt to install all dependencies.

Generating Data

We make use of data generators to generate the TFRecords that are used for training. Of particular note is cipher_generator, which may be used to generate data for the shift and Vigenère ciphers that were tested in the paper.

Sample Call

The settings for the included generators are passed as flags. For example, to generate a word-level Vigenère Cipher (key:CDE) on the Brown Corpus with a sample length of 200, call:

python CipherGAN/data/data_generators/cipher_generator.py \
  --cipher=vigenere \
  --vigenere_key=345 \
  --percentage_training=0.9 \
  --corpus=brown \
  --vocab_size=200 \
  --test_name=vigenere345-brown200-eval \
  --train_name=vigenere345-brown200-train \
  --output_dir=tmp/data \
  --vocab_filename=vigenere345_brown200_vocab.txt

Training

All training can be performed by calling train.py. Training requires the TFRecords generated by the included generators.

Sample Call

Please refer to the flags accepted by train.py for a full set of options.

python -m CipherGAN.train \
  --output_dir=runs/vig345 \
  --test_name="vigenere345-brown200-eval*" \
  --train_name="vigenere345-brown200-train*" \
  --hparam_sets=vigenere_brown_vocab_200

Contributing

We'd love to accept your contributions to this project. Please feel free to open an issue, or submit a pull request as necessary. If you have implementations of this repository in other ML frameworks, please reach out so we may highlight them here.

Acknowledgements

Our thanks to Michal Wiszniewski for his assistance in developing this codebase.
In addition, this repository borrows and builds upon code from:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.