Instructions to use B-K/song2midi-processor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use B-K/song2midi-processor with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("B-K/song2midi-processor", dtype="auto") - Notebooks
- Google Colab
- Kaggle
Upload processing_song2midi.py
Browse files- processing_song2midi.py +3 -0
processing_song2midi.py
CHANGED
|
@@ -60,6 +60,9 @@ class Song2MIDIProcessor(ProcessorMixin):
|
|
| 60 |
attribute = getattr(self, attribute_name, None)
|
| 61 |
input_data, input_kwargs = attribute_to_kwargs[attribute_name]
|
| 62 |
if input_data is not None and attribute is not None:
|
|
|
|
|
|
|
|
|
|
| 63 |
attribute_output = attribute(input_data, **kwargs[input_kwargs])
|
| 64 |
outputs[attribute_name] = attribute_output
|
| 65 |
|
|
|
|
| 60 |
attribute = getattr(self, attribute_name, None)
|
| 61 |
input_data, input_kwargs = attribute_to_kwargs[attribute_name]
|
| 62 |
if input_data is not None and attribute is not None:
|
| 63 |
+
if attribute_name == "midi_tokenizer":
|
| 64 |
+
# Change the None to empty string to avoid errors in tokenizers when trying to tokenize None.
|
| 65 |
+
input_data = input_data if input_data is not None else ""
|
| 66 |
attribute_output = attribute(input_data, **kwargs[input_kwargs])
|
| 67 |
outputs[attribute_name] = attribute_output
|
| 68 |
|