Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,8 +25,14 @@ def load_model():
|
|
25 |
processor_bytes = io.BytesIO()
|
26 |
processor = MusicgenProcessor.from_pretrained("facebook/musicgen-small")
|
27 |
|
28 |
-
#
|
29 |
-
processor.tokenizer.
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
processor.feature_extractor.save_pretrained(processor_bytes)
|
31 |
|
32 |
processor = MusicgenProcessor.from_pretrained(processor_bytes)
|
|
|
25 |
processor_bytes = io.BytesIO()
|
26 |
processor = MusicgenProcessor.from_pretrained("facebook/musicgen-small")
|
27 |
|
28 |
+
# Get the vocabulary from the tokenizer and write it directly to the BytesIO object
|
29 |
+
vocabulary = processor.tokenizer.get_vocab()
|
30 |
+
with io.open(processor_bytes, "w", encoding="utf-8") as f:
|
31 |
+
for word, index in vocabulary.items():
|
32 |
+
f.write(f"{word} {index}\n")
|
33 |
+
|
34 |
+
processor_bytes.seek(0) # Reset the stream position
|
35 |
+
|
36 |
processor.feature_extractor.save_pretrained(processor_bytes)
|
37 |
|
38 |
processor = MusicgenProcessor.from_pretrained(processor_bytes)
|