MCPcopy Create free account
hub / github.com/ASLP-lab/OSUM / __init__

Method __init__

OSUM/wenet/transformer/embedding.py:203–216  ·  view source on GitHub ↗
(self,
                 d_model: int,
                 head_dim: int,
                 dropout_rate: float,
                 max_len: int = 1500,
                 rope_theta=10000.0,
                 scale: bool = True)

Source from the content-addressed store, hash-verified

201class RopePositionalEncoding(PositionalEncoding):
202
203 def __init__(self,
204 d_model: int,
205 head_dim: int,
206 dropout_rate: float,
207 max_len: int = 1500,
208 rope_theta=10000.0,
209 scale: bool = True):
210 super().__init__(d_model, dropout_rate=dropout_rate, max_len=max_len)
211 delattr(self, 'pe')
212 self.max_len = max_len * 2
213 pe = precompute_freqs_cis(head_dim, self.max_len, rope_theta)
214 self.register_buffer("pe", torch.view_as_real(pe.unsqueeze(0)))
215 self.dropout_rate = dropout_rate
216 self.scale = scale
217
218 def forward(
219 self,

Callers

nothing calls this directly

Calls 2

precompute_freqs_cisFunction · 0.90
__init__Method · 0.45

Tested by

no test coverage detected