explaingit

vedantr3907/gpt2-irish-folk-tune-generator

0Jupyter NotebookAudience · researcherComplexity · 2/5ActiveLicenseSetup · easy

TLDR

GPT-2 fine-tuned on the irishman dataset to generate Irish folk tunes in ABC notation, with a Hugging Face demo and a Colab training notebook.

Mindmap

mindmap
  root((gpt2-irish-tunes))
    Inputs
      ABC prompt
      Header meter and key
    Outputs
      ABC notation text
      Playable tune
    Use Cases
      Generate folk melodies
      Experiment with fine tuning
      Seed composition ideas
    Tech Stack
      Python
      Transformers
      GPT-2
      Colab

Things people build with this

USE CASE 1

Generate Irish folk tunes in ABC notation from a short prompt and play them with an external ABC player.

USE CASE 2

Load the fine-tuned GPT-2 from Hugging Face and call generate with sampling for new melodies.

USE CASE 3

Reproduce the fine-tune run on a free Colab T4 GPU as a starting point for other text-based music datasets.

USE CASE 4

Use the Hugging Face Space demo to sample tunes without installing anything locally.

Tech stack

PythonTransformersGPT-2PyTorchColab

Getting it running

Difficulty · easy Time to first run · 5min

Inference only needs transformers and the Hugging Face checkpoint; an external ABC player is required to actually hear the output.

MIT license, so you can use, modify, and redistribute the model and code commercially as long as you keep the copyright notice.

In plain English

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.

Copy-paste prompts

Prompt 1
Walk me through the training notebook for gpt2-irish-folk-tune-generator and show how it tokenizes ABC notation.
Prompt 2
Show me a Python snippet that loads this model with transformers and generates a tune from a four-bar ABC prompt.
Prompt 3
Explain how I would prepend a valid ABC header with meter, default note length, and key before playing the output.
Prompt 4
Help me fine-tune this model further on a different ABC dataset such as Scottish reels using the same Colab setup.
Prompt 5
Debug why my generated ABC produces a syntax error in the ABCjs editor and suggest cleanup rules.
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.