danurahul commited on
Commit
4d95c77
1 Parent(s): d0cf289

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +31 -0
main.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from model import PopMusicTransformer
2
+ import os
3
+ os.environ['CUDA_VISIBLE_DEVICES'] = '0'
4
+
5
+ def main():
6
+ # declare model
7
+ model = PopMusicTransformer(
8
+ checkpoint='REMI-tempo-checkpoint',
9
+ is_training=False)
10
+
11
+ # generate from scratch
12
+ model.generate(
13
+ n_target_bar=16,
14
+ temperature=1.2,
15
+ topk=5,
16
+ output_path='./result/from_scratch.midi',
17
+ prompt=None)
18
+
19
+ # generate continuation
20
+ model.generate(
21
+ n_target_bar=16,
22
+ temperature=1.2,
23
+ topk=5
24
+ output_path='./result/continuation.midi',
25
+ prompt='./data/evaluation/000.midi')
26
+
27
+ # close model
28
+ model.close()
29
+
30
+ if __name__ == '__main__':
31
+ main()