Kernels
danieldk HF Staff commited on
Commit
4ee1fee
·
verified ·
1 Parent(s): cc5fb6f

Build uploaded using `kernels`.

Browse files
Files changed (43) hide show
  1. build/torch28-cxx11-cu126-x86_64-linux/rotary/__init__.py +37 -3
  2. build/torch28-cxx11-cu126-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc +0 -0
  3. build/torch28-cxx11-cu126-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc +0 -0
  4. build/torch28-cxx11-cu126-x86_64-linux/rotary/_ops.py +3 -3
  5. build/torch28-cxx11-cu126-x86_64-linux/rotary/{_rotary_98ffc18.abi3.so → _rotary_dba7d1e.abi3.so} +2 -2
  6. build/torch28-cxx11-cu128-x86_64-linux/rotary/__init__.py +37 -3
  7. build/torch28-cxx11-cu128-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc +0 -0
  8. build/torch28-cxx11-cu128-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc +0 -0
  9. build/torch28-cxx11-cu128-x86_64-linux/rotary/_ops.py +3 -3
  10. build/torch28-cxx11-cu128-x86_64-linux/rotary/_rotary_98ffc18.abi3.so +0 -3
  11. build/{torch29-cxx11-cu126-x86_64-linux/rotary/_rotary_98ffc18.abi3.so → torch28-cxx11-cu128-x86_64-linux/rotary/_rotary_dba7d1e.abi3.so} +2 -2
  12. build/torch28-cxx11-cu129-x86_64-linux/rotary/__init__.py +37 -3
  13. build/torch28-cxx11-cu129-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc +0 -0
  14. build/torch28-cxx11-cu129-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc +0 -0
  15. build/torch28-cxx11-cu129-x86_64-linux/rotary/_ops.py +3 -3
  16. build/torch28-cxx11-cu129-x86_64-linux/rotary/_rotary_98ffc18.abi3.so +0 -3
  17. build/{torch29-cxx11-cu130-x86_64-linux/rotary/_rotary_98ffc18.abi3.so → torch28-cxx11-cu129-x86_64-linux/rotary/_rotary_dba7d1e.abi3.so} +2 -2
  18. build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__init__.py +37 -3
  19. build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc +0 -0
  20. build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc +0 -0
  21. build/torch28-cxx11-xpu20251-x86_64-linux/rotary/_ops.py +3 -3
  22. build/torch28-cxx11-xpu20251-x86_64-linux/rotary/{_rotary_98ffc18.abi3.so → _rotary_dba7d1e.abi3.so} +1 -1
  23. build/torch29-cxx11-cu126-x86_64-linux/rotary/__init__.py +37 -3
  24. build/torch29-cxx11-cu126-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc +0 -0
  25. build/torch29-cxx11-cu126-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc +0 -0
  26. build/torch29-cxx11-cu126-x86_64-linux/rotary/_ops.py +3 -3
  27. build/torch29-cxx11-cu126-x86_64-linux/rotary/_rotary_dba7d1e.abi3.so +3 -0
  28. build/torch29-cxx11-cu128-x86_64-linux/rotary/__init__.py +37 -3
  29. build/torch29-cxx11-cu128-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc +0 -0
  30. build/torch29-cxx11-cu128-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc +0 -0
  31. build/torch29-cxx11-cu128-x86_64-linux/rotary/_ops.py +3 -3
  32. build/torch29-cxx11-cu128-x86_64-linux/rotary/_rotary_98ffc18.abi3.so +0 -3
  33. build/torch29-cxx11-cu128-x86_64-linux/rotary/_rotary_dba7d1e.abi3.so +3 -0
  34. build/torch29-cxx11-cu130-x86_64-linux/rotary/__init__.py +37 -3
  35. build/torch29-cxx11-cu130-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc +0 -0
  36. build/torch29-cxx11-cu130-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc +0 -0
  37. build/torch29-cxx11-cu130-x86_64-linux/rotary/_ops.py +3 -3
  38. build/torch29-cxx11-cu130-x86_64-linux/rotary/_rotary_dba7d1e.abi3.so +3 -0
  39. build/torch29-cxx11-xpu20252-x86_64-linux/rotary/__init__.py +37 -3
  40. build/torch29-cxx11-xpu20252-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc +0 -0
  41. build/torch29-cxx11-xpu20252-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc +0 -0
  42. build/torch29-cxx11-xpu20252-x86_64-linux/rotary/_ops.py +3 -3
  43. build/torch29-cxx11-xpu20252-x86_64-linux/rotary/{_rotary_98ffc18.abi3.so → _rotary_dba7d1e.abi3.so} +1 -1
