Spaces:
Running
on
Zero
Running
on
Zero
asigalov61
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -58,8 +58,8 @@ print('=' * 70)
|
|
58 |
|
59 |
MODEL_CHECKPOINTS = {
|
60 |
'with velocity - 3 epochs': 'Monster_Piano_Transformer_Velocity_Trained_Model_59896_steps_0.9055_loss_0.735_acc.pth',
|
61 |
-
'without velocity - 3 epochs': '
|
62 |
-
'without velocity -
|
63 |
}
|
64 |
|
65 |
SOUDFONT_PATH = 'SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2'
|
@@ -82,7 +82,12 @@ def load_model(model_selector):
|
|
82 |
ctx = torch.amp.autocast(device_type=device_type, dtype=ptdtype)
|
83 |
|
84 |
SEQ_LEN = 2048
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
model = TransformerWrapper(
|
88 |
num_tokens = PAD_IDX+1,
|
@@ -173,7 +178,7 @@ def save_midi(tokens, batch_number=None, model_selector=''):
|
|
173 |
elif 256 < m < 384:
|
174 |
pitch = (m-256)
|
175 |
|
176 |
-
if model_selector == 'without velocity - 3 epochs' or model_selector == 'without velocity -
|
177 |
song_f.append(['note', time, dur, 0, pitch, max(40, pitch), 0])
|
178 |
|
179 |
elif 384 < m < 512:
|
@@ -529,7 +534,7 @@ with gr.Blocks() as demo:
|
|
529 |
|
530 |
gr.Markdown("## Generate")
|
531 |
|
532 |
-
model_selector = gr.Dropdown(["without velocity -
|
533 |
"without velocity - 3 epochs",
|
534 |
"with velocity - 3 epochs"
|
535 |
],
|
|
|
58 |
|
59 |
MODEL_CHECKPOINTS = {
|
60 |
'with velocity - 3 epochs': 'Monster_Piano_Transformer_Velocity_Trained_Model_59896_steps_0.9055_loss_0.735_acc.pth',
|
61 |
+
'without velocity - 3 epochs': 'Monster_Piano_Transformer_No_Velocity_Trained_Model_69412_steps_0.8577_loss_0.7442_acc.pth',
|
62 |
+
'without velocity - 7 epochs': 'Monster_Piano_Transformer_No_Velocity_Trained_Model_161960_steps_0.7775_loss_0.7661_acc.pth'
|
63 |
}
|
64 |
|
65 |
SOUDFONT_PATH = 'SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2'
|
|
|
82 |
ctx = torch.amp.autocast(device_type=device_type, dtype=ptdtype)
|
83 |
|
84 |
SEQ_LEN = 2048
|
85 |
+
|
86 |
+
if model_selector == 'with velocity - 3 epochs':
|
87 |
+
PAD_IDX = 512
|
88 |
+
|
89 |
+
else:
|
90 |
+
PAD_IDX = 384
|
91 |
|
92 |
model = TransformerWrapper(
|
93 |
num_tokens = PAD_IDX+1,
|
|
|
178 |
elif 256 < m < 384:
|
179 |
pitch = (m-256)
|
180 |
|
181 |
+
if model_selector == 'without velocity - 3 epochs' or model_selector == 'without velocity - 7 epochs':
|
182 |
song_f.append(['note', time, dur, 0, pitch, max(40, pitch), 0])
|
183 |
|
184 |
elif 384 < m < 512:
|
|
|
534 |
|
535 |
gr.Markdown("## Generate")
|
536 |
|
537 |
+
model_selector = gr.Dropdown(["without velocity - 7 epochs",
|
538 |
"without velocity - 3 epochs",
|
539 |
"with velocity - 3 epochs"
|
540 |
],
|