Generate Irish folk tunes in ABC notation from a short prompt and play them with an external ABC player.
Load the fine-tuned GPT-2 from Hugging Face and call generate with sampling for new melodies.
Reproduce the fine-tune run on a free Colab T4 GPU as a starting point for other text-based music datasets.
Use the Hugging Face Space demo to sample tunes without installing anything locally.
Inference only needs transformers and the Hugging Face checkpoint; an external ABC player is required to actually hear the output.
This repo contains a weekend project that fine tunes OpenAI's GPT-2 language model to generate Irish folk tunes. GPT-2 is a small text generating model originally trained on web pages, and fine tuning means continuing its training on a more specific kind of text so it learns the patterns in that smaller set. In this case the smaller set is a public collection called irishman, which contains thousands of Irish folk tunes written in ABC notation. ABC notation is a way of writing music using normal ASCII characters, so a melody looks like a short block of text rather than a stave. The model takes a short prompt of ABC like fragments and continues it, producing a longer block of ABC text that someone can then paste into an online ABC player to hear the tune. The output is symbolic, meaning text not audio, and the README is clear that a separate player such as abc.rectanglered.com or the ABCjs editor is needed to actually listen to the result. There is also a live demo hosted on a Hugging Face Space that lets you try it without setting anything up. On the technical side the model is a full fine tune of the standard gpt2 checkpoint, trained for about one epoch on a single free tier T4 GPU in Google Colab, with a maximum input length of 512 tokens and a final validation loss of about 0.996. A loss table in the README shows the training loss dropping from around 3.1 at step 50 down to about 1.03 by step 12,800, with the final training and validation numbers close together, which the author says suggests the model did not obviously overfit. The README also gives a short Python snippet that loads the model from Hugging Face with the transformers library and calls generate with sampling enabled, plus a reminder that if the generated text does not include a full ABC header, the user should prepend one with the meter, default note length, and key before playing it. The author lists clear limitations: outputs may be syntactically invalid ABC and need cleanup, musical quality varies, and the model can echo fragments from the training data, so it should not be used for original or commercial music without further checks. The project is offered for experimentation, has zero stars at the time of writing, and is released under the MIT license.
Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.