invoking __call__ instead of forward()

This commit is contained in:
Jong Wook Kim 2022-11-16 04:18:50 -08:00
parent 02aa851a49
commit eff383b27b
2 changed files with 6 additions and 2 deletions

View File

@ -21,6 +21,10 @@ We used Python 3.9.9 and [PyTorch](https://pytorch.org/) 1.10.1 to train and tes
pip install git+https://github.com/openai/whisper.git
To update the package to the latest version of this repository, please run:
pip install --upgrade --no-deps --force-reinstall git+https://github.com/openai/whisper.git
It also requires the command-line tool [`ffmpeg`](https://ffmpeg.org/) to be installed on your system, which is available from most package managers:
```bash

View File

@ -214,10 +214,10 @@ class Whisper(nn.Module):
)
def embed_audio(self, mel: torch.Tensor):
return self.encoder.forward(mel)
return self.encoder(mel)
def logits(self, tokens: torch.Tensor, audio_features: torch.Tensor):
return self.decoder.forward(tokens, audio_features)
return self.decoder(tokens, audio_features)
def forward(self, mel: torch.Tensor, tokens: torch.Tensor) -> Dict[str, torch.Tensor]:
return self.decoder(tokens, self.encoder(mel))