cocktailpeanut commited on
Commit
fe79903
Β·
1 Parent(s): 50c487f

reer to 90sec model

Browse files
Files changed (2) hide show
  1. app.py +8 -4
  2. diffrhythm/infer/infer_utils.py +2 -2
app.py CHANGED
@@ -40,9 +40,12 @@ def clear_text():
40
  return gr.update(value="") # Clears the text field
41
 
42
  #@spaces.GPU
43
- def infer_music(lrc, ref_audio_path, steps, file_type, cfg_strength, odeint_method, duration, prompt=None):
 
44
 
45
- max_frames = math.floor(duration * 21.56)
 
 
46
  sway_sampling_coef = -1 if steps < 32 else None
47
  vocal_flag = False
48
  lrc_prompt, start_time = get_lrc_token(max_frames, lrc, tokenizer, device)
@@ -227,7 +230,7 @@ with gr.Blocks(css=css) as demo:
227
 
228
  with gr.Column():
229
 
230
- duration = gr.Slider(95, 285, value=285, label="Music Duration")
231
  lyrics_btn = gr.Button("Submit", variant="primary")
232
  audio_output = gr.Audio(label="Audio Result", type="filepath", elem_id="audio_output")
233
  with gr.Accordion("Advanced Settings", open=False):
@@ -379,7 +382,8 @@ with gr.Blocks(css=css) as demo:
379
 
380
  lyrics_btn.click(
381
  fn=infer_music,
382
- inputs=[lrc, audio_prompt, steps, file_type, cfg_strength, odeint_method, duration, text_prompt, ],
 
383
  outputs=audio_output
384
  )
385
 
 
40
  return gr.update(value="") # Clears the text field
41
 
42
  #@spaces.GPU
43
+ #def infer_music(lrc, ref_audio_path, steps, file_type, cfg_strength, odeint_method, duration, prompt=None):
44
+ def infer_music(lrc, ref_audio_path, steps, file_type, cfg_strength, odeint_method, prompt=None):
45
 
46
+ duration = 95
47
+ max_frames = 2048
48
+ #max_frames = math.floor(duration * 21.56)
49
  sway_sampling_coef = -1 if steps < 32 else None
50
  vocal_flag = False
51
  lrc_prompt, start_time = get_lrc_token(max_frames, lrc, tokenizer, device)
 
230
 
231
  with gr.Column():
232
 
233
+ #duration = gr.Slider(95, 285, value=285, label="Music Duration")
234
  lyrics_btn = gr.Button("Submit", variant="primary")
235
  audio_output = gr.Audio(label="Audio Result", type="filepath", elem_id="audio_output")
236
  with gr.Accordion("Advanced Settings", open=False):
 
382
 
383
  lyrics_btn.click(
384
  fn=infer_music,
385
+ #inputs=[lrc, audio_prompt, steps, file_type, cfg_strength, odeint_method, duration, text_prompt, ],
386
+ inputs=[lrc, audio_prompt, steps, file_type, cfg_strength, odeint_method, text_prompt, ],
387
  outputs=audio_output
388
  )
389
 
diffrhythm/infer/infer_utils.py CHANGED
@@ -12,8 +12,8 @@ from diffrhythm.model import DiT, CFM
12
 
13
  def prepare_model(device):
14
  # prepare cfm model
15
- #dit_ckpt_path = hf_hub_download(repo_id="ASLP-lab/DiffRhythm-base", filename="cfm_model.pt")
16
- dit_ckpt_path = hf_hub_download(repo_id="ASLP-lab/DiffRhythm-full", filename="cfm_model.pt")
17
  dit_config_path = "./diffrhythm/config/diffrhythm-1b.json"
18
  with open(dit_config_path, encoding="utf-8") as f:
19
  model_config = json.load(f)
 
12
 
13
  def prepare_model(device):
14
  # prepare cfm model
15
+ dit_ckpt_path = hf_hub_download(repo_id="ASLP-lab/DiffRhythm-base", filename="cfm_model.pt")
16
+ #dit_ckpt_path = hf_hub_download(repo_id="ASLP-lab/DiffRhythm-full", filename="cfm_model.pt")
17
  dit_config_path = "./diffrhythm/config/diffrhythm-1b.json"
18
  with open(dit_config_path, encoding="utf-8") as f:
19
  model_config = json.load(f)