/fakeglyph

Fancy brand new letters with generative models

Primary LanguagePythonMIT LicenseMIT

fakeglyph

samples.gif

This repository lets you train generative models that try to produce letters.

Setup

  • Create a Python environment where python>=3.10.
  • Clone the repository by git clone https://github.com/kumatheworld/fakeglyph.git.
  • Install the required packages by pip install -r requirements.txt.
  • Set the device. Change the device field of configs/train.yaml to cuda, cpu or whatever device you want to use.
  • Define the letter set and font file to create the dataset. Edit configs/data/cjk.yaml and fakeglyph/data/charset.py accordingly. The default dataset is made of ~20K Chinese characters, but you can define your own letter set with any font.

Train models

The first time you run the script, you'll need some time to generate the dataset, which will be cached under datasets/. You can easily change the model architecture by editing config files under configs/model/.

Train (β-)VAE

Run python main.py train model=vae. Run python main.py train model=vae model.beta=1 model.reduction=batchmean instead to train the vanilla VAE.

Train GAN

Run python main.py train model=gan.