MCPcopy
hub / github.com/FunAudioLLM/CosyVoice / load

Method load

cosyvoice/cli/model.py:67–75  ·  view source on GitHub ↗
(self, llm_model, flow_model, hift_model)

Source from the content-addressed store, hash-verified

65 self.hift_cache_dict = {}
66
67 def load(self, llm_model, flow_model, hift_model):
68 self.llm.load_state_dict(torch.load(llm_model, map_location=self.device), strict=True)
69 self.llm.to(self.device).eval()
70 self.flow.load_state_dict(torch.load(flow_model, map_location=self.device), strict=True)
71 self.flow.to(self.device).eval()
72 # in case hift_model is a hifigan model
73 hift_state_dict = {k.replace('generator.', ''): v for k, v in torch.load(hift_model, map_location=self.device).items()}
74 self.hift.load_state_dict(hift_state_dict, strict=True)
75 self.hift.to(self.device).eval()
76
77 def load_jit(self, llm_text_encoder_model, llm_llm_model, flow_encoder_model):
78 llm_text_encoder = torch.jit.load(llm_text_encoder_model, map_location=self.device)

Callers 15

mainFunction · 0.95
single_jobFunction · 0.80
single_jobFunction · 0.80
read_json_listsFunction · 0.80
load_wavFunction · 0.80
filterFunction · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
load_jitMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected