( self, res_video_path: str, ref_path: str, audio_path: str, a_cfg_scale: float = 2.0, r_cfg_scale: float = 1.0, e_cfg_scale: float = 1.0, emo: str = 'S2E', nfe: int = 10, no_crop: bool = False, seed: int = 25, verbose: bool = False )
| 123 | |
| 124 | @torch.no_grad() |
| 125 | def run_inference( |
| 126 | self, |
| 127 | res_video_path: str, |
| 128 | ref_path: str, |
| 129 | audio_path: str, |
| 130 | a_cfg_scale: float = 2.0, |
| 131 | r_cfg_scale: float = 1.0, |
| 132 | e_cfg_scale: float = 1.0, |
| 133 | emo: str = 'S2E', |
| 134 | nfe: int = 10, |
| 135 | no_crop: bool = False, |
| 136 | seed: int = 25, |
| 137 | verbose: bool = False |
| 138 | ) -> str: |
| 139 | |
| 140 | data = self.data_processor.preprocess(ref_path, audio_path, no_crop = no_crop) |
| 141 | if verbose: print(f"> [Done] Preprocess.") |
| 142 | |
| 143 | # inference |
| 144 | d_hat = self.G.inference( |
| 145 | data = data, |
| 146 | a_cfg_scale = a_cfg_scale, |
| 147 | r_cfg_scale = r_cfg_scale, |
| 148 | e_cfg_scale = e_cfg_scale, |
| 149 | emo = emo, |
| 150 | nfe = nfe, |
| 151 | seed = seed |
| 152 | )['d_hat'] |
| 153 | |
| 154 | res_video_path = self.save_video(d_hat, res_video_path, audio_path) |
| 155 | if verbose: print(f"> [Done] result saved at {res_video_path}") |
| 156 | return res_video_path |
| 157 | |
| 158 | |
| 159 | class InferenceOptions(BaseOptions): |
no test coverage detected