forked from mrq/DL-Art-School
w2v: new inference function
This commit is contained in:
parent
896ac029ae
commit
ba7f54c162
|
@ -129,6 +129,11 @@ class Wav2VecWrapper(nn.Module):
|
||||||
pred = logits.argmax(dim=-1)
|
pred = logits.argmax(dim=-1)
|
||||||
return [self.decode_ctc(p) for p in pred]
|
return [self.decode_ctc(p) for p in pred]
|
||||||
|
|
||||||
|
def inference_logits(self, audio):
|
||||||
|
audio_norm = (audio - audio.mean()) / torch.sqrt(audio.var() + 1e-7)
|
||||||
|
logits = self.w2v(input_values=audio_norm.squeeze(1)).logits
|
||||||
|
return logits
|
||||||
|
|
||||||
|
|
||||||
@register_model
|
@register_model
|
||||||
def register_wav2vec_feature_extractor(opt_net, opt):
|
def register_wav2vec_feature_extractor(opt_net, opt):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user