asigalov61 commited on
Commit
a6d9646
1 Parent(s): d34be48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -35,7 +35,7 @@ def Generate_Rock_Song(input_midi,
35
  input_number_gen_tokens,
36
  input_num_memory_tokens,
37
  input_model_temperature,
38
- input_model_top_k
39
  ):
40
 
41
  #===============================================================================
@@ -211,8 +211,8 @@ def Generate_Rock_Song(input_midi,
211
  with ctx:
212
  out = model.generate(x,
213
  num_gen_tokens,
214
- filter_logits_fn=top_k,
215
- filter_kwargs={'k': input_model_top_k},
216
  temperature=input_model_temperature,
217
  return_prime=True,
218
  verbose=True)
@@ -246,8 +246,8 @@ def Generate_Rock_Song(input_midi,
246
  out = model.generate(x,
247
  1,
248
  filter_logits_fn=top_k,
249
- filter_kwargs={'k': input_model_top_k},
250
- temperature=input_model_temperature,
251
  return_prime=False,
252
  verbose=False)
253
 
@@ -445,7 +445,7 @@ if __name__ == "__main__":
445
 
446
  input_num_memory_tokens = gr.Slider(1024, 4096, value=2048, step=16, label="Number of memory tokens")
447
  input_model_temperature = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Model temperature")
448
- input_model_top_k = gr.Slider(1, 50, value=10, step=1, label="Model sampling top k value")
449
 
450
  run_btn = gr.Button("generate", variant="primary")
451
 
@@ -467,16 +467,16 @@ if __name__ == "__main__":
467
  input_number_gen_tokens,
468
  input_num_memory_tokens,
469
  input_model_temperature,
470
- input_model_top_k,
471
  ],
472
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
473
 
474
  gr.Examples(
475
- [["Rock Violin.mid", "Controlled", 0, 512, True, True, 512, 1024, 2048, 0.9, 10],
476
- ["Come To My Window.mid", "Controlled", 128, 256, False, False, 512, 1024, 2048, 0.9, 10],
477
- ["Sharing The Night Together.kar", "Controlled", 128, 256, True, True, 512, 1024, 2048, 0.9, 10],
478
- ["Hotel California.mid", "Controlled", 128, 256, True, True, 512, 1024, 2048, 0.9, 10],
479
- ["Nothing Else Matters.kar", "Controlled", 128, 256, True, True, 512, 1024, 2048, 0.9, 10],
480
  ],
481
  [input_midi,
482
  input_gen_type,
@@ -488,7 +488,7 @@ if __name__ == "__main__":
488
  input_number_gen_tokens,
489
  input_num_memory_tokens,
490
  input_model_temperature,
491
- input_model_top_k,
492
  ],
493
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],
494
  Generate_Rock_Song,
 
35
  input_number_gen_tokens,
36
  input_num_memory_tokens,
37
  input_model_temperature,
38
+ input_model_top_p
39
  ):
40
 
41
  #===============================================================================
 
211
  with ctx:
212
  out = model.generate(x,
213
  num_gen_tokens,
214
+ filter_logits_fn=top_p,
215
+ filter_kwargs={'thres': input_model_top_p},
216
  temperature=input_model_temperature,
217
  return_prime=True,
218
  verbose=True)
 
246
  out = model.generate(x,
247
  1,
248
  filter_logits_fn=top_k,
249
+ filter_logits_fn=top_p,
250
+ filter_kwargs={'thres': input_model_top_p},
251
  return_prime=False,
252
  verbose=False)
253
 
 
445
 
446
  input_num_memory_tokens = gr.Slider(1024, 4096, value=2048, step=16, label="Number of memory tokens")
447
  input_model_temperature = gr.Slider(0.1, 1.0, value=0.9, step=0.05, label="Model temperature")
448
+ input_model_top_p = gr.Slider(0.1, 1, value=0.96, step=0.01, label="Model sampling top p value")
449
 
450
  run_btn = gr.Button("generate", variant="primary")
451
 
 
467
  input_number_gen_tokens,
468
  input_num_memory_tokens,
469
  input_model_temperature,
470
+ input_model_top_p,
471
  ],
472
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
473
 
474
  gr.Examples(
475
+ [["Rock Violin.mid", "Controlled", 0, 512, True, True, 512, 1024, 2048, 0.9, 0.96],
476
+ ["Come To My Window.mid", "Controlled", 128, 256, False, False, 512, 1024, 2048, 0.9, 0.96],
477
+ ["Sharing The Night Together.kar", "Controlled", 128, 256, True, True, 512, 1024, 2048, 0.9, 0.96],
478
+ ["Hotel California.mid", "Controlled", 128, 256, True, True, 512, 1024, 2048, 0.9, 0.96],
479
+ ["Nothing Else Matters.kar", "Controlled", 128, 256, True, True, 512, 1024, 2048, 0.9, 0.96],
480
  ],
481
  [input_midi,
482
  input_gen_type,
 
488
  input_number_gen_tokens,
489
  input_num_memory_tokens,
490
  input_model_temperature,
491
+ input_model_top_p,
492
  ],
493
  [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],
494
  Generate_Rock_Song,