mstar.model.waypoint.components.rope#
OrthoRoPE: Waypoint’s orthogonal (x, y, t) rotary position embedding.
d_xy and d_t count rotation pairs, not dims: at d_head == 64 x
owns dims 0..15, y 16..31 and t 32..63, disjoint bands whose phases add
independently. The cache stores post-RoPE keys, so replayed history is never
re-rotated.
Functions
|
Rotate |
Classes
|
Stateless module wrapper around |
|
Builds the shared |
- class mstar.model.waypoint.components.rope.OrthoRoPE(config=None)[source]#
Bases:
ModuleStateless module wrapper around
apply_ortho_rope(), constructed per attention layer to match the reference’s call site.configis stored for that parity and otherwise unused.- Parameters:
config (WaypointConfig | None)
- forward(x, rope_angles)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class mstar.model.waypoint.components.rope.OrthoRoPEAngles(config)[source]#
Bases:
ModuleBuilds the shared
(cos, sin)angle tables for one forward, once under the DiT rather than once per block.- Parameters:
config (WaypointConfig)
- mstar.model.waypoint.components.rope.apply_ortho_rope(x, rope_angles)[source]#
Rotate
x[B, H, T, d_head]by the(cos, sin)tables.The output is a permutation of the interleaved layout (
unfoldin,catout); it cancels insideq @ k.T, and is kept so that stored K/Q compare bit-for-bit with the reference. fp32 island:xis upcast for the rotation and cast back after.