Hugo Flores Garcia commited on
Commit
925e3e0
1 Parent(s): 7f524ea

lora bloat

Browse files
Files changed (1) hide show
  1. app.py +10 -37
app.py CHANGED
@@ -36,37 +36,12 @@ def load_interface():
36
  return interface
37
 
38
 
39
- LORA_NONE = "None"
40
- def load_loras():
41
- loras = {}
42
- # find confs under conf/generated
43
- for conf_file in Path("conf/generated").glob("**/interface.yml"):
44
- name = conf_file.parent.name
45
- with open(conf_file) as f:
46
- loras[name] = yaml.safe_load(f)
47
- loras[LORA_NONE] = None
48
- return loras
49
 
50
  interface = load_interface()
51
- loras = load_loras()
52
- cur_lora = LORA_NONE
53
-
54
- def load_lora(name):
55
- global interface
56
- global cur_lora
57
- if name == cur_lora:
58
- return
59
- if name != LORA_NONE:
60
- interface.lora_load(
61
- coarse_ckpt=loras[name]["Interface.coarse_lora_ckpt"],
62
- c2f_ckpt=loras[name]["Interface.coarse2fine_lora_ckpt"],
63
- full_ckpts=False
64
- )
65
- cur_lora = name
66
 
67
- else:
68
- interface = load_interface()
69
- cur_lora = LORA_NONE
70
 
71
  # dataset = at.data.datasets.AudioDataset(
72
  # loader,
@@ -100,7 +75,6 @@ def load_example_audio():
100
 
101
 
102
  def _vamp(data, return_mask=False):
103
- load_lora(data[lora_choice])
104
 
105
  out_dir = OUT_DIR / str(uuid.uuid4())
106
  out_dir.mkdir()
@@ -247,7 +221,6 @@ def save_vamp(data):
247
  "stretch_factor": data[stretch_factor],
248
  "seed": data[seed],
249
  "samplecutoff": data[sample_cutoff],
250
- "lora": data[lora_choice],
251
  }
252
 
253
  # save with yaml
@@ -560,12 +533,12 @@ with gr.Blocks() as demo:
560
  # mask settings
561
  with gr.Column():
562
 
563
- lora_choice = gr.Dropdown(
564
- label="lora choice",
565
- choices=list(loras.keys()),
566
- value=LORA_NONE,
567
- visible=False
568
- )
569
 
570
  vamp_button = gr.Button("generate (vamp)!!!")
571
  output_audio = gr.Audio(
@@ -609,7 +582,7 @@ with gr.Blocks() as demo:
609
  beat_mask_width,
610
  beat_mask_downbeats,
611
  seed,
612
- lora_choice,
613
  pitch_shift_amt,
614
  sample_cutoff
615
  }
 
36
  return interface
37
 
38
 
39
+
 
 
 
 
 
 
 
 
 
40
 
41
  interface = load_interface()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
+
44
+
 
45
 
46
  # dataset = at.data.datasets.AudioDataset(
47
  # loader,
 
75
 
76
 
77
  def _vamp(data, return_mask=False):
 
78
 
79
  out_dir = OUT_DIR / str(uuid.uuid4())
80
  out_dir.mkdir()
 
221
  "stretch_factor": data[stretch_factor],
222
  "seed": data[seed],
223
  "samplecutoff": data[sample_cutoff],
 
224
  }
225
 
226
  # save with yaml
 
533
  # mask settings
534
  with gr.Column():
535
 
536
+ # lora_choice = gr.Dropdown(
537
+ # label="lora choice",
538
+ # choices=list(loras.keys()),
539
+ # value=LORA_NONE,
540
+ # visible=False
541
+ # )
542
 
543
  vamp_button = gr.Button("generate (vamp)!!!")
544
  output_audio = gr.Audio(
 
582
  beat_mask_width,
583
  beat_mask_downbeats,
584
  seed,
585
+ # lora_choice,
586
  pitch_shift_amt,
587
  sample_cutoff
588
  }