Simon Stolarczyk commited on
Commit
d02a40d
1 Parent(s): c90d42e

More output while building and fix learner typo.

Browse files
Files changed (2) hide show
  1. .ipynb_checkpoints/app-checkpoint.py +6 -2
  2. app.py +6 -2
.ipynb_checkpoints/app-checkpoint.py CHANGED
@@ -19,11 +19,13 @@ import os
19
  print(os.getcwd())
20
 
21
  # Load the stored data. This is needed to generate the vocab.
 
22
  data_dir = Path('.')
23
  data = load_data(data_dir, 'data.pkl')
24
 
25
  from huggingface_hub import hf_hub_download
26
 
 
27
  model_cache_path = hf_hub_download(repo_id="psistolar/musicautobot-fine1", filename="model.pth")
28
 
29
 
@@ -33,7 +35,7 @@ config = default_config()
33
  config['encode_position'] = True
34
 
35
 
36
-
37
  # Load our fine-tuned model
38
  learner = music_model_learner(
39
  data,
@@ -41,6 +43,8 @@ learner = music_model_learner(
41
  pretrained_path=model_cache_path
42
  )
43
 
 
 
44
 
45
 
46
  def process_midi(midi_file):
@@ -50,7 +54,7 @@ def process_midi(midi_file):
50
  item = MusicItem.from_file(name, data.vocab);
51
 
52
  # full is the prediction appended to the input
53
- pred, full = learn.predict(item, n_words=100)
54
 
55
  # convert to stream and then MIDI file
56
  stream = full.to_stream()
 
19
  print(os.getcwd())
20
 
21
  # Load the stored data. This is needed to generate the vocab.
22
+ print('Loading data to build vocabulary.')
23
  data_dir = Path('.')
24
  data = load_data(data_dir, 'data.pkl')
25
 
26
  from huggingface_hub import hf_hub_download
27
 
28
+ print('Downloading model.')
29
  model_cache_path = hf_hub_download(repo_id="psistolar/musicautobot-fine1", filename="model.pth")
30
 
31
 
 
35
  config['encode_position'] = True
36
 
37
 
38
+ print("Building model.")
39
  # Load our fine-tuned model
40
  learner = music_model_learner(
41
  data,
 
43
  pretrained_path=model_cache_path
44
  )
45
 
46
+ print("Ready to use.")
47
+
48
 
49
 
50
  def process_midi(midi_file):
 
54
  item = MusicItem.from_file(name, data.vocab);
55
 
56
  # full is the prediction appended to the input
57
+ pred, full = learner.predict(item, n_words=100)
58
 
59
  # convert to stream and then MIDI file
60
  stream = full.to_stream()
app.py CHANGED
@@ -19,11 +19,13 @@ import os
19
  print(os.getcwd())
20
 
21
  # Load the stored data. This is needed to generate the vocab.
 
22
  data_dir = Path('.')
23
  data = load_data(data_dir, 'data.pkl')
24
 
25
  from huggingface_hub import hf_hub_download
26
 
 
27
  model_cache_path = hf_hub_download(repo_id="psistolar/musicautobot-fine1", filename="model.pth")
28
 
29
 
@@ -33,7 +35,7 @@ config = default_config()
33
  config['encode_position'] = True
34
 
35
 
36
-
37
  # Load our fine-tuned model
38
  learner = music_model_learner(
39
  data,
@@ -41,6 +43,8 @@ learner = music_model_learner(
41
  pretrained_path=model_cache_path
42
  )
43
 
 
 
44
 
45
 
46
  def process_midi(midi_file):
@@ -50,7 +54,7 @@ def process_midi(midi_file):
50
  item = MusicItem.from_file(name, data.vocab);
51
 
52
  # full is the prediction appended to the input
53
- pred, full = learn.predict(item, n_words=100)
54
 
55
  # convert to stream and then MIDI file
56
  stream = full.to_stream()
 
19
  print(os.getcwd())
20
 
21
  # Load the stored data. This is needed to generate the vocab.
22
+ print('Loading data to build vocabulary.')
23
  data_dir = Path('.')
24
  data = load_data(data_dir, 'data.pkl')
25
 
26
  from huggingface_hub import hf_hub_download
27
 
28
+ print('Downloading model.')
29
  model_cache_path = hf_hub_download(repo_id="psistolar/musicautobot-fine1", filename="model.pth")
30
 
31
 
 
35
  config['encode_position'] = True
36
 
37
 
38
+ print("Building model.")
39
  # Load our fine-tuned model
40
  learner = music_model_learner(
41
  data,
 
43
  pretrained_path=model_cache_path
44
  )
45
 
46
+ print("Ready to use.")
47
+
48
 
49
 
50
  def process_midi(midi_file):
 
54
  item = MusicItem.from_file(name, data.vocab);
55
 
56
  # full is the prediction appended to the input
57
+ pred, full = learner.predict(item, n_words=100)
58
 
59
  # convert to stream and then MIDI file
60
  stream = full.to_stream()