MCPcopy Create free account
hub / github.com/FireRedTeam/FireRedASR / forward

Method forward

fireredasr/models/module/adapter.py:13–30  ·  view source on GitHub ↗
(self, x, x_lens)

Source from the content-addressed store, hash-verified

11 self.linear2 = nn.Linear(llm_dim, llm_dim)
12
13 def forward(self, x, x_lens):
14 batch_size, seq_len, feat_dim = x.size()
15 num_frames_to_discard = seq_len % self.ds
16 if num_frames_to_discard > 0:
17 x = x[:, :-num_frames_to_discard, :]
18 seq_len = x.size(1)
19
20 x = x.contiguous()
21 x = x.view(
22 batch_size, seq_len // self.ds, feat_dim * self.ds
23 )
24
25 x = self.linear1(x)
26 x = self.relu(x)
27 x = self.linear2(x)
28
29 new_x_lens = torch.clamp(x_lens, max=seq_len) // self.ds
30 return x, new_x_lens

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected