asigalov61 commited on
Commit
d6843b4
1 Parent(s): 5affaf3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
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('Ultimate_Drums_Transformer_Small_Trained_Model_VER4_RST_VEL_8L_13501_steps_0.3341_loss_0.8893_acc.pth',
54
  map_location=DEVICE))
55
  print('=' * 70)
56
 
@@ -94,11 +94,11 @@ def GenerateDrums(input_midi, input_num_tokens):
94
 
95
  escore_notes = [e for e in escore_notes if e[3] != 9]
96
 
97
- escore_notes = TMIDIX.augment_enhanced_score_notes(escore_notes)
98
 
99
  patches = TMIDIX.patch_list_from_enhanced_score_notes(escore_notes)
100
 
101
- dscore = TMIDIX.delta_score_notes(escore_notes, compress_timings=True, even_timings=True)
102
 
103
  cscore = TMIDIX.chordify_score([d[1:] for d in dscore])
104
 
@@ -106,6 +106,8 @@ def GenerateDrums(input_midi, input_num_tokens):
106
 
107
  comp_times = [t[1] for t in dscore if t[1] != 0]
108
 
 
 
109
  #===============================================================================
110
 
111
  print('=' * 70)
@@ -117,7 +119,7 @@ def GenerateDrums(input_midi, input_num_tokens):
117
  output = []
118
 
119
  temperature=0.9
120
- max_drums_limit=4
121
  num_memory_tokens=4096
122
 
123
  for c in comp_times[:input_num_tokens]:
@@ -203,17 +205,15 @@ def GenerateDrums(input_midi, input_num_tokens):
203
 
204
  dtime += (ss-128) * 32
205
 
206
- if 256 <= ss < 384:
207
 
208
  pitch = (ss-256)
209
 
210
- if 384 <= ss < 393:
211
 
212
- if pitch != 0:
213
 
214
- vel = (ss-384) * 15
215
-
216
- song_f.append(['note', dtime, dur, 9, pitch, vel, 128])
217
 
218
  detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(song_f,
219
  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_9107_steps_0.5467_loss_0.8231_acc.pth',
54
  map_location=DEVICE))
55
  print('=' * 70)
56
 
 
94
 
95
  escore_notes = [e for e in escore_notes if e[3] != 9]
96
 
97
+ escore_notes = TMIDIX.augment_enhanced_score_notes(escore_notes, timings_divider=32)
98
 
99
  patches = TMIDIX.patch_list_from_enhanced_score_notes(escore_notes)
100
 
101
+ dscore = TMIDIX.delta_score_notes(escore_notes)
102
 
103
  cscore = TMIDIX.chordify_score([d[1:] for d in dscore])
104
 
 
106
 
107
  comp_times = [t[1] for t in dscore if t[1] != 0]
108
 
109
+ comp_times = comp_times + [comp_times[-1]]
110
+
111
  #===============================================================================
112
 
113
  print('=' * 70)
 
119
  output = []
120
 
121
  temperature=0.9
122
+ max_drums_limit=3
123
  num_memory_tokens=4096
124
 
125
  for c in comp_times[:input_num_tokens]:
 
205
 
206
  dtime += (ss-128) * 32
207
 
208
+ if 256 < ss < 384:
209
 
210
  pitch = (ss-256)
211
 
212
+ if 384 < ss < 393:
213
 
214
+ vel = (ss-384) * 15
215
 
216
+ song_f.append(['note', dtime, dur, 9, pitch, vel, 128])
 
 
217
 
218
  detailed_stats = TMIDIX.Tegridy_ms_SONG_to_MIDI_Converter(song_f,
219
  output_signature = 'Ultimate Drums Transformer',