Spaces:
Running
on
Zero
Running
on
Zero
asigalov61
commited on
Commit
•
afa00bd
1
Parent(s):
dcca7d2
Update inference.py
Browse files- inference.py +6 -12
inference.py
CHANGED
@@ -6,11 +6,11 @@ from pathlib import Path
|
|
6 |
|
7 |
import torch
|
8 |
|
9 |
-
from
|
10 |
write_events_to_midi)
|
11 |
-
from
|
12 |
-
from
|
13 |
-
|
14 |
|
15 |
|
16 |
class PianoTranscription(object):
|
@@ -24,15 +24,9 @@ class PianoTranscription(object):
|
|
24 |
segment_samples: int
|
25 |
device: 'cuda' | 'cpu'
|
26 |
"""
|
27 |
-
if not checkpoint_path:
|
28 |
-
checkpoint_path='{}/piano_transcription_inference_data/note_F1=0.9677_pedal_F1=0.9186.pth'.format(str(Path.home()))
|
29 |
-
print('Checkpoint path: {}'.format(checkpoint_path))
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
print('Total size: ~165 MB')
|
34 |
-
zenodo_path = 'https://zenodo.org/record/4034264/files/CRNN_note_F1%3D0.9677_pedal_F1%3D0.9186.pth?download=1'
|
35 |
-
os.system('wget -O "{}" "{}"'.format(checkpoint_path, zenodo_path))
|
36 |
|
37 |
print('Using {} for inference.'.format(device))
|
38 |
|
|
|
6 |
|
7 |
import torch
|
8 |
|
9 |
+
from utilities import (create_folder, get_filename, RegressionPostProcessor,
|
10 |
write_events_to_midi)
|
11 |
+
from models import Regress_onset_offset_frame_velocity_CRNN, Note_pedal
|
12 |
+
from pytorch_utils import move_data_to_device, forward
|
13 |
+
import config
|
14 |
|
15 |
|
16 |
class PianoTranscription(object):
|
|
|
24 |
segment_samples: int
|
25 |
device: 'cuda' | 'cpu'
|
26 |
"""
|
|
|
|
|
|
|
27 |
|
28 |
+
checkpoint_path="CRNN_note_F1%3D0.9677_pedal_F1%3D0.9186.pth"
|
29 |
+
print('Checkpoint path: {}'.format(checkpoint_path))
|
|
|
|
|
|
|
30 |
|
31 |
print('Using {} for inference.'.format(device))
|
32 |
|