Skip to content

Code for the KDL presentation at the Creative AI: Theory and Practice symposium

License

Notifications You must be signed in to change notification settings

kingsdigitallab/creativeai-symposium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Creative AI: Theory and Practice

This repository contains experimental code used for the KDL presentation, From Once Upon a Time, to Happily Ever After, via AI at the Creative AI: Theory and Practice symposium.

Set up

Install poetry and the requirements:

poetry install

Fine tune the text generation model

poetry run python creativeai/gpt.py MODEL_PATH DATA_PATH
  • MODEL_PATH can either be a Hugging Face path or a local path.
  • DATA_PATH should be a path to a text file with all the training data.

To see a list of all the available options for the text generation run the gpt.py script with the --help option:

poetry run python creativeai/gpt.py --help

usage: gpt.py [-h] [-n NAME] [-o OUTPUT] [-e EPOCHS] model data

Script to train a GPT model

positional arguments:
  model                 Model path
  data                  Text file with training data

optional arguments:
  -h, --help            show this help message and exit
  -n NAME, --name NAME  Model name
  -o OUTPUT, --output OUTPUT
                        Path to save the trained model
  -e EPOCHS, --epochs EPOCHS

Warning: Depending on the model being used, fine tunning a text generation model can be very time consuming without access to a GPU.

Run the notebook

The repository also contains a notebook with an interface to generate text and imgages from the generated text. The story document contains an example of a story generated in the notebook for the prompt: There was a man made of clockwork who longed to become human so, with the settings top p set to 0.9, and ngrams set to 4.

Warning: The notebook is set up to use GPUs.

Data

The models for the presentation were fine tuned using the Grimm's Fairy Tales.

Models

Black, S., Leo, G., Wang, P., Leahy, C., & Biderman, S. (2021). GPT-Neo: Large Scale Autoregressive Language Modeling with Mesh-Tensorflow (1.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.5297715
Gao, L., Biderman, S., Black, S., Golding, L., Hoppe, T., Foster, C., Phang, J., He, H., Thite, A., Nabeshima, N., & others. (2020). The Pile: An 800GB Dataset of Diverse Text for Language Modeling. ArXiv Preprint ArXiv:2101.00027.
Rombach, R., Blattmann, A., Lorenz, D., Esser, P., & Ommer, B. (2022). High-Resolution Image Synthesis With Latent Diffusion Models. Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 10684–10695.

About

Code for the KDL presentation at the Creative AI: Theory and Practice symposium

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published