Spaces:
Sleeping
Sleeping
asigalov61
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ def GenerateSong(input_melody_seed_number):
|
|
40 |
model = TransformerWrapper(
|
41 |
num_tokens = PAD_IDX+1,
|
42 |
max_seq_len = SEQ_LEN,
|
43 |
-
attn_layers = Decoder(dim = 1024, depth =
|
44 |
)
|
45 |
|
46 |
model = AutoregressiveWrapper(model, ignore_index = PAD_IDX)
|
@@ -51,7 +51,7 @@ def GenerateSong(input_melody_seed_number):
|
|
51 |
print('Loading model checkpoint...')
|
52 |
|
53 |
model.load_state_dict(
|
54 |
-
torch.load('
|
55 |
map_location=DEVICE))
|
56 |
print('=' * 70)
|
57 |
|
@@ -199,12 +199,9 @@ if __name__ == "__main__":
|
|
199 |
print('=' * 70)
|
200 |
|
201 |
soundfont = "SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2"
|
202 |
-
|
203 |
-
print('Loading seed meldoies data...')
|
204 |
-
seed_melodies_data = TMIDIX.Tegridy_Any_Pickle_File_Reader('Melody2Song_Seq2Seq_Music_Transformer_Seed_Melodies_Data')
|
205 |
-
print('=' * 70)
|
206 |
|
207 |
app = gr.Blocks()
|
|
|
208 |
with app:
|
209 |
gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Melody2Song Seq2Seq Music Transformer</h1>")
|
210 |
gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Generate unique songs from melodies with seq2seq music transformer</h1>")
|
|
|
40 |
model = TransformerWrapper(
|
41 |
num_tokens = PAD_IDX+1,
|
42 |
max_seq_len = SEQ_LEN,
|
43 |
+
attn_layers = Decoder(dim = 1024, depth = 32, heads = 16, attn_flash = True)
|
44 |
)
|
45 |
|
46 |
model = AutoregressiveWrapper(model, ignore_index = PAD_IDX)
|
|
|
51 |
print('Loading model checkpoint...')
|
52 |
|
53 |
model.load_state_dict(
|
54 |
+
torch.load('Bridge_Music_Transformer_Trained_Model_30023_steps_0.482_loss_0.8523_acc.pth',
|
55 |
map_location=DEVICE))
|
56 |
print('=' * 70)
|
57 |
|
|
|
199 |
print('=' * 70)
|
200 |
|
201 |
soundfont = "SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2"
|
|
|
|
|
|
|
|
|
202 |
|
203 |
app = gr.Blocks()
|
204 |
+
|
205 |
with app:
|
206 |
gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Melody2Song Seq2Seq Music Transformer</h1>")
|
207 |
gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Generate unique songs from melodies with seq2seq music transformer</h1>")
|