Instructions to use kernels-community/rotary with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use kernels-community/rotary with Kernels:
# !pip install kernels from kernels import get_kernel # a version (or an explicit revision) is required; see the "Files and versions" tab for the available ones kernel = get_kernel("kernels-community/rotary", version=1) - Notebooks
- Google Colab
- Kaggle
Build uploaded using `kernels`.
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- build/torch210-cxx11-cu126-x86_64-linux/__init__.py +0 -53
- build/torch210-cxx11-cu126-x86_64-linux/_ops.py +0 -9
- build/torch210-cxx11-cu126-x86_64-linux/_rotary_90e4f0f.abi3.so +0 -3
- build/torch210-cxx11-cu126-x86_64-linux/metadata.json +0 -1
- build/torch210-cxx11-cu126-x86_64-linux/rotary/__init__.py +0 -26
- build/torch210-cxx11-cu128-x86_64-linux/__init__.py +0 -53
- build/torch210-cxx11-cu128-x86_64-linux/_ops.py +0 -9
- build/torch210-cxx11-cu128-x86_64-linux/_rotary_90e4f0f.abi3.so +0 -3
- build/torch210-cxx11-cu128-x86_64-linux/metadata.json +0 -1
- build/torch210-cxx11-cu128-x86_64-linux/rotary/__init__.py +0 -26
- build/torch210-cxx11-cu130-x86_64-linux/__init__.py +0 -53
- build/torch210-cxx11-cu130-x86_64-linux/_ops.py +0 -9
- build/torch210-cxx11-cu130-x86_64-linux/_rotary_90e4f0f.abi3.so +0 -3
- build/torch210-cxx11-cu130-x86_64-linux/metadata.json +0 -1
- build/torch210-cxx11-cu130-x86_64-linux/rotary/__init__.py +0 -26
- build/torch210-cxx11-xpu20253-x86_64-linux/__init__.py +0 -53
- build/torch210-cxx11-xpu20253-x86_64-linux/_ops.py +0 -9
- build/torch210-cxx11-xpu20253-x86_64-linux/_rotary_90e4f0f.abi3.so +0 -3
- build/torch210-cxx11-xpu20253-x86_64-linux/metadata.json +0 -1
- build/torch210-cxx11-xpu20253-x86_64-linux/rotary/__init__.py +0 -26
- build/torch28-cxx11-cu126-x86_64-linux/__init__.py +0 -53
- build/torch28-cxx11-cu126-x86_64-linux/_ops.py +0 -9
- build/torch28-cxx11-cu126-x86_64-linux/_rotary_90e4f0f.abi3.so +0 -3
- build/torch28-cxx11-cu126-x86_64-linux/metadata.json +0 -1
- build/torch28-cxx11-cu126-x86_64-linux/rotary/__init__.py +0 -26
- build/torch28-cxx11-cu128-x86_64-linux/__init__.py +0 -53
- build/torch28-cxx11-cu128-x86_64-linux/_ops.py +0 -9
- build/torch28-cxx11-cu128-x86_64-linux/_rotary_90e4f0f.abi3.so +0 -3
- build/torch28-cxx11-cu128-x86_64-linux/metadata.json +0 -1
- build/torch28-cxx11-cu128-x86_64-linux/rotary/__init__.py +0 -26
- build/torch28-cxx11-cu129-x86_64-linux/__init__.py +0 -53
- build/torch28-cxx11-cu129-x86_64-linux/_ops.py +0 -9
- build/torch28-cxx11-cu129-x86_64-linux/_rotary_90e4f0f.abi3.so +0 -3
- build/torch28-cxx11-cu129-x86_64-linux/metadata.json +0 -1
- build/torch28-cxx11-cu129-x86_64-linux/rotary/__init__.py +0 -26
- build/torch28-cxx11-xpu20251-x86_64-linux/__init__.py +0 -53
- build/torch28-cxx11-xpu20251-x86_64-linux/_ops.py +0 -9
- build/torch28-cxx11-xpu20251-x86_64-linux/_rotary_90e4f0f.abi3.so +0 -3
- build/torch28-cxx11-xpu20251-x86_64-linux/metadata.json +0 -1
- build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__init__.py +0 -26
- build/torch29-cxx11-cu126-x86_64-linux/__init__.py +0 -53
- build/torch29-cxx11-cu126-x86_64-linux/_ops.py +0 -9
- build/torch29-cxx11-cu126-x86_64-linux/_rotary_90e4f0f.abi3.so +0 -3
- build/torch29-cxx11-cu126-x86_64-linux/metadata.json +0 -1
- build/torch29-cxx11-cu126-x86_64-linux/rotary/__init__.py +0 -26
- build/torch29-cxx11-cu128-x86_64-linux/__init__.py +0 -53
- build/torch29-cxx11-cu128-x86_64-linux/_ops.py +0 -9
- build/torch29-cxx11-cu128-x86_64-linux/_rotary_90e4f0f.abi3.so +0 -3
- build/torch29-cxx11-cu128-x86_64-linux/metadata.json +0 -1
- build/torch29-cxx11-cu128-x86_64-linux/rotary/__init__.py +0 -26
build/torch210-cxx11-cu126-x86_64-linux/__init__.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
from typing import Optional, Tuple
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
from ._ops import ops
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def apply_rotary(
|
| 8 |
-
x1: torch.Tensor,
|
| 9 |
-
x2: torch.Tensor,
|
| 10 |
-
cos: torch.Tensor,
|
| 11 |
-
sin: torch.Tensor,
|
| 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/torch210-cxx11-cu126-x86_64-linux/_ops.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
from . import _rotary_90e4f0f
|
| 3 |
-
ops = torch.ops._rotary_90e4f0f
|
| 4 |
-
|
| 5 |
-
def add_op_namespace_prefix(op_name: str):
|
| 6 |
-
"""
|
| 7 |
-
Prefix op by namespace.
|
| 8 |
-
"""
|
| 9 |
-
return f"_rotary_90e4f0f::{op_name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch210-cxx11-cu126-x86_64-linux/_rotary_90e4f0f.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:51027ec42e88d98547fac8145714f9ef08cde6c28d8723d2bbc4d4a653ed6643
|
| 3 |
-
size 8200552
|
|
|
|
|
|
|
|
|
|
|
|
build/torch210-cxx11-cu126-x86_64-linux/metadata.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"python-depends":[]}
|
|
|
|
|
|
build/torch210-cxx11-cu126-x86_64-linux/rotary/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import ctypes
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import importlib
|
| 5 |
-
from pathlib import Path
|
| 6 |
-
from types import ModuleType
|
| 7 |
-
|
| 8 |
-
def _import_from_path(file_path: Path) -> ModuleType:
|
| 9 |
-
# We cannot use the module name as-is, after adding it to `sys.modules`,
|
| 10 |
-
# it would also be used for other imports. So, we make a module name that
|
| 11 |
-
# depends on the path for it to be unique using the hex-encoded hash of
|
| 12 |
-
# the path.
|
| 13 |
-
path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 14 |
-
module_name = path_hash
|
| 15 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 16 |
-
if spec is None:
|
| 17 |
-
raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
|
| 18 |
-
module = importlib.util.module_from_spec(spec)
|
| 19 |
-
if module is None:
|
| 20 |
-
raise ImportError(f"Cannot load module {module_name} from spec")
|
| 21 |
-
sys.modules[module_name] = module
|
| 22 |
-
spec.loader.exec_module(module) # type: ignore
|
| 23 |
-
return module
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch210-cxx11-cu128-x86_64-linux/__init__.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
from typing import Optional, Tuple
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
from ._ops import ops
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def apply_rotary(
|
| 8 |
-
x1: torch.Tensor,
|
| 9 |
-
x2: torch.Tensor,
|
| 10 |
-
cos: torch.Tensor,
|
| 11 |
-
sin: torch.Tensor,
|
| 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/torch210-cxx11-cu128-x86_64-linux/_ops.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
from . import _rotary_90e4f0f
|
| 3 |
-
ops = torch.ops._rotary_90e4f0f
|
| 4 |
-
|
| 5 |
-
def add_op_namespace_prefix(op_name: str):
|
| 6 |
-
"""
|
| 7 |
-
Prefix op by namespace.
|
| 8 |
-
"""
|
| 9 |
-
return f"_rotary_90e4f0f::{op_name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch210-cxx11-cu128-x86_64-linux/_rotary_90e4f0f.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:39cc33889c406562d97b3a4db53d9464c88acc2410d8a6980f0afe0bc9c29e5a
|
| 3 |
-
size 11905888
|
|
|
|
|
|
|
|
|
|
|
|
build/torch210-cxx11-cu128-x86_64-linux/metadata.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"python-depends":[]}
|
|
|
|
|
|
build/torch210-cxx11-cu128-x86_64-linux/rotary/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import ctypes
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import importlib
|
| 5 |
-
from pathlib import Path
|
| 6 |
-
from types import ModuleType
|
| 7 |
-
|
| 8 |
-
def _import_from_path(file_path: Path) -> ModuleType:
|
| 9 |
-
# We cannot use the module name as-is, after adding it to `sys.modules`,
|
| 10 |
-
# it would also be used for other imports. So, we make a module name that
|
| 11 |
-
# depends on the path for it to be unique using the hex-encoded hash of
|
| 12 |
-
# the path.
|
| 13 |
-
path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 14 |
-
module_name = path_hash
|
| 15 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 16 |
-
if spec is None:
|
| 17 |
-
raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
|
| 18 |
-
module = importlib.util.module_from_spec(spec)
|
| 19 |
-
if module is None:
|
| 20 |
-
raise ImportError(f"Cannot load module {module_name} from spec")
|
| 21 |
-
sys.modules[module_name] = module
|
| 22 |
-
spec.loader.exec_module(module) # type: ignore
|
| 23 |
-
return module
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch210-cxx11-cu130-x86_64-linux/__init__.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
from typing import Optional, Tuple
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
from ._ops import ops
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def apply_rotary(
|
| 8 |
-
x1: torch.Tensor,
|
| 9 |
-
x2: torch.Tensor,
|
| 10 |
-
cos: torch.Tensor,
|
| 11 |
-
sin: torch.Tensor,
|
| 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/torch210-cxx11-cu130-x86_64-linux/_ops.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
from . import _rotary_90e4f0f
|
| 3 |
-
ops = torch.ops._rotary_90e4f0f
|
| 4 |
-
|
| 5 |
-
def add_op_namespace_prefix(op_name: str):
|
| 6 |
-
"""
|
| 7 |
-
Prefix op by namespace.
|
| 8 |
-
"""
|
| 9 |
-
return f"_rotary_90e4f0f::{op_name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch210-cxx11-cu130-x86_64-linux/_rotary_90e4f0f.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:3c4468ae96a6f8677482061f25d20d4dc5f06bd8110fabf27d1d07c72cc13b3e
|
| 3 |
-
size 10310736
|
|
|
|
|
|
|
|
|
|
|
|
build/torch210-cxx11-cu130-x86_64-linux/metadata.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"python-depends":[]}
|
|
|
|
|
|
build/torch210-cxx11-cu130-x86_64-linux/rotary/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import ctypes
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import importlib
|
| 5 |
-
from pathlib import Path
|
| 6 |
-
from types import ModuleType
|
| 7 |
-
|
| 8 |
-
def _import_from_path(file_path: Path) -> ModuleType:
|
| 9 |
-
# We cannot use the module name as-is, after adding it to `sys.modules`,
|
| 10 |
-
# it would also be used for other imports. So, we make a module name that
|
| 11 |
-
# depends on the path for it to be unique using the hex-encoded hash of
|
| 12 |
-
# the path.
|
| 13 |
-
path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 14 |
-
module_name = path_hash
|
| 15 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 16 |
-
if spec is None:
|
| 17 |
-
raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
|
| 18 |
-
module = importlib.util.module_from_spec(spec)
|
| 19 |
-
if module is None:
|
| 20 |
-
raise ImportError(f"Cannot load module {module_name} from spec")
|
| 21 |
-
sys.modules[module_name] = module
|
| 22 |
-
spec.loader.exec_module(module) # type: ignore
|
| 23 |
-
return module
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch210-cxx11-xpu20253-x86_64-linux/__init__.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
from typing import Optional, Tuple
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
from ._ops import ops
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def apply_rotary(
|
| 8 |
-
x1: torch.Tensor,
|
| 9 |
-
x2: torch.Tensor,
|
| 10 |
-
cos: torch.Tensor,
|
| 11 |
-
sin: torch.Tensor,
|
| 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/torch210-cxx11-xpu20253-x86_64-linux/_ops.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
from . import _rotary_90e4f0f
|
| 3 |
-
ops = torch.ops._rotary_90e4f0f
|
| 4 |
-
|
| 5 |
-
def add_op_namespace_prefix(op_name: str):
|
| 6 |
-
"""
|
| 7 |
-
Prefix op by namespace.
|
| 8 |
-
"""
|
| 9 |
-
return f"_rotary_90e4f0f::{op_name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch210-cxx11-xpu20253-x86_64-linux/_rotary_90e4f0f.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:a7bc816c9085ff4756d87484127679dd39968bfc943ecc49eea40947caf2a310
|
| 3 |
-
size 2301488
|
|
|
|
|
|
|
|
|
|
|
|
build/torch210-cxx11-xpu20253-x86_64-linux/metadata.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"python-depends":[]}
|
|
|
|
|
|
build/torch210-cxx11-xpu20253-x86_64-linux/rotary/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import ctypes
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import importlib
|
| 5 |
-
from pathlib import Path
|
| 6 |
-
from types import ModuleType
|
| 7 |
-
|
| 8 |
-
def _import_from_path(file_path: Path) -> ModuleType:
|
| 9 |
-
# We cannot use the module name as-is, after adding it to `sys.modules`,
|
| 10 |
-
# it would also be used for other imports. So, we make a module name that
|
| 11 |
-
# depends on the path for it to be unique using the hex-encoded hash of
|
| 12 |
-
# the path.
|
| 13 |
-
path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 14 |
-
module_name = path_hash
|
| 15 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 16 |
-
if spec is None:
|
| 17 |
-
raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
|
| 18 |
-
module = importlib.util.module_from_spec(spec)
|
| 19 |
-
if module is None:
|
| 20 |
-
raise ImportError(f"Cannot load module {module_name} from spec")
|
| 21 |
-
sys.modules[module_name] = module
|
| 22 |
-
spec.loader.exec_module(module) # type: ignore
|
| 23 |
-
return module
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-cu126-x86_64-linux/__init__.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
from typing import Optional, Tuple
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
from ._ops import ops
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def apply_rotary(
|
| 8 |
-
x1: torch.Tensor,
|
| 9 |
-
x2: torch.Tensor,
|
| 10 |
-
cos: torch.Tensor,
|
| 11 |
-
sin: torch.Tensor,
|
| 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/_ops.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
from . import _rotary_90e4f0f
|
| 3 |
-
ops = torch.ops._rotary_90e4f0f
|
| 4 |
-
|
| 5 |
-
def add_op_namespace_prefix(op_name: str):
|
| 6 |
-
"""
|
| 7 |
-
Prefix op by namespace.
|
| 8 |
-
"""
|
| 9 |
-
return f"_rotary_90e4f0f::{op_name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-cu126-x86_64-linux/_rotary_90e4f0f.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:a040bbb8748df983d6c6e07c94bdd24477116ce9792ed785485d073038010d66
|
| 3 |
-
size 8190648
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-cu126-x86_64-linux/metadata.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"python-depends":[]}
|
|
|
|
|
|
build/torch28-cxx11-cu126-x86_64-linux/rotary/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import ctypes
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import importlib
|
| 5 |
-
from pathlib import Path
|
| 6 |
-
from types import ModuleType
|
| 7 |
-
|
| 8 |
-
def _import_from_path(file_path: Path) -> ModuleType:
|
| 9 |
-
# We cannot use the module name as-is, after adding it to `sys.modules`,
|
| 10 |
-
# it would also be used for other imports. So, we make a module name that
|
| 11 |
-
# depends on the path for it to be unique using the hex-encoded hash of
|
| 12 |
-
# the path.
|
| 13 |
-
path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 14 |
-
module_name = path_hash
|
| 15 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 16 |
-
if spec is None:
|
| 17 |
-
raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
|
| 18 |
-
module = importlib.util.module_from_spec(spec)
|
| 19 |
-
if module is None:
|
| 20 |
-
raise ImportError(f"Cannot load module {module_name} from spec")
|
| 21 |
-
sys.modules[module_name] = module
|
| 22 |
-
spec.loader.exec_module(module) # type: ignore
|
| 23 |
-
return module
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-cu128-x86_64-linux/__init__.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
from typing import Optional, Tuple
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
from ._ops import ops
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def apply_rotary(
|
| 8 |
-
x1: torch.Tensor,
|
| 9 |
-
x2: torch.Tensor,
|
| 10 |
-
cos: torch.Tensor,
|
| 11 |
-
sin: torch.Tensor,
|
| 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/_ops.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
from . import _rotary_90e4f0f
|
| 3 |
-
ops = torch.ops._rotary_90e4f0f
|
| 4 |
-
|
| 5 |
-
def add_op_namespace_prefix(op_name: str):
|
| 6 |
-
"""
|
| 7 |
-
Prefix op by namespace.
|
| 8 |
-
"""
|
| 9 |
-
return f"_rotary_90e4f0f::{op_name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-cu128-x86_64-linux/_rotary_90e4f0f.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:98c0ac8bc3419520fc5cd00658273b71611e2fe0bef3d63e5cd9c256b28540ac
|
| 3 |
-
size 11895768
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-cu128-x86_64-linux/metadata.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"python-depends":[]}
|
|
|
|
|
|
build/torch28-cxx11-cu128-x86_64-linux/rotary/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import ctypes
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import importlib
|
| 5 |
-
from pathlib import Path
|
| 6 |
-
from types import ModuleType
|
| 7 |
-
|
| 8 |
-
def _import_from_path(file_path: Path) -> ModuleType:
|
| 9 |
-
# We cannot use the module name as-is, after adding it to `sys.modules`,
|
| 10 |
-
# it would also be used for other imports. So, we make a module name that
|
| 11 |
-
# depends on the path for it to be unique using the hex-encoded hash of
|
| 12 |
-
# the path.
|
| 13 |
-
path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 14 |
-
module_name = path_hash
|
| 15 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 16 |
-
if spec is None:
|
| 17 |
-
raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
|
| 18 |
-
module = importlib.util.module_from_spec(spec)
|
| 19 |
-
if module is None:
|
| 20 |
-
raise ImportError(f"Cannot load module {module_name} from spec")
|
| 21 |
-
sys.modules[module_name] = module
|
| 22 |
-
spec.loader.exec_module(module) # type: ignore
|
| 23 |
-
return module
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-cu129-x86_64-linux/__init__.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
from typing import Optional, Tuple
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
from ._ops import ops
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def apply_rotary(
|
| 8 |
-
x1: torch.Tensor,
|
| 9 |
-
x2: torch.Tensor,
|
| 10 |
-
cos: torch.Tensor,
|
| 11 |
-
sin: torch.Tensor,
|
| 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/_ops.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
from . import _rotary_90e4f0f
|
| 3 |
-
ops = torch.ops._rotary_90e4f0f
|
| 4 |
-
|
| 5 |
-
def add_op_namespace_prefix(op_name: str):
|
| 6 |
-
"""
|
| 7 |
-
Prefix op by namespace.
|
| 8 |
-
"""
|
| 9 |
-
return f"_rotary_90e4f0f::{op_name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-cu129-x86_64-linux/_rotary_90e4f0f.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:8e5aeb4ea26bf0cc26423ed103edbbbaa7a0329086a723c259daaa2e458b0a5f
|
| 3 |
-
size 11964056
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-cu129-x86_64-linux/metadata.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"python-depends":[]}
|
|
|
|
|
|
build/torch28-cxx11-cu129-x86_64-linux/rotary/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import ctypes
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import importlib
|
| 5 |
-
from pathlib import Path
|
| 6 |
-
from types import ModuleType
|
| 7 |
-
|
| 8 |
-
def _import_from_path(file_path: Path) -> ModuleType:
|
| 9 |
-
# We cannot use the module name as-is, after adding it to `sys.modules`,
|
| 10 |
-
# it would also be used for other imports. So, we make a module name that
|
| 11 |
-
# depends on the path for it to be unique using the hex-encoded hash of
|
| 12 |
-
# the path.
|
| 13 |
-
path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 14 |
-
module_name = path_hash
|
| 15 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 16 |
-
if spec is None:
|
| 17 |
-
raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
|
| 18 |
-
module = importlib.util.module_from_spec(spec)
|
| 19 |
-
if module is None:
|
| 20 |
-
raise ImportError(f"Cannot load module {module_name} from spec")
|
| 21 |
-
sys.modules[module_name] = module
|
| 22 |
-
spec.loader.exec_module(module) # type: ignore
|
| 23 |
-
return module
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-xpu20251-x86_64-linux/__init__.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
from typing import Optional, Tuple
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
from ._ops import ops
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def apply_rotary(
|
| 8 |
-
x1: torch.Tensor,
|
| 9 |
-
x2: torch.Tensor,
|
| 10 |
-
cos: torch.Tensor,
|
| 11 |
-
sin: torch.Tensor,
|
| 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/_ops.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
from . import _rotary_90e4f0f
|
| 3 |
-
ops = torch.ops._rotary_90e4f0f
|
| 4 |
-
|
| 5 |
-
def add_op_namespace_prefix(op_name: str):
|
| 6 |
-
"""
|
| 7 |
-
Prefix op by namespace.
|
| 8 |
-
"""
|
| 9 |
-
return f"_rotary_90e4f0f::{op_name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-xpu20251-x86_64-linux/_rotary_90e4f0f.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:bbdc8e24aa6917d5c44abdd37f7b0dfd6e42420d66999a71fffca4db2feeab73
|
| 3 |
-
size 2338640
|
|
|
|
|
|
|
|
|
|
|
|
build/torch28-cxx11-xpu20251-x86_64-linux/metadata.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"python-depends":[]}
|
|
|
|
|
|
build/torch28-cxx11-xpu20251-x86_64-linux/rotary/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import ctypes
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import importlib
|
| 5 |
-
from pathlib import Path
|
| 6 |
-
from types import ModuleType
|
| 7 |
-
|
| 8 |
-
def _import_from_path(file_path: Path) -> ModuleType:
|
| 9 |
-
# We cannot use the module name as-is, after adding it to `sys.modules`,
|
| 10 |
-
# it would also be used for other imports. So, we make a module name that
|
| 11 |
-
# depends on the path for it to be unique using the hex-encoded hash of
|
| 12 |
-
# the path.
|
| 13 |
-
path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 14 |
-
module_name = path_hash
|
| 15 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 16 |
-
if spec is None:
|
| 17 |
-
raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
|
| 18 |
-
module = importlib.util.module_from_spec(spec)
|
| 19 |
-
if module is None:
|
| 20 |
-
raise ImportError(f"Cannot load module {module_name} from spec")
|
| 21 |
-
sys.modules[module_name] = module
|
| 22 |
-
spec.loader.exec_module(module) # type: ignore
|
| 23 |
-
return module
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch29-cxx11-cu126-x86_64-linux/__init__.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
from typing import Optional, Tuple
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
from ._ops import ops
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def apply_rotary(
|
| 8 |
-
x1: torch.Tensor,
|
| 9 |
-
x2: torch.Tensor,
|
| 10 |
-
cos: torch.Tensor,
|
| 11 |
-
sin: torch.Tensor,
|
| 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/_ops.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
from . import _rotary_90e4f0f
|
| 3 |
-
ops = torch.ops._rotary_90e4f0f
|
| 4 |
-
|
| 5 |
-
def add_op_namespace_prefix(op_name: str):
|
| 6 |
-
"""
|
| 7 |
-
Prefix op by namespace.
|
| 8 |
-
"""
|
| 9 |
-
return f"_rotary_90e4f0f::{op_name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch29-cxx11-cu126-x86_64-linux/_rotary_90e4f0f.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:dd3327462b2c2aa0ee26f7a8e39655e9453cf2544c809c2fb2b25dae13256296
|
| 3 |
-
size 8190536
|
|
|
|
|
|
|
|
|
|
|
|
build/torch29-cxx11-cu126-x86_64-linux/metadata.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"python-depends":[]}
|
|
|
|
|
|
build/torch29-cxx11-cu126-x86_64-linux/rotary/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import ctypes
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import importlib
|
| 5 |
-
from pathlib import Path
|
| 6 |
-
from types import ModuleType
|
| 7 |
-
|
| 8 |
-
def _import_from_path(file_path: Path) -> ModuleType:
|
| 9 |
-
# We cannot use the module name as-is, after adding it to `sys.modules`,
|
| 10 |
-
# it would also be used for other imports. So, we make a module name that
|
| 11 |
-
# depends on the path for it to be unique using the hex-encoded hash of
|
| 12 |
-
# the path.
|
| 13 |
-
path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 14 |
-
module_name = path_hash
|
| 15 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 16 |
-
if spec is None:
|
| 17 |
-
raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
|
| 18 |
-
module = importlib.util.module_from_spec(spec)
|
| 19 |
-
if module is None:
|
| 20 |
-
raise ImportError(f"Cannot load module {module_name} from spec")
|
| 21 |
-
sys.modules[module_name] = module
|
| 22 |
-
spec.loader.exec_module(module) # type: ignore
|
| 23 |
-
return module
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch29-cxx11-cu128-x86_64-linux/__init__.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
| 1 |
-
from typing import Optional, Tuple
|
| 2 |
-
import torch
|
| 3 |
-
|
| 4 |
-
from ._ops import ops
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
def apply_rotary(
|
| 8 |
-
x1: torch.Tensor,
|
| 9 |
-
x2: torch.Tensor,
|
| 10 |
-
cos: torch.Tensor,
|
| 11 |
-
sin: torch.Tensor,
|
| 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/_ops.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
from . import _rotary_90e4f0f
|
| 3 |
-
ops = torch.ops._rotary_90e4f0f
|
| 4 |
-
|
| 5 |
-
def add_op_namespace_prefix(op_name: str):
|
| 6 |
-
"""
|
| 7 |
-
Prefix op by namespace.
|
| 8 |
-
"""
|
| 9 |
-
return f"_rotary_90e4f0f::{op_name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/torch29-cxx11-cu128-x86_64-linux/_rotary_90e4f0f.abi3.so
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:8f434031167709f70d404eb67234655fdb3ec9a5a1a65976e98607230deb07f3
|
| 3 |
-
size 11899968
|
|
|
|
|
|
|
|
|
|
|
|
build/torch29-cxx11-cu128-x86_64-linux/metadata.json
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"python-depends":[]}
|
|
|
|
|
|
build/torch29-cxx11-cu128-x86_64-linux/rotary/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
import ctypes
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import importlib
|
| 5 |
-
from pathlib import Path
|
| 6 |
-
from types import ModuleType
|
| 7 |
-
|
| 8 |
-
def _import_from_path(file_path: Path) -> ModuleType:
|
| 9 |
-
# We cannot use the module name as-is, after adding it to `sys.modules`,
|
| 10 |
-
# it would also be used for other imports. So, we make a module name that
|
| 11 |
-
# depends on the path for it to be unique using the hex-encoded hash of
|
| 12 |
-
# the path.
|
| 13 |
-
path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value)
|
| 14 |
-
module_name = path_hash
|
| 15 |
-
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
| 16 |
-
if spec is None:
|
| 17 |
-
raise ImportError(f"Cannot load spec for {module_name} from {file_path}")
|
| 18 |
-
module = importlib.util.module_from_spec(spec)
|
| 19 |
-
if module is None:
|
| 20 |
-
raise ImportError(f"Cannot load module {module_name} from spec")
|
| 21 |
-
sys.modules[module_name] = module
|
| 22 |
-
spec.loader.exec_module(module) # type: ignore
|
| 23 |
-
return module
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|