Skip to content

Commit

Permalink
update whisper sample (#629)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxiang1993 authored Aug 19, 2024
1 parent a87891e commit 07377a6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions PyTorch/audio/whisper/whisper/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,9 @@ def forward(

class AudioEncoder(nn.Module):
def __init__(
self, n_mels: int, n_ctx: int, n_state: int, n_head: int, n_layer: int, use_dml_attn: bool = False,
self, n_mels: int, n_ctx: int, n_state: int, n_head: int, n_layer: int
):
super().__init__()
self.use_dml_attn = use_dml_attn
self.conv1 = Conv1d(n_mels, n_state, kernel_size=3, padding=1)
self.conv2 = Conv1d(n_state, n_state, kernel_size=3, stride=2, padding=1)
self.register_buffer("positional_embedding", sinusoids(n_ctx, n_state))
Expand All @@ -203,7 +202,7 @@ def forward(self, x: Tensor):
x = (x + self.positional_embedding).to(x.dtype)

for block in self.blocks:
x = block(x, use_dml_attn=self.use_dml_attn)
x = block(x)

x = self.ln_post(x)
return x
Expand Down Expand Up @@ -270,7 +269,6 @@ def __init__(self, dims: ModelDimensions, use_dml_attn=False):
self.dims.n_audio_state,
self.dims.n_audio_head,
self.dims.n_audio_layer,
use_dml_attn
)
self.decoder = TextDecoder(
self.dims.n_vocab,
Expand Down

0 comments on commit 07377a6

Please sign in to comment.