convert chord maps back to tuples from list when loading tokenizer from a saved configuration #141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I encountered an issue with chord maps when loading a saved tokenizer configuration from a file.
The CHORD_MAPS constant value has each chord map defined in a tuple, but after creating a tokenizer and saving the configuration, the chord maps are represented as lists (example snippet below):
This is caused by json.dump converting all tuples into lists. This results in the detect_chords function always returning ukn chord tokens, i.e. 'Chord_A:ukn3', 'Chord_E:ukn3', etc.
There are a few ways to fix this:
I've implemented the second one for this PR, as it required the least amount of work and fixes the issue.
📚 Documentation preview 📚: https://miditok--141.org.readthedocs.build/en/141/