Graph processing and training in the realm of symbolic music scores may sound like a complex process, but with GraphMuse, it’s a breeze. Let’s break down the general pipeline for you:
- Start by preprocessing your database of scores to create input graphs, and let GraphMuse handle the heavy lifting;
- Sample these input graphs to generate memory-efficient batches, and yes, GraphMuse simplifies this step too;
- Form a batch as a new graph, selecting specific nodes known as target nodes. Node-wise sampling can also fetch the neighbors of these target nodes;
- Update the representations of the target nodes through graph convolution using models provided by GraphMuse or PyTorch Geometric;
- Leverage these embeddings for task-specific applications, showcasing your creativity and expertise.
Remember, target nodes can range from all to a subset of batch nodes based on the sampling strategy.
Now, let’s delve deeper into how GraphMuse simplifies the process of sampling notes from each score.
Sampling Process Simplified:
- Randomly select a note to sample (highlighted in yellow);
- Compute the boundaries of target notes with a specified budget (pink and yellow notes);
- Fetch k-hop neighbors for the target notes (light blue for 1-hop, darker blue for 2-hop);
- Extend the sampling process for beat and measure elements, with flexibility in time windows.
To optimize computational resources, this process is repeated across multiple scores simultaneously to create cohesive batches. Rest assured, each segment sampled will contain consistent target note sizes, paving the way for efficient graph creation.
Ready for a hands-on experience with GraphMuse? Let’s dive into using a model for pitch spelling to enhance your music processing skills!
Before delving into GraphMuse’s installation, ensure you have PyTorch and PyTorch Geometric set up. Check the appropriate versions based on your system here and here.
Once you have the prerequisites in place, head to your terminal and run the command:
pip install graphmuse
With GraphMuse successfully installed, let’s harness its power to read a MIDI file from a URL and create a score graph effortlessly.
import graphmuse as gmmidi_url_raw = "https://github.com/CPJKU/partitura/raw/refs/heads/main/tests/data/midi/bach_midi_score.mid"
graph = gm.load_midi_to_graph(midi_url_raw)
This seamless process involves utilizing Partitura to read the file and feeding it through GraphMuse, giving you a hassle-free experience.