mrfakename commited on
Commit
b6d6efc
1 Parent(s): 46f15cd

Update musiclib.py

Browse files
Files changed (1) hide show
  1. musiclib.py +2 -2
musiclib.py CHANGED
@@ -25,7 +25,7 @@ tokenizer = pipeline
25
  EOS_ID = 0
26
  TOKEN_SEP = ' '
27
 
28
- def musicgen(ccc='<pad>', piano_only=False):
29
  # ccc = '<pad>'
30
  ccc_output = '<start>'
31
  # ccc = "v:5b:3 v:5b:2 t125 t125 t125 t106 pi:43:5 t24 pi:4a:7 t15 pi:4f:7 t17 pi:56:7 t18 pi:54:7 t125 t49 pi:51:7 t117 pi:4d:7 t125 t125 t111 pi:37:7 t14 pi:3e:6 t15 pi:43:6 t12 pi:4a:7 t17 pi:48:7 t125 t60 pi:45:7 t121 pi:41:7 t125 t117 s:46:5 s:52:5 f:46:5 f:52:5 t121 s:45:5 s:46:0 s:51:5 s:52:0 f:45:5 f:46:0 f:51:5 f:52:0 t121 s:41:5 s:45:0 s:4d:5 s:51:0 f:41:5 f:45:0 f:4d:5 f:51:0 t102 pi:37:0 pi:3e:0 pi:41:0 pi:43:0 pi:45:0 pi:48:0 pi:4a:0 pi:4d:0 pi:4f:0 pi:51:0 pi:54:0 pi:56:0 t19 s:3e:5 s:41:0 s:4a:5 s:4d:0 f:3e:5 f:41:0 f:4a:5 f:4d:0 t121 v:3a:5 t121 v:39:7 t15 v:3a:0 t106 v:35:8 t10 v:39:0 t111 v:30:8 v:35:0 t125 t117 v:32:8 t10 v:30:0 t125 t125 t103 v:5b:0 v:5b:0 t9 pi:4a:7"
@@ -37,7 +37,7 @@ def musicgen(ccc='<pad>', piano_only=False):
37
  yield output
38
  occurrence = {}
39
  state = None
40
- for i in range(4096): # only trained with ctx4096 (will be longer soon)
41
  if i == 0:
42
  out, state = model.forward(tokenizer.encode(ccc), state)
43
  else:
 
25
  EOS_ID = 0
26
  TOKEN_SEP = ' '
27
 
28
+ def musicgen(ccc='<pad>', piano_only=False, length=4096):
29
  # ccc = '<pad>'
30
  ccc_output = '<start>'
31
  # ccc = "v:5b:3 v:5b:2 t125 t125 t125 t106 pi:43:5 t24 pi:4a:7 t15 pi:4f:7 t17 pi:56:7 t18 pi:54:7 t125 t49 pi:51:7 t117 pi:4d:7 t125 t125 t111 pi:37:7 t14 pi:3e:6 t15 pi:43:6 t12 pi:4a:7 t17 pi:48:7 t125 t60 pi:45:7 t121 pi:41:7 t125 t117 s:46:5 s:52:5 f:46:5 f:52:5 t121 s:45:5 s:46:0 s:51:5 s:52:0 f:45:5 f:46:0 f:51:5 f:52:0 t121 s:41:5 s:45:0 s:4d:5 s:51:0 f:41:5 f:45:0 f:4d:5 f:51:0 t102 pi:37:0 pi:3e:0 pi:41:0 pi:43:0 pi:45:0 pi:48:0 pi:4a:0 pi:4d:0 pi:4f:0 pi:51:0 pi:54:0 pi:56:0 t19 s:3e:5 s:41:0 s:4a:5 s:4d:0 f:3e:5 f:41:0 f:4a:5 f:4d:0 t121 v:3a:5 t121 v:39:7 t15 v:3a:0 t106 v:35:8 t10 v:39:0 t111 v:30:8 v:35:0 t125 t117 v:32:8 t10 v:30:0 t125 t125 t103 v:5b:0 v:5b:0 t9 pi:4a:7"
 
37
  yield output
38
  occurrence = {}
39
  state = None
40
+ for i in range(length): # only trained with ctx4096 (will be longer soon)
41
  if i == 0:
42
  out, state = model.forward(tokenizer.encode(ccc), state)
43
  else: