danieldk HF Staff commited on
Commit
2c313c9
·
verified ·
1 Parent(s): be5e628

Build uploaded using `kernels`.

Browse files
.gitattributes CHANGED
@@ -40,3 +40,9 @@ build/torch28-cxx11-cpu-x86_64-linux/_rmsnorm_a7a4369.abi3.so filter=lfs diff=lf
40
  build/torch28-cxx11-xpu20251-x86_64-linux/_rmsnorm_a7a4369.abi3.so filter=lfs diff=lfs merge=lfs -text
41
  build/torch29-cxx11-cpu-x86_64-linux/_rmsnorm_a7a4369.abi3.so filter=lfs diff=lfs merge=lfs -text
42
  build/torch29-cxx11-xpu20252-x86_64-linux/_rmsnorm_a7a4369.abi3.so filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
40
  build/torch28-cxx11-xpu20251-x86_64-linux/_rmsnorm_a7a4369.abi3.so filter=lfs diff=lfs merge=lfs -text
41
  build/torch29-cxx11-cpu-x86_64-linux/_rmsnorm_a7a4369.abi3.so filter=lfs diff=lfs merge=lfs -text
42
  build/torch29-cxx11-xpu20252-x86_64-linux/_rmsnorm_a7a4369.abi3.so filter=lfs diff=lfs merge=lfs -text
43
+ build/torch210-cxx11-cpu-x86_64-linux/_rmsnorm_fb26d8c.abi3.so filter=lfs diff=lfs merge=lfs -text
44
+ build/torch210-cxx11-xpu20253-x86_64-linux/_rmsnorm_fb26d8c.abi3.so filter=lfs diff=lfs merge=lfs -text
45
+ build/torch28-cxx11-cpu-x86_64-linux/_rmsnorm_fb26d8c.abi3.so filter=lfs diff=lfs merge=lfs -text
46
+ build/torch28-cxx11-xpu20251-x86_64-linux/_rmsnorm_fb26d8c.abi3.so filter=lfs diff=lfs merge=lfs -text
47
+ build/torch29-cxx11-cpu-x86_64-linux/_rmsnorm_fb26d8c.abi3.so filter=lfs diff=lfs merge=lfs -text
48
+ build/torch29-cxx11-xpu20252-x86_64-linux/_rmsnorm_fb26d8c.abi3.so filter=lfs diff=lfs merge=lfs -text
build/torch210-cxx11-cpu-x86_64-linux/__init__.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from . import layers
2
+
3
+ from ._ops import ops
4
+
5
+
6
+ def apply_rms_norm(input, weight, eps):
7
+ return ops.apply_rms_norm(
8
+ input,
9
+ weight,
10
+ eps,
11
+ )
12
+
13
+ __all__ = ["layers", "apply_rms_norm"]
14
+
build/torch210-cxx11-cpu-x86_64-linux/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _rmsnorm_fb26d8c
3
+ ops = torch.ops._rmsnorm_fb26d8c
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_rmsnorm_fb26d8c::{op_name}"
build/torch210-cxx11-cpu-x86_64-linux/_rmsnorm_fb26d8c.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8a1c744d46b5b0b6455825653741008b06242630ae9946f0205ac2c055dbc7e
3
+ size 326352
build/torch210-cxx11-cpu-x86_64-linux/layers.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from ._ops import ops
3
+
4
+ class RMSNorm(torch.nn.Module):
5
+ """
6
+ RMSNorm module that uses the optimized LigerRMSNormFunction.
7
+
8
+ Args:
9
+ hidden_size (int): The size of the hidden dimension.
10
+ eps (float, optional): The epsilon value for numerical stability. Defaults to 1e-6.
11
+ offset (float, optional): Offset value to shift the weight tensor. Defaults to 0.0.
12
+ casting_mode (str, optional): The casting mode to use. Defaults to "llama".
13
+ in_place (bool, optional): Whether to modify dY in-place to store dX during backward. Defaults to True.
14
+ """
15
+
16
+
17
+ weight: torch.Tensor
18
+ variance_epsilon: float
19
+
20
+ def forward(self, hidden_states):
21
+ """
22
+ Apply RMS normalization to the input tensor.
23
+
24
+ Args:
25
+ hidden_states (torch.Tensor): Input tensor of shape (B, T, H) or (BxT, H)
26
+
27
+ Returns:
28
+ torch.Tensor: Normalized tensor of the same shape as input
29
+ """
30
+ return ops.apply_rms_norm(
31
+ hidden_states,
32
+ self.weight,
33
+ self.variance_epsilon,
34
+ )
35
+
36
+ __all__ = ["RMSNorm"]
build/torch210-cxx11-cpu-x86_64-linux/metadata.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"python-depends":[]}
build/torch210-cxx11-cpu-x86_64-linux/rmsnorm/__init__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from . import layers
2
+
3
+ from ._ops import ops
4
+
5
+
6
+ def apply_rms_norm(input, weight, eps):
7
+ return ops.apply_rms_norm(
8
+ input,
9
+ weight,
10
+ eps,
11
+ )
12
+
13
+ __all__ = ["layers", "apply_rms_norm"]
14
+
build/torch210-cxx11-xpu20253-x86_64-linux/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _rmsnorm_fb26d8c
3
+ ops = torch.ops._rmsnorm_fb26d8c
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_rmsnorm_fb26d8c::{op_name}"
build/torch210-cxx11-xpu20253-x86_64-linux/_rmsnorm_fb26d8c.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4be94737423cc4d02f4be83f38144614d71ccd8672d96699f0b10136dd541847
3
+ size 104941392
build/torch210-cxx11-xpu20253-x86_64-linux/layers.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from ._ops import ops
3
+
4
+ class RMSNorm(torch.nn.Module):
5
+ """
6
+ RMSNorm module that uses the optimized LigerRMSNormFunction.
7
+
8
+ Args:
9
+ hidden_size (int): The size of the hidden dimension.
10
+ eps (float, optional): The epsilon value for numerical stability. Defaults to 1e-6.
11
+ offset (float, optional): Offset value to shift the weight tensor. Defaults to 0.0.
12
+ casting_mode (str, optional): The casting mode to use. Defaults to "llama".
13
+ in_place (bool, optional): Whether to modify dY in-place to store dX during backward. Defaults to True.
14
+ """
15
+
16
+
17
+ weight: torch.Tensor
18
+ variance_epsilon: float
19
+
20
+ def forward(self, hidden_states):
21
+ """
22
+ Apply RMS normalization to the input tensor.
23
+
24
+ Args:
25
+ hidden_states (torch.Tensor): Input tensor of shape (B, T, H) or (BxT, H)
26
+
27
+ Returns:
28
+ torch.Tensor: Normalized tensor of the same shape as input
29
+ """
30
+ return ops.apply_rms_norm(
31
+ hidden_states,
32
+ self.weight,
33
+ self.variance_epsilon,
34
+ )
35
+
36
+ __all__ = ["RMSNorm"]
build/torch210-cxx11-xpu20253-x86_64-linux/metadata.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"python-depends":[]}
build/torch210-cxx11-xpu20253-x86_64-linux/rmsnorm/__init__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-cpu-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rmsnorm_a7a4369
3
- ops = torch.ops._rmsnorm_a7a4369
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rmsnorm_a7a4369::{op_name}"
 
