Spaces:
Running
Running
hub ckpt
Browse filesFiles changed (3)
71 unmodified lines7273747576777871 unmodified linesy_final[:,:,t_start:t_end] = y_chunk[:,:,chunk_start:chunk_end]return y_finaldef inference(cfm_model, vae_model, cond, text, duration, style_prompt, negative_style_prompt, start_time):# import pdb; pdb.set_trace()with torch.inference_mode():generated, _ = cfm_model.sample(71 unmodified lines7273747576777871 unmodified linesy_final[:,:,t_start:t_end] = y_chunk[:,:,chunk_start:chunk_end]return y_finaldef inference(cfm_model, vae_model, cond, text, duration, style_prompt, negative_style_prompt, start_time, steps):# import pdb; pdb.set_trace()with torch.inference_mode():generated, _ = cfm_model.sample(
5 unmodified lines67891011121314151617181913 unmodified lines333435363738393 unmodified lines434445464748495 unmodified linesfrom mutagen.mp3 import MP3import osimport numpy as npfrom diffrhythm.model import DiT, CFMdef prepare_model(device):# prepare cfm modeldit_ckpt_path = "/home/node59_tmpdata3/hkchen/music_opensource/dit_model_dpo_normal.pt"dit_config_path = "/home/node59_tmpdata3/hkchen/DiffRhythm/diffrhythm/diffrhythm/config/diffrhythm-1b.json"with open(dit_config_path) as f:model_config = json.load(f)dit_model_cls = DiT13 unmodified linesmuq = muq.to(device).eval()# prepare vaevae = torch.jit.load("/home/node59_tmpdata3/hkchen/F5-TTS-V0/infer/vae_infer.pt").to(device)return cfm, tokenizer, muq, vae3 unmodified linesreturn torch.zeros(1, max_frames, 64).to(device)def get_negative_style_prompt(device):file_path = "/home/node59_tmpdata3/hkchen/DiffRhythm/diffrhythm/diffrhythm/infer/example/vocal.npy"vocal_stlye = np.load(file_path)vocal_stlye = torch.from_numpy(vocal_stlye).to(device) # [1, 512]5 unmodified lines67891011121314151617181913 unmodified lines33343536373839403 unmodified lines444546474849505 unmodified linesfrom mutagen.mp3 import MP3import osimport numpy as npfrom huggingface_hub import hf_hub_downloadfrom diffrhythm.model import DiT, CFMdef prepare_model(device):# prepare cfm modeldit_ckpt_path = hf_hub_download(repo_id="ASLP-lab/DiffRhythm-base", filename="cfm_model.pt")dit_config_path = "./diffrhythm/config/diffrhythm-1b.json"with open(dit_config_path) as f:model_config = json.load(f)dit_model_cls = DiT13 unmodified linesmuq = muq.to(device).eval()# prepare vaevae_ckpt_path = hf_hub_download(repo_id="ASLP-lab/DiffRhythm-vae", filename="vae_model.pt")vae = torch.jit.load(vae_ckpt_path).to(device)return cfm, tokenizer, muq, vae3 unmodified linesreturn torch.zeros(1, max_frames, 64).to(device)def get_negative_style_prompt(device):file_path = "./prompt/negative_prompt.npy"vocal_stlye = np.load(file_path)vocal_stlye = torch.from_numpy(vocal_stlye).to(device) # [1, 512]
123version https://git-lfs.github.com/spec/v1oid sha256:6cb7d74eb7a8eda12acb8247b21d373928301db8a8cb0db480d341799fed3ce5size 2176diffrhythm/infer/infer.py+1-1
diffrhythm/infer/infer_utils.py+6-5
prompt/negative_prompt.npyAdded+3