Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -50,7 +50,7 @@ def GenerateDrums(input_midi, input_num_tokens):
|
|
50 |
print('Loading model checkpoint...')
|
51 |
|
52 |
model.load_state_dict(
|
53 |
-
torch.load('
|
54 |
map_location=DEVICE))
|
55 |
print('=' * 70)
|
56 |
|
@@ -168,6 +168,7 @@ def GenerateDrums(input_midi, input_num_tokens):
|
|
168 |
time = 0
|
169 |
dtime = 0
|
170 |
ntime = 0
|
|
|
171 |
dur = 32
|
172 |
vel = 90
|
173 |
vels = [100, 120]
|
@@ -180,6 +181,8 @@ def GenerateDrums(input_midi, input_num_tokens):
|
|
180 |
|
181 |
if 0 <= ss < 128:
|
182 |
|
|
|
|
|
183 |
time += cscore[idx][0][0] * 32
|
184 |
|
185 |
for c in cscore[idx]:
|
@@ -198,13 +201,10 @@ def GenerateDrums(input_midi, input_num_tokens):
|
|
198 |
pitch = (ss-256)
|
199 |
|
200 |
if 384 <= ss < 393:
|
201 |
-
|
202 |
-
vel = (
|
203 |
-
|
204 |
-
|
205 |
-
song_f.append(['note', time, dur, 9, pitch, vel, 128])
|
206 |
-
else:
|
207 |
-
song_f.append(['note', dtime, dur, 9, pitch, vel, 128])
|
208 |
|
209 |
detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(song_f,
|
210 |
output_signature = 'Ultimate Drums Transformer',
|
|
|
50 |
print('Loading model checkpoint...')
|
51 |
|
52 |
model.load_state_dict(
|
53 |
+
torch.load('Ultimate_Drums_Transformer_Small_Trained_Model_VER4_RST_VEL_4L_16534_steps_0.4074_loss_0.8631_acc.pth',
|
54 |
map_location=DEVICE))
|
55 |
print('=' * 70)
|
56 |
|
|
|
168 |
time = 0
|
169 |
dtime = 0
|
170 |
ntime = 0
|
171 |
+
ptime = 0
|
172 |
dur = 32
|
173 |
vel = 90
|
174 |
vels = [100, 120]
|
|
|
181 |
|
182 |
if 0 <= ss < 128:
|
183 |
|
184 |
+
dtime = ptime = time
|
185 |
+
|
186 |
time += cscore[idx][0][0] * 32
|
187 |
|
188 |
for c in cscore[idx]:
|
|
|
201 |
pitch = (ss-256)
|
202 |
|
203 |
if 384 <= ss < 393:
|
204 |
+
|
205 |
+
vel = (ss-384) * 15
|
206 |
+
|
207 |
+
song_f.append(['note', dtime, dur, 9, pitch, vel, 128])
|
|
|
|
|
|
|
208 |
|
209 |
detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(song_f,
|
210 |
output_signature = 'Ultimate Drums Transformer',
|