Skip to content

Commit

Permalink
update remaining Pop2Piano checkpoints (huggingface#25827)
Browse files Browse the repository at this point in the history
update checkpoints
  • Loading branch information
susnato authored and parambharat committed Sep 26, 2023
1 parent 89656f4 commit 3b1ef93
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
3 changes: 1 addition & 2 deletions src/transformers/models/pop2piano/tokenization_pop2piano.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@

logger = logging.get_logger(__name__)

## TODO : changing checkpoints from `susnato/pop2piano_dev` to `sweetcocoa/pop2piano` after the PR is approved

VOCAB_FILES_NAMES = {
"vocab": "vocab.json",
}

PRETRAINED_VOCAB_FILES_MAP = {
"vocab": {
"susnato/pop2piano_dev": "https://huggingface.co/susnato/pop2piano_dev/blob/main/vocab.json",
"sweetcocoa/pop2piano": "https://huggingface.co/sweetcocoa/pop2piano/blob/main/vocab.json",
},
}

Expand Down
6 changes: 3 additions & 3 deletions tests/models/pop2piano/test_modeling_pop2piano.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,10 +734,10 @@ def test_real_music(self):
if is_librosa_available() and is_scipy_available() and is_essentia_available() and is_torch_available():
from transformers import Pop2PianoFeatureExtractor, Pop2PianoTokenizer

model = Pop2PianoForConditionalGeneration.from_pretrained("susnato/pop2piano_dev")
model = Pop2PianoForConditionalGeneration.from_pretrained("sweetcocoa/pop2piano")
model.eval()
feature_extractor = Pop2PianoFeatureExtractor.from_pretrained("susnato/pop2piano_dev")
tokenizer = Pop2PianoTokenizer.from_pretrained("susnato/pop2piano_dev")
feature_extractor = Pop2PianoFeatureExtractor.from_pretrained("sweetcocoa/pop2piano")
tokenizer = Pop2PianoTokenizer.from_pretrained("sweetcocoa/pop2piano")
ds = load_dataset("sweetcocoa/pop2piano_ci", split="test")

output_fe = feature_extractor(
Expand Down
8 changes: 3 additions & 5 deletions tests/models/pop2piano/test_processor_pop2piano.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
Pop2PianoTokenizer,
)

## TODO : changing checkpoints from `susnato/pop2piano_dev` to `sweetcocoa/pop2piano` after the PR is approved


@require_scipy
@require_torch
Expand All @@ -67,8 +65,8 @@ class Pop2PianoProcessorTest(unittest.TestCase):
def setUp(self):
self.tmpdirname = tempfile.mkdtemp()

feature_extractor = Pop2PianoFeatureExtractor.from_pretrained("susnato/pop2piano_dev")
tokenizer = Pop2PianoTokenizer.from_pretrained("susnato/pop2piano_dev")
feature_extractor = Pop2PianoFeatureExtractor.from_pretrained("sweetcocoa/pop2piano")
tokenizer = Pop2PianoTokenizer.from_pretrained("sweetcocoa/pop2piano")
processor = Pop2PianoProcessor(feature_extractor, tokenizer)

processor.save_pretrained(self.tmpdirname)
Expand Down Expand Up @@ -121,7 +119,7 @@ def get_inputs(self):
feature_extractor_outputs = self.get_feature_extractor()(
audio=input_speech, sampling_rate=sampling_rate, return_tensors="pt"
)
model = Pop2PianoForConditionalGeneration.from_pretrained("susnato/pop2piano_dev")
model = Pop2PianoForConditionalGeneration.from_pretrained("sweetcocoa/pop2piano")
token_ids = model.generate(input_features=feature_extractor_outputs["input_features"], composer="composer1")
dummy_notes = [
[
Expand Down
17 changes: 7 additions & 10 deletions tests/models/pop2piano/test_tokenization_pop2piano.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,12 @@
from transformers import Pop2PianoTokenizer


## TODO : changing checkpoints from `susnato/pop2piano_dev` to `sweetcocoa/pop2piano` after the PR is approved


@require_torch
@require_pretty_midi
class Pop2PianoTokenizerTest(unittest.TestCase):
def setUp(self):
super().setUp()
self.tokenizer = Pop2PianoTokenizer.from_pretrained("susnato/pop2piano_dev")
self.tokenizer = Pop2PianoTokenizer.from_pretrained("sweetcocoa/pop2piano")

def get_input_notes(self):
notes = [
Expand Down Expand Up @@ -246,30 +243,30 @@ def test_pickle_tokenizer(self):
self.assertListEqual(subwords, subwords_loaded)

def test_padding_side_in_kwargs(self):
tokenizer_p = Pop2PianoTokenizer.from_pretrained("susnato/pop2piano_dev", padding_side="left")
tokenizer_p = Pop2PianoTokenizer.from_pretrained("sweetcocoa/pop2piano", padding_side="left")
self.assertEqual(tokenizer_p.padding_side, "left")

tokenizer_p = Pop2PianoTokenizer.from_pretrained("susnato/pop2piano_dev", padding_side="right")
tokenizer_p = Pop2PianoTokenizer.from_pretrained("sweetcocoa/pop2piano", padding_side="right")
self.assertEqual(tokenizer_p.padding_side, "right")

self.assertRaises(
ValueError,
Pop2PianoTokenizer.from_pretrained,
"susnato/pop2piano_dev",
"sweetcocoa/pop2piano",
padding_side="unauthorized",
)

def test_truncation_side_in_kwargs(self):
tokenizer_p = Pop2PianoTokenizer.from_pretrained("susnato/pop2piano_dev", truncation_side="left")
tokenizer_p = Pop2PianoTokenizer.from_pretrained("sweetcocoa/pop2piano", truncation_side="left")
self.assertEqual(tokenizer_p.truncation_side, "left")

tokenizer_p = Pop2PianoTokenizer.from_pretrained("susnato/pop2piano_dev", truncation_side="right")
tokenizer_p = Pop2PianoTokenizer.from_pretrained("sweetcocoa/pop2piano", truncation_side="right")
self.assertEqual(tokenizer_p.truncation_side, "right")

self.assertRaises(
ValueError,
Pop2PianoTokenizer.from_pretrained,
"susnato/pop2piano_dev",
"sweetcocoa/pop2piano",
truncation_side="unauthorized",
)

Expand Down

0 comments on commit 3b1ef93

Please sign in to comment.