Instructions to use odyssey-systems/layer-norm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use odyssey-systems/layer-norm with Kernels:
# !pip install kernels from kernels import get_kernel kernel = get_kernel("odyssey-systems/layer-norm") - Notebooks
- Google Colab
- Kaggle
Add grafted torch2.9+cu130 build variant
Browse files- .gitattributes +1 -0
- build/torch29-cxx11-cu130-x86_64-linux/__init__.py +38 -0
- build/torch29-cxx11-cu130-x86_64-linux/dropout_layer_norm.cpython-312-x86_64-linux-gnu.so +3 -0
- build/torch29-cxx11-cu130-x86_64-linux/layer_norm/__init__.py +26 -0
- build/torch29-cxx11-cu130-x86_64-linux/metadata.json +14 -0
.gitattributes
CHANGED
|
@@ -111,3 +111,4 @@ build/torch211-cxx11-cu130-aarch64-linux/dropout_layer_norm.cpython-312-aarch64-
|
|
| 111 |
build/torch211-cxx11-cu130-x86_64-linux/dropout_layer_norm.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 112 |
build/torch212-cxx11-cu130-aarch64-linux/dropout_layer_norm.cpython-312-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 113 |
build/torch212-cxx11-cu130-x86_64-linux/dropout_layer_norm.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 111 |
build/torch211-cxx11-cu130-x86_64-linux/dropout_layer_norm.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 112 |
build/torch212-cxx11-cu130-aarch64-linux/dropout_layer_norm.cpython-312-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 113 |
build/torch212-cxx11-cu130-x86_64-linux/dropout_layer_norm.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 114 |
+
build/torch29-cxx11-cu130-x86_64-linux/dropout_layer_norm.cpython-312-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
build/torch29-cxx11-cu130-x86_64-linux/__init__.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""torch 2.9 / cu12.8 build variant grafted from the odysseyml flash-attention fork.
|
| 2 |
+
|
| 3 |
+
Wraps the pre-built ``dropout_layer_norm`` extension from the
|
| 4 |
+
``odyssey-fused-kernels`` wheel (tag ``odyssey-v2.8.3-fused-1``, built for
|
| 5 |
+
sm_80/90/100/120) because upstream kernels-community/layer-norm only provides
|
| 6 |
+
a cu129 build for torch 2.9.
|
| 7 |
+
|
| 8 |
+
Unlike the kernels-community builds (which drop ``residual`` from the fused
|
| 9 |
+
op signatures), this build keeps flash-attention's original signature with
|
| 10 |
+
``residual`` as the second argument. Consumers can check ``SUPPORTS_RESIDUAL``.
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
import importlib.util
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
# True: kernels with flash-attention's original signature: fwd takes
|
| 17 |
+
# (x0, residual, gamma, beta, ...) and bwd is supported.
|
| 18 |
+
SUPPORTS_RESIDUAL = True
|
| 19 |
+
|
| 20 |
+
# The extension's PyInit_* symbol is derived from the module name passed to
|
| 21 |
+
# the loader, so the spec name must exactly equal the .so module name.
|
| 22 |
+
_so_path = next(Path(__file__).parent.glob("dropout_layer_norm*.so"))
|
| 23 |
+
_spec = importlib.util.spec_from_file_location("dropout_layer_norm", _so_path)
|
| 24 |
+
_ext = importlib.util.module_from_spec(_spec)
|
| 25 |
+
_spec.loader.exec_module(_ext)
|
| 26 |
+
|
| 27 |
+
dropout_add_ln_fwd = _ext.dropout_add_ln_fwd
|
| 28 |
+
dropout_add_ln_bwd = _ext.dropout_add_ln_bwd
|
| 29 |
+
dropout_add_ln_parallel_residual_fwd = _ext.dropout_add_ln_parallel_residual_fwd
|
| 30 |
+
dropout_add_ln_parallel_residual_bwd = _ext.dropout_add_ln_parallel_residual_bwd
|
| 31 |
+
|
| 32 |
+
__all__ = [
|
| 33 |
+
"SUPPORTS_RESIDUAL",
|
| 34 |
+
"dropout_add_ln_fwd",
|
| 35 |
+
"dropout_add_ln_bwd",
|
| 36 |
+
"dropout_add_ln_parallel_residual_fwd",
|
| 37 |
+
"dropout_add_ln_parallel_residual_bwd",
|
| 38 |
+
]
|
build/torch29-cxx11-cu130-x86_64-linux/dropout_layer_norm.cpython-312-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e60775caf40e0db1dc8de8a64b030ed3d3341a09ab7fe92c37f48981087d544d
|
| 3 |
+
size 1020829008
|
build/torch29-cxx11-cu130-x86_64-linux/layer_norm/__init__.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import ctypes
|
| 2 |
+
import importlib.util
|
| 3 |
+
import sys
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from types import ModuleType
|
| 6 |
+
|
| 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-cu130-x86_64-linux/metadata.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": 1,
|
| 3 |
+
"license": "BSD-3-Clause",
|
| 4 |
+
"python-depends": [],
|
| 5 |
+
"backend": {
|
| 6 |
+
"type": "cuda",
|
| 7 |
+
"archs": [
|
| 8 |
+
"8.0",
|
| 9 |
+
"9.0",
|
| 10 |
+
"10.0",
|
| 11 |
+
"12.0"
|
| 12 |
+
]
|
| 13 |
+
}
|
| 14 |
+
}
|