Method
__init__
(
self,
dim: int,
end: int,
theta: float = 10_000,
)
Source from the content-addressed store, hash-verified
| 48 | # Adapted from https://github.com/foundation-model-stack/foundation-model-stack |
| 49 | class ShapeRotator: |
| 50 | def __init__( |
| 51 | self, |
| 52 | dim: int, |
| 53 | end: int, |
| 54 | theta: float = 10_000, |
| 55 | ): |
| 56 | super().__init__() |
| 57 | self.dim = dim |
| 58 | self.ratio = theta |
| 59 | self.cached_freqs: MutableMapping[int, MutableMapping[int, torch.Tensor]] = {} |
| 60 | self.max_seq_len_cached: MutableMapping[int, int] = {} |
| 61 | self.ntk_scaling = False |
| 62 | self.max_seq_len = end |
| 63 | |
| 64 | def compute_freqs_cis(self, device, max_seq_len=None): |
| 65 | alpha = 1 |
Callers
nothing calls this directly
Tested by
no test coverage detected