projectlosangeles commited on
Commit
ef313f6
·
verified ·
1 Parent(s): 8d41287

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -26
app.py CHANGED
@@ -59,7 +59,7 @@ print('=' * 70)
59
 
60
  #==================================================================================
61
 
62
- MODEL_CHECKPOINT = 'Godzilla_Piano_Chords_Texturing_Trained_Model_36457_steps_0.5384_loss_0.8417_acc.pth'
63
 
64
  SOUDFONT_PATH = 'SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2'
65
 
@@ -69,21 +69,6 @@ MAX_GEN_TOKS = 3072
69
 
70
  #==================================================================================
71
 
72
- print('=' * 70)
73
- print('Loading popular hook melodies dataset...')
74
-
75
- popular_hook_melodies_pickle = hf_hub_download(repo_id='projectlosangeles/Godzilla-Piano-Chords-Texturing',
76
- filename='popular_hook_melodies_24_64_CC_BY_NC_SA.pickle'
77
- )
78
-
79
- popular_hook_melodies = TMIDIX.Tegridy_Any_Pickle_File_Reader(popular_hook_melodies_pickle)
80
-
81
- print('=' * 70)
82
- print('Done!')
83
- print('=' * 70)
84
-
85
- #==================================================================================
86
-
87
  print('=' * 70)
88
  print('Instantiating model...')
89
 
@@ -112,9 +97,9 @@ model = AutoregressiveWrapper(model, ignore_index=PAD_IDX, pad_value=PAD_IDX)
112
  print('=' * 70)
113
  print('Loading model checkpoint...')
114
 
115
- model_checkpoint = hf_hub_download(repo_id='projectlosangeles/Godzilla-Piano-Chords-Texturing', filename=MODEL_CHECKPOINT)
116
 
117
- model.load_state_dict(torch.load(model_checkpoint, map_location='cpu', weights_only=True))
118
 
119
  model = torch.compile(model, mode='max-autotune')
120
 
@@ -425,11 +410,6 @@ with gr.Blocks() as demo:
425
  input_midi = gr.File(label="Input MIDI",
426
  file_types=[".midi", ".mid", ".kar"]
427
  )
428
-
429
- input_melody = gr.Textbox(value="Hotel California",
430
- label="Popular melodies database search query",
431
- info='If the query is not found, random melody will be selected. Custom MIDI overrides search query'
432
- )
433
 
434
  gr.Markdown("## Generation options")
435
 
@@ -449,7 +429,6 @@ with gr.Blocks() as demo:
449
 
450
  generate_btn.click(Generate_Accompaniment,
451
  [input_midi,
452
- input_melody,
453
  melody_patch,
454
  use_nth_note,
455
  model_temperature,
@@ -463,10 +442,9 @@ with gr.Blocks() as demo:
463
  )
464
 
465
  gr.Examples(
466
- [["Sharing The Night Together.kar", "Custom MIDI", -1, 1, 0.9, 15]
467
  ],
468
  [input_midi,
469
- input_melody,
470
  melody_patch,
471
  use_nth_note,
472
  model_temperature,
 
59
 
60
  #==================================================================================
61
 
62
+ MODEL_CHECKPOINT = 'Godzilla_Piano_Chords_Texturing_Trained_Model_18001_steps_0.8099_loss_0.7677_acc.pth'
63
 
64
  SOUDFONT_PATH = 'SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2'
65
 
 
69
 
70
  #==================================================================================
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  print('=' * 70)
73
  print('Instantiating model...')
74
 
 
97
  print('=' * 70)
98
  print('Loading model checkpoint...')
99
 
100
+ model_checkpoint = hf_hub_download(repo_id='asigalov61/Godzilla-Piano-Transformer', filename=MODEL_CHECKPOINT)
101
 
102
+ model.load_state_dict(torch.load(model_checkpoint, map_location=device_type, weights_only=True))
103
 
104
  model = torch.compile(model, mode='max-autotune')
105
 
 
410
  input_midi = gr.File(label="Input MIDI",
411
  file_types=[".midi", ".mid", ".kar"]
412
  )
 
 
 
 
 
413
 
414
  gr.Markdown("## Generation options")
415
 
 
429
 
430
  generate_btn.click(Generate_Accompaniment,
431
  [input_midi,
 
432
  melody_patch,
433
  use_nth_note,
434
  model_temperature,
 
442
  )
443
 
444
  gr.Examples(
445
+ [["Sharing The Night Together.kar", -1, 1, 0.9, 15]
446
  ],
447
  [input_midi,
 
448
  melody_patch,
449
  use_nth_note,
450
  model_temperature,