Spaces:
Running on Zero
Running on Zero
Update app_v1v2.py
Browse files23 unmodified lines24252627282930313233344 unmodified lines394041424344454647483 unmodified lines52535455565758596016 unmodified lines7778798081828384858687888923 unmodified linesdtype = torch.float32# Global variables to store model instancesvc_wrapper_v1 = Nonevc_wrapper_v2 = Nonedef load_v2_models(args):from hydra.utils import instantiatefrom omegaconf import DictConfigcfg = DictConfig(yaml.safe_load(open("configs/v2/vc_wrapper.yaml", "r")))4 unmodified linesvc_wrapper.setup_ar_caches(max_batch_size=1, max_seq_len=4096, dtype=dtype, device=device)if args.compile:vc_wrapper.compile_ar()# vc_wrapper.compile_cfm()return vc_wrapper@spaces.GPU3 unmodified lines"""Wrapper function for vc_wrapper.convert_voice that can be decorated with @spaces.GPU"""global vc_wrapper_v1if vc_wrapper_v1 is None:vc_wrapper_v1 = SeedVCWrapper()# Use yield from to properly handle the generatoryield from vc_wrapper_v1.convert_voice(16 unmodified lines"""Wrapper function for vc_wrapper.convert_voice_with_streaming that can be decorated with @spaces.GPU"""global vc_wrapper_v2if vc_wrapper_v2 is None:# Initialize with default argumentsparser = argparse.ArgumentParser()parser.add_argument("--compile", type=bool, default=True)args = parser.parse_args([])vc_wrapper_v2 = load_v2_models(args)# Use yield from to properly handle the generatoryield from vc_wrapper_v2.convert_voice_with_streaming(23 unmodified lines24252627282930313233344 unmodified lines3940414243443 unmodified lines48495051525316 unmodified lines70717273747523 unmodified linesdtype = torch.float32# Global variables to store model instancesvc_wrapper_v1 = SeedVCWrapper()vc_wrapper_v2 = load_v2_models(args)def load_v2_models():from hydra.utils import instantiatefrom omegaconf import DictConfigcfg = DictConfig(yaml.safe_load(open("configs/v2/vc_wrapper.yaml", "r")))4 unmodified linesvc_wrapper.setup_ar_caches(max_batch_size=1, max_seq_len=4096, dtype=dtype, device=device)return vc_wrapper@spaces.GPU3 unmodified lines"""Wrapper function for vc_wrapper.convert_voice that can be decorated with @spaces.GPU"""# Use yield from to properly handle the generatoryield from vc_wrapper_v1.convert_voice(16 unmodified lines"""Wrapper function for vc_wrapper.convert_voice_with_streaming that can be decorated with @spaces.GPU"""# Use yield from to properly handle the generatoryield from vc_wrapper_v2.convert_voice_with_streaming(
app_v1v2.py+3-17