(self,
token,
token_len,
sample_rate)
| 116 | |
| 117 | @torch.inference_mode() |
| 118 | def inference(self, |
| 119 | token, |
| 120 | token_len, |
| 121 | sample_rate): |
| 122 | assert token.shape[0] == 1 |
| 123 | |
| 124 | token = self.input_embedding(torch.clamp(token, min=0)) |
| 125 | h, h_lengths = self.encoder(token, token_len) |
| 126 | |
| 127 | if sample_rate == 48000: |
| 128 | token_len = 2 * token_len |
| 129 | |
| 130 | h, h_lengths = self.length_regulator(h, token_len) |
| 131 | |
| 132 | # get conditions |
| 133 | conds = None |
| 134 | |
| 135 | mask = (~make_pad_mask(token_len)).to(h) |
| 136 | feat = self.decoder( |
| 137 | mu=h.transpose(1, 2).contiguous(), |
| 138 | mask=mask.unsqueeze(1), |
| 139 | spks=None, |
| 140 | cond=conds, |
| 141 | n_timesteps=10 |
| 142 | ) |
| 143 | return feat |
nothing calls this directly
no test coverage detected