build/torch28-cxx11-cu126-x86_64-linux/rotary/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Tuple
2
  import torch
3
 
4
  from ._ops import ops
@@ -12,8 +12,42 @@ def apply_rotary(
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
- ):
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
- __all__ = ["apply_rotary"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional, Tuple
2
  import torch
3
 
4
  from ._ops import ops
 
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
+ ) -> None:
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
+ def apply_rotary_transformers(
20
+ q: torch.Tensor,
21
+ k: torch.Tensor,
22
+ cos: torch.Tensor,
23
+ sin: torch.Tensor,
24
+ position_ids: Optional[torch.Tensor] = None,
25
+ unsqueeze_dim: int = 1,
26
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
27
+ """
28
+ Rotary kernel implementation wrapper
29
+ Adapts rotary kernels implementation to match transformers apply_rotary_pos_emb signature
30
+ """
31
+ cos = cos.unsqueeze(unsqueeze_dim)
32
+ sin = sin.unsqueeze(unsqueeze_dim)
33
+
34
+ q_rotated = q.clone()
35
+ k_rotated = k.clone()
36
+
37
+ # Get half dimension for rotation
38
+ half_dim = q.shape[-1] // 2
39
+ q1 = q_rotated[..., :half_dim]
40
+ q2 = q_rotated[..., half_dim:]
41
+ k1 = k_rotated[..., :half_dim]
42
+ k2 = k_rotated[..., half_dim:]
43
+ if cos.shape[-1] != half_dim:
44
+ # Trim cos/sin to match half_dim
45
+ cos = cos[..., :half_dim]
46
+ sin = sin[..., :half_dim]
47
+
48
+ apply_rotary(q1, q2, cos, sin, q1, q2, False)
49
+ apply_rotary(k1, k2, cos, sin, k1, k2, False)
50
+ return q_rotated, k_rotated
51
+
52
+
53
+ __all__ = ["apply_rotary", "apply_rotary_transformers"]
build/torch28-cxx11-cu126-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc CHANGED
Binary files a/build/torch28-cxx11-cu126-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc and b/build/torch28-cxx11-cu126-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc differ
 
build/torch28-cxx11-cu126-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc CHANGED
Binary files a/build/torch28-cxx11-cu126-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc and b/build/torch28-cxx11-cu126-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc differ
 
build/torch28-cxx11-cu126-x86_64-linux/rotary/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rotary_98ffc18
3
- ops = torch.ops._rotary_98ffc18
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rotary_98ffc18::{op_name}"
 
1
  import torch
2
+ from . import _rotary_dba7d1e
3
+ ops = torch.ops._rotary_dba7d1e
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rotary_dba7d1e::{op_name}"
build/torch28-cxx11-cu126-x86_64-linux/rotary/{_rotary_98ffc18.abi3.so → _rotary_dba7d1e.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3408f6e81f8f95fede157d02fdb2202bad3b740137d284f4929eb9b1fbd12bbb
3
- size 6817200
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afcfe44855a3e4bd60283a3c0e9b838a81177942d4997e48ff58e0542f168790
3
+ size 5462056
build/torch28-cxx11-cu128-x86_64-linux/rotary/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Tuple
2
  import torch
3
 
4
  from ._ops import ops
@@ -12,8 +12,42 @@ def apply_rotary(
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
- ):
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
- __all__ = ["apply_rotary"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional, Tuple
2
  import torch
3
 
4
  from ._ops import ops
 
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
+ ) -> None:
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
+ def apply_rotary_transformers(
20
+ q: torch.Tensor,
21
+ k: torch.Tensor,
22
+ cos: torch.Tensor,
23
+ sin: torch.Tensor,
24
+ position_ids: Optional[torch.Tensor] = None,
25
+ unsqueeze_dim: int = 1,
26
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
27
+ """
28
+ Rotary kernel implementation wrapper
29
+ Adapts rotary kernels implementation to match transformers apply_rotary_pos_emb signature
30
+ """
31
+ cos = cos.unsqueeze(unsqueeze_dim)
32
+ sin = sin.unsqueeze(unsqueeze_dim)
33
+
34
+ q_rotated = q.clone()
35
+ k_rotated = k.clone()
36
+
37
+ # Get half dimension for rotation
38
+ half_dim = q.shape[-1] // 2
39
+ q1 = q_rotated[..., :half_dim]
40
+ q2 = q_rotated[..., half_dim:]
41
+ k1 = k_rotated[..., :half_dim]
42
+ k2 = k_rotated[..., half_dim:]
43
+ if cos.shape[-1] != half_dim:
44
+ # Trim cos/sin to match half_dim
45
+ cos = cos[..., :half_dim]
46
+ sin = sin[..., :half_dim]
47
+
48
+ apply_rotary(q1, q2, cos, sin, q1, q2, False)
49
+ apply_rotary(k1, k2, cos, sin, k1, k2, False)
50
+ return q_rotated, k_rotated
51
+
52
+
53
+ __all__ = ["apply_rotary", "apply_rotary_transformers"]
build/torch28-cxx11-cu128-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc CHANGED
Binary files a/build/torch28-cxx11-cu128-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc and b/build/torch28-cxx11-cu128-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc differ
 
build/torch28-cxx11-cu128-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc CHANGED
Binary files a/build/torch28-cxx11-cu128-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc and b/build/torch28-cxx11-cu128-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc differ
 
build/torch28-cxx11-cu128-x86_64-linux/rotary/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rotary_98ffc18
3
- ops = torch.ops._rotary_98ffc18
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rotary_98ffc18::{op_name}"
 
1
  import torch
2
+ from . import _rotary_dba7d1e
3
+ ops = torch.ops._rotary_dba7d1e
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rotary_dba7d1e::{op_name}"
build/torch28-cxx11-cu128-x86_64-linux/rotary/_rotary_98ffc18.abi3.so DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:99b283e0cc88386e746276ce9866dcd8d59c93bbff49ce02474357cca897d2a0
3
- size 10526400
 
 
 
 
build/{torch29-cxx11-cu126-x86_64-linux/rotary/_rotary_98ffc18.abi3.so → torch28-cxx11-cu128-x86_64-linux/rotary/_rotary_dba7d1e.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:10a3d2123227f7c24f5c56e5529de3d9d4873c741cfc1256a57d585021bb83e2
3
- size 6817088
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9092efc80c61670f0e9634e7b96a59c45c35cac470f85da5ba1a8ea184a15750
3
+ size 7893120
build/torch28-cxx11-cu129-x86_64-linux/rotary/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Tuple
2
  import torch
3
 
4
  from ._ops import ops
@@ -12,8 +12,42 @@ def apply_rotary(
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
- ):
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
- __all__ = ["apply_rotary"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional, Tuple
2
  import torch
3
 
4
  from ._ops import ops
 
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
+ ) -> None:
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
+ def apply_rotary_transformers(
20
+ q: torch.Tensor,
21
+ k: torch.Tensor,
22
+ cos: torch.Tensor,
23
+ sin: torch.Tensor,
24
+ position_ids: Optional[torch.Tensor] = None,
25
+ unsqueeze_dim: int = 1,
26
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
27
+ """
28
+ Rotary kernel implementation wrapper
29
+ Adapts rotary kernels implementation to match transformers apply_rotary_pos_emb signature
30
+ """
31
+ cos = cos.unsqueeze(unsqueeze_dim)
32
+ sin = sin.unsqueeze(unsqueeze_dim)
33
+
34
+ q_rotated = q.clone()
35
+ k_rotated = k.clone()
36
+
37
+ # Get half dimension for rotation
38
+ half_dim = q.shape[-1] // 2
39
+ q1 = q_rotated[..., :half_dim]
40
+ q2 = q_rotated[..., half_dim:]
41
+ k1 = k_rotated[..., :half_dim]
42
+ k2 = k_rotated[..., half_dim:]
43
+ if cos.shape[-1] != half_dim:
44
+ # Trim cos/sin to match half_dim
45
+ cos = cos[..., :half_dim]
46
+ sin = sin[..., :half_dim]
47
+
48
+ apply_rotary(q1, q2, cos, sin, q1, q2, False)
49
+ apply_rotary(k1, k2, cos, sin, k1, k2, False)
50
+ return q_rotated, k_rotated
51
+
52
+
53
+ __all__ = ["apply_rotary", "apply_rotary_transformers"]
build/torch28-cxx11-cu129-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc CHANGED
Binary files a/build/torch28-cxx11-cu129-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc and b/build/torch28-cxx11-cu129-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc differ
 
build/torch28-cxx11-cu129-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc CHANGED
Binary files a/build/torch28-cxx11-cu129-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc and b/build/torch28-cxx11-cu129-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc differ
 
build/torch28-cxx11-cu129-x86_64-linux/rotary/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rotary_98ffc18
3
- ops = torch.ops._rotary_98ffc18
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rotary_98ffc18::{op_name}"
 
1
  import torch
2
+ from . import _rotary_dba7d1e
3
+ ops = torch.ops._rotary_dba7d1e
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rotary_dba7d1e::{op_name}"
build/torch28-cxx11-cu129-x86_64-linux/rotary/_rotary_98ffc18.abi3.so DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:50a460190d5b7e5f66016f23ce23989a66fa6e0bee967bf8b6ce9472706d55a6
3
- size 10586824
 
 
 
 
build/{torch29-cxx11-cu130-x86_64-linux/rotary/_rotary_98ffc18.abi3.so → torch28-cxx11-cu129-x86_64-linux/rotary/_rotary_dba7d1e.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5da8f52af54c4178e3494b3ec55c1c08fbf06ee4319c80b3de1c24b025faefb4
3
- size 9608112
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:001611c5afea6f19fa26720bd93cca352fcb0eb9b50fb9786b03e80d0eefd1db
3
+ size 7949960
build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Tuple
2
  import torch
3
 
4
  from ._ops import ops
@@ -12,8 +12,42 @@ def apply_rotary(
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
- ):
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
- __all__ = ["apply_rotary"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional, Tuple
2
  import torch
3
 
4
  from ._ops import ops
 
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
+ ) -> None:
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
+ def apply_rotary_transformers(
20
+ q: torch.Tensor,
21
+ k: torch.Tensor,
22
+ cos: torch.Tensor,
23
+ sin: torch.Tensor,
24
+ position_ids: Optional[torch.Tensor] = None,
25
+ unsqueeze_dim: int = 1,
26
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
27
+ """
28
+ Rotary kernel implementation wrapper
29
+ Adapts rotary kernels implementation to match transformers apply_rotary_pos_emb signature
30
+ """
31
+ cos = cos.unsqueeze(unsqueeze_dim)
32
+ sin = sin.unsqueeze(unsqueeze_dim)
33
+
34
+ q_rotated = q.clone()
35
+ k_rotated = k.clone()
36
+
37
+ # Get half dimension for rotation
38
+ half_dim = q.shape[-1] // 2
39
+ q1 = q_rotated[..., :half_dim]
40
+ q2 = q_rotated[..., half_dim:]
41
+ k1 = k_rotated[..., :half_dim]
42
+ k2 = k_rotated[..., half_dim:]
43
+ if cos.shape[-1] != half_dim:
44
+ # Trim cos/sin to match half_dim
45
+ cos = cos[..., :half_dim]
46
+ sin = sin[..., :half_dim]
47
+
48
+ apply_rotary(q1, q2, cos, sin, q1, q2, False)
49
+ apply_rotary(k1, k2, cos, sin, k1, k2, False)
50
+ return q_rotated, k_rotated
51
+
52
+
53
+ __all__ = ["apply_rotary", "apply_rotary_transformers"]
build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc CHANGED
Binary files a/build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc and b/build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc differ
 
build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc CHANGED
Binary files a/build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc and b/build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc differ
 
build/torch28-cxx11-xpu20251-x86_64-linux/rotary/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rotary_98ffc18
3
- ops = torch.ops._rotary_98ffc18
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rotary_98ffc18::{op_name}"
 
1
  import torch
2
+ from . import _rotary_dba7d1e
3
+ ops = torch.ops._rotary_dba7d1e
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rotary_dba7d1e::{op_name}"
build/torch28-cxx11-xpu20251-x86_64-linux/rotary/{_rotary_98ffc18.abi3.so → _rotary_dba7d1e.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ce70491bea7a387cea7ce474b8393dddc139645add8af8863d80c9ff3017a463
3
  size 2324536
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:036b2a03719657cb135cb93629f9da21c4d9d9f9537ff2792d151b32c2488c59
3
  size 2324536
build/torch29-cxx11-cu126-x86_64-linux/rotary/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Tuple
2
  import torch
3
 
4
  from ._ops import ops
@@ -12,8 +12,42 @@ def apply_rotary(
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
- ):
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
- __all__ = ["apply_rotary"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional, Tuple
2
  import torch
3
 
4
  from ._ops import ops
 
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
+ ) -> None:
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
+ def apply_rotary_transformers(
20
+ q: torch.Tensor,
21
+ k: torch.Tensor,
22
+ cos: torch.Tensor,
23
+ sin: torch.Tensor,
24
+ position_ids: Optional[torch.Tensor] = None,
25
+ unsqueeze_dim: int = 1,
26
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
27
+ """
28
+ Rotary kernel implementation wrapper
29
+ Adapts rotary kernels implementation to match transformers apply_rotary_pos_emb signature
30
+ """
31
+ cos = cos.unsqueeze(unsqueeze_dim)
32
+ sin = sin.unsqueeze(unsqueeze_dim)
33
+
34
+ q_rotated = q.clone()
35
+ k_rotated = k.clone()
36
+
37
+ # Get half dimension for rotation
38
+ half_dim = q.shape[-1] // 2
39
+ q1 = q_rotated[..., :half_dim]
40
+ q2 = q_rotated[..., half_dim:]
41
+ k1 = k_rotated[..., :half_dim]
42
+ k2 = k_rotated[..., half_dim:]
43
+ if cos.shape[-1] != half_dim:
44
+ # Trim cos/sin to match half_dim
45
+ cos = cos[..., :half_dim]
46
+ sin = sin[..., :half_dim]
47
+
48
+ apply_rotary(q1, q2, cos, sin, q1, q2, False)
49
+ apply_rotary(k1, k2, cos, sin, k1, k2, False)
50
+ return q_rotated, k_rotated
51
+
52
+
53
+ __all__ = ["apply_rotary", "apply_rotary_transformers"]
build/torch29-cxx11-cu126-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc CHANGED
Binary files a/build/torch29-cxx11-cu126-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc and b/build/torch29-cxx11-cu126-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc differ
 
build/torch29-cxx11-cu126-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc CHANGED
Binary files a/build/torch29-cxx11-cu126-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc and b/build/torch29-cxx11-cu126-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc differ
 
build/torch29-cxx11-cu126-x86_64-linux/rotary/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rotary_98ffc18
3
- ops = torch.ops._rotary_98ffc18
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rotary_98ffc18::{op_name}"
 
1
  import torch
2
+ from . import _rotary_dba7d1e
3
+ ops = torch.ops._rotary_dba7d1e
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rotary_dba7d1e::{op_name}"
build/torch29-cxx11-cu126-x86_64-linux/rotary/_rotary_dba7d1e.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:747406a42e14287a3cab577e65abf26cee64ec6324e2692be5ade3d22a1be2b3
3
+ size 5461944
build/torch29-cxx11-cu128-x86_64-linux/rotary/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Tuple
2
  import torch
3
 
4
  from ._ops import ops
@@ -12,8 +12,42 @@ def apply_rotary(
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
- ):
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
- __all__ = ["apply_rotary"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional, Tuple
2
  import torch
3
 
4
  from ._ops import ops
 
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
+ ) -> None:
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
+ def apply_rotary_transformers(
20
+ q: torch.Tensor,
21
+ k: torch.Tensor,
22
+ cos: torch.Tensor,
23
+ sin: torch.Tensor,
24
+ position_ids: Optional[torch.Tensor] = None,
25
+ unsqueeze_dim: int = 1,
26
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
27
+ """
28
+ Rotary kernel implementation wrapper
29
+ Adapts rotary kernels implementation to match transformers apply_rotary_pos_emb signature
30
+ """
31
+ cos = cos.unsqueeze(unsqueeze_dim)
32
+ sin = sin.unsqueeze(unsqueeze_dim)
33
+
34
+ q_rotated = q.clone()
35
+ k_rotated = k.clone()
36
+
37
+ # Get half dimension for rotation
38
+ half_dim = q.shape[-1] // 2
39
+ q1 = q_rotated[..., :half_dim]
40
+ q2 = q_rotated[..., half_dim:]
41
+ k1 = k_rotated[..., :half_dim]
42
+ k2 = k_rotated[..., half_dim:]
43
+ if cos.shape[-1] != half_dim:
44
+ # Trim cos/sin to match half_dim
45
+ cos = cos[..., :half_dim]
46
+ sin = sin[..., :half_dim]
47
+
48
+ apply_rotary(q1, q2, cos, sin, q1, q2, False)
49
+ apply_rotary(k1, k2, cos, sin, k1, k2, False)
50
+ return q_rotated, k_rotated
51
+
52
+
53
+ __all__ = ["apply_rotary", "apply_rotary_transformers"]
build/torch29-cxx11-cu128-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc CHANGED
Binary files a/build/torch29-cxx11-cu128-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc and b/build/torch29-cxx11-cu128-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc differ
 
build/torch29-cxx11-cu128-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc CHANGED
Binary files a/build/torch29-cxx11-cu128-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc and b/build/torch29-cxx11-cu128-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc differ
 
build/torch29-cxx11-cu128-x86_64-linux/rotary/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rotary_98ffc18
3
- ops = torch.ops._rotary_98ffc18
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rotary_98ffc18::{op_name}"
 
1
  import torch
2
+ from . import _rotary_dba7d1e
3
+ ops = torch.ops._rotary_dba7d1e
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rotary_dba7d1e::{op_name}"
build/torch29-cxx11-cu128-x86_64-linux/rotary/_rotary_98ffc18.abi3.so DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:8d39655db220a21ec886c5a896359755e247410999679e9bea86f51ee539b0b3
3
- size 10526504
 
 
 
 
build/torch29-cxx11-cu128-x86_64-linux/rotary/_rotary_dba7d1e.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9316296204902f06352d27d5702e11b54dc7580adec50fdde4be15d8351de03a
3
+ size 7897320
build/torch29-cxx11-cu130-x86_64-linux/rotary/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Tuple
2
  import torch
3
 
4
  from ._ops import ops
@@ -12,8 +12,42 @@ def apply_rotary(
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
- ):
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
- __all__ = ["apply_rotary"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional, Tuple
2
  import torch
3
 
4
  from ._ops import ops
 
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
+ ) -> None:
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
+ def apply_rotary_transformers(
20
+ q: torch.Tensor,
21
+ k: torch.Tensor,
22
+ cos: torch.Tensor,
23
+ sin: torch.Tensor,
24
+ position_ids: Optional[torch.Tensor] = None,
25
+ unsqueeze_dim: int = 1,
26
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
27
+ """
28
+ Rotary kernel implementation wrapper
29
+ Adapts rotary kernels implementation to match transformers apply_rotary_pos_emb signature
30
+ """
31
+ cos = cos.unsqueeze(unsqueeze_dim)
32
+ sin = sin.unsqueeze(unsqueeze_dim)
33
+
34
+ q_rotated = q.clone()
35
+ k_rotated = k.clone()
36
+
37
+ # Get half dimension for rotation
38
+ half_dim = q.shape[-1] // 2
39
+ q1 = q_rotated[..., :half_dim]
40
+ q2 = q_rotated[..., half_dim:]
41
+ k1 = k_rotated[..., :half_dim]
42
+ k2 = k_rotated[..., half_dim:]
43
+ if cos.shape[-1] != half_dim:
44
+ # Trim cos/sin to match half_dim
45
+ cos = cos[..., :half_dim]
46
+ sin = sin[..., :half_dim]
47
+
48
+ apply_rotary(q1, q2, cos, sin, q1, q2, False)
49
+ apply_rotary(k1, k2, cos, sin, k1, k2, False)
50
+ return q_rotated, k_rotated
51
+
52
+
53
+ __all__ = ["apply_rotary", "apply_rotary_transformers"]
build/torch29-cxx11-cu130-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc CHANGED
Binary files a/build/torch29-cxx11-cu130-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc and b/build/torch29-cxx11-cu130-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc differ
 
build/torch29-cxx11-cu130-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc CHANGED
Binary files a/build/torch29-cxx11-cu130-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc and b/build/torch29-cxx11-cu130-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc differ
 
build/torch29-cxx11-cu130-x86_64-linux/rotary/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rotary_98ffc18
3
- ops = torch.ops._rotary_98ffc18
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rotary_98ffc18::{op_name}"
 
1
  import torch
2
+ from . import _rotary_dba7d1e
3
+ ops = torch.ops._rotary_dba7d1e
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rotary_dba7d1e::{op_name}"
build/torch29-cxx11-cu130-x86_64-linux/rotary/_rotary_dba7d1e.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c55687a6b3ec5f6fce8841387ca647eb2e57a4b387ea09e12c672a95040ea5c4
3
+ size 7659376
build/torch29-cxx11-xpu20252-x86_64-linux/rotary/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Tuple
2
  import torch
3
 
4
  from ._ops import ops
@@ -12,8 +12,42 @@ def apply_rotary(
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
- ):
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
- __all__ = ["apply_rotary"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional, Tuple
2
  import torch
3
 
4
  from ._ops import ops
 
12
  out1: torch.Tensor,
13
  out2: torch.Tensor,
14
  conj: bool,
15
+ ) -> None:
16
  ops.apply_rotary(x1, x2, cos, sin, out1, out2, conj)
17
 
18
 
19
+ def apply_rotary_transformers(
20
+ q: torch.Tensor,
21
+ k: torch.Tensor,
22
+ cos: torch.Tensor,
23
+ sin: torch.Tensor,
24
+ position_ids: Optional[torch.Tensor] = None,
25
+ unsqueeze_dim: int = 1,
26
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
27
+ """
28
+ Rotary kernel implementation wrapper
29
+ Adapts rotary kernels implementation to match transformers apply_rotary_pos_emb signature
30
+ """
31
+ cos = cos.unsqueeze(unsqueeze_dim)
32
+ sin = sin.unsqueeze(unsqueeze_dim)
33
+
34
+ q_rotated = q.clone()
35
+ k_rotated = k.clone()
36
+
37
+ # Get half dimension for rotation
38
+ half_dim = q.shape[-1] // 2
39
+ q1 = q_rotated[..., :half_dim]
40
+ q2 = q_rotated[..., half_dim:]
41
+ k1 = k_rotated[..., :half_dim]
42
+ k2 = k_rotated[..., half_dim:]
43
+ if cos.shape[-1] != half_dim:
44
+ # Trim cos/sin to match half_dim
45
+ cos = cos[..., :half_dim]
46
+ sin = sin[..., :half_dim]
47
+
48
+ apply_rotary(q1, q2, cos, sin, q1, q2, False)
49
+ apply_rotary(k1, k2, cos, sin, k1, k2, False)
50
+ return q_rotated, k_rotated
51
+
52
+
53
+ __all__ = ["apply_rotary", "apply_rotary_transformers"]
build/torch29-cxx11-xpu20252-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc CHANGED
Binary files a/build/torch29-cxx11-xpu20252-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc and b/build/torch29-cxx11-xpu20252-x86_64-linux/rotary/__pycache__/__init__.cpython-313.pyc differ
 
build/torch29-cxx11-xpu20252-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc CHANGED
Binary files a/build/torch29-cxx11-xpu20252-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc and b/build/torch29-cxx11-xpu20252-x86_64-linux/rotary/__pycache__/_ops.cpython-313.pyc differ
 
build/torch29-cxx11-xpu20252-x86_64-linux/rotary/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rotary_98ffc18
3
- ops = torch.ops._rotary_98ffc18
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rotary_98ffc18::{op_name}"
 
1
  import torch
2
+ from . import _rotary_dba7d1e
3
+ ops = torch.ops._rotary_dba7d1e
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rotary_dba7d1e::{op_name}"
build/torch29-cxx11-xpu20252-x86_64-linux/rotary/{_rotary_98ffc18.abi3.so → _rotary_dba7d1e.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:32f216d78d17221dcd1233ee7b72c051ad6ce373f0d1c8a20d9cee5beda2b6a1
3
  size 2273032
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70148df322edfbbcd55554ade33f184dcae0003a2f2b75e89d91f2a955dee7ca
3
  size 2273032