Instructions to use Pierfrancesco/adt-str with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Pierfrancesco/adt-str with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Pierfrancesco/adt-str", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download modules/utils.py from Pierfrancesco/adt-str: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/Pierfrancesco/adt-str/resolve/main/modules/utils.py
- Command line
-
hf download hf://Pierfrancesco/adt-str/modules/utils.py
-
curl -L -o utils.py https://huggingface.co/Pierfrancesco/adt-str/resolve/main/modules/utils.py
1.24 kB
| from pathlib import Path | |
| def midi_explorer(dataset, path): # path(str)->paths(list) | |
| if dataset == "lakh": | |
| return list(Path(path).glob("*.mid")) | |
| if dataset == "lakh_matched": | |
| return list(Path(path).rglob("*.mid")) | |
| if dataset == "guitarset": | |
| return list(Path(path).glob("*.jams")) | |
| if dataset == "maestro": | |
| files = [] | |
| with open(path.split(",")[0] + "/maestro-v3.0.0.csv", "r", encoding="utf-8") as file: | |
| reader = csv.reader(file) | |
| next(reader) | |
| for row in reader: | |
| if row[2] == path.split(",")[1]: | |
| files.append(path.split(",")[0] + "/" + row[4]) | |
| return files | |
| if dataset == "slakh": | |
| return list(Path(path).glob("**/MIDI/*.mid")) | |
| if dataset == "molina": | |
| return list(Path(path).glob("*.GroundTruth.txt")) | |
| if dataset == "phenicx": | |
| return list(Path(path).glob("*.mid")) | |
| if dataset == "urmp": | |
| return list(Path(path).rglob("Notes*.txt")) | |
| if dataset == "gaps": | |
| return list(Path(path).glob("*.mid")) | |
| if dataset == "other": | |
| return list(Path(path).glob("*.mid")) | |
| if dataset == "maps": | |
| return list(Path(path).glob("*.txt")) | |