All Projects → minimaxir → Char Embeddings

minimaxir / Char Embeddings

Licence: mit
A repository containing 300D character embeddings derived from the GloVe 840B/300D dataset, and uses these embeddings to train a deep learning model to generate Magic: The Gathering cards using Keras

Programming Languages

python
139335 projects - #7 most used programming language

char-embeddings

char-embeddings is a repository containing 300D character embeddings derived from the GloVe 840B/300D dataset, and uses these embeddings to train a deep learning model to generate Magic: The Gathering cards using Keras. The generation and model construction is heavily modified after the automatic text generation Keras example by François Chollet.

Usage

This repository contains a number of Python 3 scripts:

  • create_embeddings.py: Converts a pretrained word embeddings file into a character embeddings file by averaging the per-character vectors.
  • create_magic_text.py: Converts an MTG JSON card dump into a one-per-line card encoding.
  • text_generator_keras.py: Constructs and trains the Keras model, producing Magic cards at each epoch.
  • text_generator_keras_sample.py: Using the text file and Keras model generated from the previous two scripts, generate a large amount of Magic cards.

The output folder contains Magic card output at each epoch, a log of losses at every 50th batch, the learned character embeddings at the last epoch, the trained model itself, and a large sample of generated Magic cards.

Requirements

keras, tensorflow, h5py, scikit-learn

Maintainer

Max Woolf (@minimaxir)

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].