This repository holds the code for generating mtg cards with gpt2.
To build containers capable of running the code on either the cpu or gpu use the command make build-cpu
or
make build-gpu
.
To finetune a model on your dataset:
- Create a dataset like output.txt in the wonderful mtgencode repository. If you want to build your own dataset follow the instructions in the mtgencode repostiory. For this project I just used output.txt
- Create the appropriate docker container by running either
make build-cpu
ormake build-gpu
- Run
python3 run.py finetune
with the appropriate flags, with no adjustments this will run on the magic data in the data folder.
To predict text:
- Download the models into the gpt-mtg base directory from here
- Unzip the files, the gpt model should unzip into a folder called
checkpoint
- open up a docker container with
make run-cpu
- run the text generation script
python3 run.py generate-text
Follow the instructions in this repository to get setup. Once you have all of the necessary tools to generate magic cards then:
- Start docker with
make run-cpu
- Run the model to generate an encoding which should be parsable by mtgencode by running
python3 run.py generate-text --destination-path <filepath.txt>
- Use mtgencode to create a human readible version of the card
./decode.py -v <cardfile.txt> cards.pretty.txt -d
- Use mtgencode to create a magic set zeditor set file
decode.py -e rfields -mse encoded.txt MSE/card
- Use magic set editor to create sets from the cards
To contribute to this repository please:
cp dev/hooks/pre-commit .git/hooks
andchmod +x .git/hooks/pre-commit
- figure out how to get allsets.json and parse it using mtgencode
- figure out how to use decode to mse to get mse parseable cards
- Figure out how to use mse to generate new cards.