1
  import torch
2
+ from . import _rmsnorm_fb26d8c
3
+ ops = torch.ops._rmsnorm_fb26d8c
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rmsnorm_fb26d8c::{op_name}"
build/torch28-cxx11-cpu-x86_64-linux/{_rmsnorm_a7a4369.abi3.so → _rmsnorm_fb26d8c.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:55621bcd39646f99f979ef03f823fcb35afceead03961675835a80a2c5b6d134
3
  size 324616
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:055fc9c5e82e48e503963bac3da30001e128774d8d9a333680b8aacab0650644
3
  size 324616
build/torch28-cxx11-xpu20251-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rmsnorm_a7a4369
3
- ops = torch.ops._rmsnorm_a7a4369
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rmsnorm_a7a4369::{op_name}"
 
1
  import torch
2
+ from . import _rmsnorm_fb26d8c
3
+ ops = torch.ops._rmsnorm_fb26d8c
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rmsnorm_fb26d8c::{op_name}"
build/torch28-cxx11-xpu20251-x86_64-linux/{_rmsnorm_a7a4369.abi3.so → _rmsnorm_fb26d8c.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f265f642541565b741228747e4503426aadfaa9cdb428b1a571fa695fd726812
3
  size 103861336
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0ba9e0355977f76b16f6346377026ffde2977c613ee9b5633083d6f95f4e07c
3
  size 103861336
build/torch29-cxx11-cpu-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rmsnorm_a7a4369
3
- ops = torch.ops._rmsnorm_a7a4369
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rmsnorm_a7a4369::{op_name}"
 
1
  import torch
2
+ from . import _rmsnorm_fb26d8c
3
+ ops = torch.ops._rmsnorm_fb26d8c
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rmsnorm_fb26d8c::{op_name}"
build/torch29-cxx11-cpu-x86_64-linux/{_rmsnorm_a7a4369.abi3.so → _rmsnorm_fb26d8c.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1ec310cc2696fcc0ef846f6e940e1eec2ba7a50848b69e59a7834f3ddee5927c
3
  size 324592
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97de49bd6f5edb8a54394a123362f30026a119e4f8ccf796884f108c343ec562
3
  size 324592
build/torch29-cxx11-xpu20252-x86_64-linux/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _rmsnorm_a7a4369
3
- ops = torch.ops._rmsnorm_a7a4369
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_rmsnorm_a7a4369::{op_name}"
 
1
  import torch
2
+ from . import _rmsnorm_fb26d8c
3
+ ops = torch.ops._rmsnorm_fb26d8c
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_rmsnorm_fb26d8c::{op_name}"
build/torch29-cxx11-xpu20252-x86_64-linux/{_rmsnorm_a7a4369.abi3.so → _rmsnorm_fb26d8c.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f13902ee157cb167ad294a906252f5a349ee13c8afe0d71b51a895cf6944cbfe
3
  size 102340240
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:47dcb713294a6eca6d920f2e9aba27be280d75ac2d356845232008210d1df17a
3
  size 102340240