Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MidiDataset optimizations #68

Merged
merged 11 commits into from
Nov 22, 2023
Prev Previous commit
Next Next commit
reduce some memory overhead (we are starting to have >100k MidiDict a…
…nd may get more in the future)
  • Loading branch information
honglu2875 committed Nov 9, 2023
commit c1d170daf4a1b1dbb5fee80e60ff718814fb0dd2
6 changes: 4 additions & 2 deletions aria/data/midi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Utils for data/MIDI processing."""

import functools
import hashlib
import json
import re
Expand Down Expand Up @@ -114,8 +114,10 @@ def __init__(
}
]

@functools.cached_property
def program_to_instrument(self):
# This combines the individual dictionaries into one
self.program_to_instrument = (
return (
{i: "piano" for i in range(0, 7 + 1)}
| {i: "chromatic" for i in range(8, 15 + 1)}
| {i: "organ" for i in range(16, 23 + 1)}
Expand Down