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

Add composer prefix tokens to TokenizerLazy #23

Merged
merged 3 commits into from
Aug 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix composer name config usage
  • Loading branch information
loubbrad committed Aug 12, 2023
commit 3e69b34d2c27265b184437f24357b70bbc4e3244
5 changes: 3 additions & 2 deletions aria/tokenizer/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ def __init__(
self.prefix_tokens = [
("prefix", "instrument", x) for x in self.instruments_wd
]
self.composer_names = self.config["composer_names"]
self.prefix_tokens += [
("prefix", "composer", x) for x in self.config["composer_names"]
("prefix", "composer", x) for x in self.composer_names
]

# Build vocab
Expand Down Expand Up @@ -276,7 +277,7 @@ def tokenize_midi_dict(self, midi_dict: MidiDict):
prefix.append(("prefix", "instrument", "drum"))

composer = midi_dict.metadata.get("composer")
if composer:
if composer and (composer in self.composer_names):
prefix.insert(0, ("prefix", "composer", composer))

# NOTE: Any preceding silence is removed implicitly
Expand Down