Run this model with HF Jobs
Run replicate/layer-norm on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/replicate/layer-norm. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/replicate/layer-norm on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use replicate/layer-norm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use replicate/layer-norm 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("replicate/layer-norm", version=1) - Notebooks
- Google Colab
- Kaggle
Build uploaded using `kernels`.
Browse filesFiles changed (43)
- .gitattributes+7
- build/torch210-cxx11-cu126-aarch64-linux/__init__.pyAdded+26
- build/torch210-cxx11-cu126-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch210-cxx11-cu126-aarch64-linux/_ops.pyAdded+9
- build/torch210-cxx11-cu126-aarch64-linux/layer_norm/__init__.pyAdded+26
- build/torch210-cxx11-cu126-aarch64-linux/layers.pyAdded+51
- build/torch210-cxx11-cu126-aarch64-linux/metadata.jsonAdded+13
- build/torch210-cxx11-cu128-aarch64-linux/__init__.pyAdded+26
- build/torch210-cxx11-cu128-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch210-cxx11-cu128-aarch64-linux/_ops.pyAdded+9
- build/torch210-cxx11-cu128-aarch64-linux/layer_norm/__init__.pyAdded+26
- build/torch210-cxx11-cu128-aarch64-linux/layers.pyAdded+51
- build/torch210-cxx11-cu128-aarch64-linux/metadata.jsonAdded+15
- build/torch210-cxx11-cu130-aarch64-linux/__init__.pyAdded+26
- build/torch210-cxx11-cu130-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch210-cxx11-cu130-aarch64-linux/_ops.pyAdded+9
- build/torch210-cxx11-cu130-aarch64-linux/layer_norm/__init__.pyAdded+26
- build/torch210-cxx11-cu130-aarch64-linux/layers.pyAdded+51
- build/torch210-cxx11-cu130-aarch64-linux/metadata.jsonAdded+15
- build/torch211-cxx11-cu126-aarch64-linux/__init__.pyAdded+26
- build/torch211-cxx11-cu126-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch211-cxx11-cu126-aarch64-linux/_ops.pyAdded+9
- build/torch211-cxx11-cu126-aarch64-linux/layer_norm/__init__.pyAdded+26
- build/torch211-cxx11-cu126-aarch64-linux/layers.pyAdded+51
- build/torch211-cxx11-cu126-aarch64-linux/metadata.jsonAdded+13
- build/torch211-cxx11-cu128-aarch64-linux/__init__.pyAdded+26
- build/torch211-cxx11-cu128-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch211-cxx11-cu128-aarch64-linux/_ops.pyAdded+9
- build/torch211-cxx11-cu128-aarch64-linux/layer_norm/__init__.pyAdded+26
- build/torch211-cxx11-cu128-aarch64-linux/layers.pyAdded+51
- build/torch211-cxx11-cu128-aarch64-linux/metadata.jsonAdded+15
- build/torch211-cxx11-cu130-aarch64-linux/__init__.pyAdded+26
- build/torch211-cxx11-cu130-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch211-cxx11-cu130-aarch64-linux/_ops.pyAdded+9
- build/torch211-cxx11-cu130-aarch64-linux/layer_norm/__init__.pyAdded+26
- build/torch211-cxx11-cu130-aarch64-linux/layers.pyAdded+51
- build/torch211-cxx11-cu130-aarch64-linux/metadata.jsonAdded+15
- build/torch29-cxx11-cu129-aarch64-linux/__init__.pyAdded+26
- build/torch29-cxx11-cu129-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch29-cxx11-cu129-aarch64-linux/_ops.pyAdded+9
- build/torch29-cxx11-cu129-aarch64-linux/layer_norm/__init__.pyAdded+26
- build/torch29-cxx11-cu129-aarch64-linux/layers.pyAdded+51
- build/torch29-cxx11-cu129-aarch64-linux/metadata.jsonAdded+15
32 unmodified lines3334353637383940414232 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textbuild/torch210-cxx11-cu126-aarch64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch210-cxx11-cu128-aarch64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch210-cxx11-cu130-aarch64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch211-cxx11-cu126-aarch64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch211-cxx11-cu128-aarch64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch211-cxx11-cu130-aarch64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch29-cxx11-cu129-aarch64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -text1234567891011121314151617181920212223242526import torchimport torch.nn as nn
from ._ops import ops
from . import layers
def dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm): return ops.dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm)
def dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm): return ops.dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm)
__all__ = [ "layers", "dropout_add_ln_fwd", "dropout_add_ln_bwd", "dropout_add_ln_parallel_residual_fwd", "dropout_add_ln_parallel_residual_bwd",]123version https://git-lfs.github.com/spec/v1oid sha256:e4ad4d5e8dee889d696c0b60ac2aa7c24586412b5605a33722f45a13a077b88dsize 711710472123456789import torchfrom . import _layer_norm_cuda_143103bops = torch.ops._layer_norm_cuda_143103b
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_layer_norm_cuda_143103b::{op_name}"1234567891011121314151617181920212223242526import ctypesimport importlib.utilimport sysfrom pathlib import Pathfrom types import ModuleType
def _import_from_path(file_path: Path) -> ModuleType: # We cannot use the module name as-is, after adding it to `sys.modules`, # it would also be used for other imports. So, we make a module name that # depends on the path for it to be unique using the hex-encoded hash of # the path. path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value) module_name = path_hash spec = importlib.util.spec_from_file_location(module_name, file_path) if spec is None: raise ImportError(f"Cannot load spec for {module_name} from {file_path}") module = importlib.util.module_from_spec(spec) if module is None: raise ImportError(f"Cannot load module {module_name} from spec") sys.modules[module_name] = module spec.loader.exec_module(module) # type: ignore return module
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051import torchimport torch.nn as nn
from ._ops import ops
class LayerNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = False, ) return output[0].view(hidden_states.shape)
class LlamaRMSNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = True, ) return output[0].view(hidden_states.shape)12345678910111213{ "version": 1, "license": "BSD-3-Clause", "python-depends": [], "backend": { "type": "cuda", "archs": [ "8.0", "8.9", "9.0" ] }}1234567891011121314151617181920212223242526import torchimport torch.nn as nn
from ._ops import ops
from . import layers
def dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm): return ops.dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm)
def dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm): return ops.dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm)
__all__ = [ "layers", "dropout_add_ln_fwd", "dropout_add_ln_bwd", "dropout_add_ln_parallel_residual_fwd", "dropout_add_ln_parallel_residual_bwd",]123version https://git-lfs.github.com/spec/v1oid sha256:af5417fb89bb13567875514abfde1d4a087bb0295de1f53aaaf20edb0eb562c1size 1231083200123456789import torchfrom . import _layer_norm_cuda_143103bops = torch.ops._layer_norm_cuda_143103b
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_layer_norm_cuda_143103b::{op_name}"1234567891011121314151617181920212223242526import ctypesimport importlib.utilimport sysfrom pathlib import Pathfrom types import ModuleType
def _import_from_path(file_path: Path) -> ModuleType: # We cannot use the module name as-is, after adding it to `sys.modules`, # it would also be used for other imports. So, we make a module name that # depends on the path for it to be unique using the hex-encoded hash of # the path. path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value) module_name = path_hash spec = importlib.util.spec_from_file_location(module_name, file_path) if spec is None: raise ImportError(f"Cannot load spec for {module_name} from {file_path}") module = importlib.util.module_from_spec(spec) if module is None: raise ImportError(f"Cannot load module {module_name} from spec") sys.modules[module_name] = module spec.loader.exec_module(module) # type: ignore return module
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051import torchimport torch.nn as nn
from ._ops import ops
class LayerNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = False, ) return output[0].view(hidden_states.shape)
class LlamaRMSNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = True, ) return output[0].view(hidden_states.shape)123456789101112131415{ "version": 1, "license": "BSD-3-Clause", "python-depends": [], "backend": { "type": "cuda", "archs": [ "10.0", "12.0", "8.0", "8.9", "9.0" ] }}1234567891011121314151617181920212223242526import torchimport torch.nn as nn
from ._ops import ops
from . import layers
def dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm): return ops.dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm)
def dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm): return ops.dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm)
__all__ = [ "layers", "dropout_add_ln_fwd", "dropout_add_ln_bwd", "dropout_add_ln_parallel_residual_fwd", "dropout_add_ln_parallel_residual_bwd",]123version https://git-lfs.github.com/spec/v1oid sha256:c61421662fd4b22a3eb3d75fa5d9fcd3775ad8d8bbcf9c638b89e427111927b3size 1235993064123456789import torchfrom . import _layer_norm_cuda_143103bops = torch.ops._layer_norm_cuda_143103b
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_layer_norm_cuda_143103b::{op_name}"1234567891011121314151617181920212223242526import ctypesimport importlib.utilimport sysfrom pathlib import Pathfrom types import ModuleType
def _import_from_path(file_path: Path) -> ModuleType: # We cannot use the module name as-is, after adding it to `sys.modules`, # it would also be used for other imports. So, we make a module name that # depends on the path for it to be unique using the hex-encoded hash of # the path. path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value) module_name = path_hash spec = importlib.util.spec_from_file_location(module_name, file_path) if spec is None: raise ImportError(f"Cannot load spec for {module_name} from {file_path}") module = importlib.util.module_from_spec(spec) if module is None: raise ImportError(f"Cannot load module {module_name} from spec") sys.modules[module_name] = module spec.loader.exec_module(module) # type: ignore return module
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051import torchimport torch.nn as nn
from ._ops import ops
class LayerNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = False, ) return output[0].view(hidden_states.shape)
class LlamaRMSNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = True, ) return output[0].view(hidden_states.shape)123456789101112131415{ "version": 1, "license": "BSD-3-Clause", "python-depends": [], "backend": { "type": "cuda", "archs": [ "10.0", "12.0", "8.0", "8.9", "9.0" ] }}1234567891011121314151617181920212223242526import torchimport torch.nn as nn
from ._ops import ops
from . import layers
def dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm): return ops.dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm)
def dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm): return ops.dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm)
__all__ = [ "layers", "dropout_add_ln_fwd", "dropout_add_ln_bwd", "dropout_add_ln_parallel_residual_fwd", "dropout_add_ln_parallel_residual_bwd",]123version https://git-lfs.github.com/spec/v1oid sha256:1d1b35f4d42743357fe2fbd9feb0ce20d28506154325e0745c97aa99d829bda8size 711706784123456789import torchfrom . import _layer_norm_cuda_143103bops = torch.ops._layer_norm_cuda_143103b
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_layer_norm_cuda_143103b::{op_name}"1234567891011121314151617181920212223242526import ctypesimport importlib.utilimport sysfrom pathlib import Pathfrom types import ModuleType
def _import_from_path(file_path: Path) -> ModuleType: # We cannot use the module name as-is, after adding it to `sys.modules`, # it would also be used for other imports. So, we make a module name that # depends on the path for it to be unique using the hex-encoded hash of # the path. path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value) module_name = path_hash spec = importlib.util.spec_from_file_location(module_name, file_path) if spec is None: raise ImportError(f"Cannot load spec for {module_name} from {file_path}") module = importlib.util.module_from_spec(spec) if module is None: raise ImportError(f"Cannot load module {module_name} from spec") sys.modules[module_name] = module spec.loader.exec_module(module) # type: ignore return module
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051import torchimport torch.nn as nn
from ._ops import ops
class LayerNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = False, ) return output[0].view(hidden_states.shape)
class LlamaRMSNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = True, ) return output[0].view(hidden_states.shape)12345678910111213{ "version": 1, "license": "BSD-3-Clause", "python-depends": [], "backend": { "type": "cuda", "archs": [ "8.0", "8.9", "9.0" ] }}1234567891011121314151617181920212223242526import torchimport torch.nn as nn
from ._ops import ops
from . import layers
def dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm): return ops.dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm)
def dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm): return ops.dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm)
__all__ = [ "layers", "dropout_add_ln_fwd", "dropout_add_ln_bwd", "dropout_add_ln_parallel_residual_fwd", "dropout_add_ln_parallel_residual_bwd",]123version https://git-lfs.github.com/spec/v1oid sha256:b5e69e28fd3ca606b2519b7d64c292a8008db36f8b049d2bde0bf22c2fee0849size 1231079512123456789import torchfrom . import _layer_norm_cuda_143103bops = torch.ops._layer_norm_cuda_143103b
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_layer_norm_cuda_143103b::{op_name}"1234567891011121314151617181920212223242526import ctypesimport importlib.utilimport sysfrom pathlib import Pathfrom types import ModuleType
def _import_from_path(file_path: Path) -> ModuleType: # We cannot use the module name as-is, after adding it to `sys.modules`, # it would also be used for other imports. So, we make a module name that # depends on the path for it to be unique using the hex-encoded hash of # the path. path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value) module_name = path_hash spec = importlib.util.spec_from_file_location(module_name, file_path) if spec is None: raise ImportError(f"Cannot load spec for {module_name} from {file_path}") module = importlib.util.module_from_spec(spec) if module is None: raise ImportError(f"Cannot load module {module_name} from spec") sys.modules[module_name] = module spec.loader.exec_module(module) # type: ignore return module
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051import torchimport torch.nn as nn
from ._ops import ops
class LayerNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = False, ) return output[0].view(hidden_states.shape)
class LlamaRMSNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = True, ) return output[0].view(hidden_states.shape)123456789101112131415{ "version": 1, "license": "BSD-3-Clause", "python-depends": [], "backend": { "type": "cuda", "archs": [ "10.0", "12.0", "8.0", "8.9", "9.0" ] }}1234567891011121314151617181920212223242526import torchimport torch.nn as nn
from ._ops import ops
from . import layers
def dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm): return ops.dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm)
def dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm): return ops.dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm)
__all__ = [ "layers", "dropout_add_ln_fwd", "dropout_add_ln_bwd", "dropout_add_ln_parallel_residual_fwd", "dropout_add_ln_parallel_residual_bwd",]123version https://git-lfs.github.com/spec/v1oid sha256:3147d8b7ea6ae20c72894191e79992c1825505e22b12b9fdf6df9d666504ab82size 1235989376123456789import torchfrom . import _layer_norm_cuda_143103bops = torch.ops._layer_norm_cuda_143103b
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_layer_norm_cuda_143103b::{op_name}"1234567891011121314151617181920212223242526import ctypesimport importlib.utilimport sysfrom pathlib import Pathfrom types import ModuleType
def _import_from_path(file_path: Path) -> ModuleType: # We cannot use the module name as-is, after adding it to `sys.modules`, # it would also be used for other imports. So, we make a module name that # depends on the path for it to be unique using the hex-encoded hash of # the path. path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value) module_name = path_hash spec = importlib.util.spec_from_file_location(module_name, file_path) if spec is None: raise ImportError(f"Cannot load spec for {module_name} from {file_path}") module = importlib.util.module_from_spec(spec) if module is None: raise ImportError(f"Cannot load module {module_name} from spec") sys.modules[module_name] = module spec.loader.exec_module(module) # type: ignore return module
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051import torchimport torch.nn as nn
from ._ops import ops
class LayerNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = False, ) return output[0].view(hidden_states.shape)
class LlamaRMSNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = True, ) return output[0].view(hidden_states.shape)123456789101112131415{ "version": 1, "license": "BSD-3-Clause", "python-depends": [], "backend": { "type": "cuda", "archs": [ "10.0", "12.0", "8.0", "8.9", "9.0" ] }}1234567891011121314151617181920212223242526import torchimport torch.nn as nn
from ._ops import ops
from . import layers
def dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_fwd(input, gamma, beta, rowscale, colscale, x0_subset, z_subset, dropout_p, epsilon, rowscale_const, z_numrows, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm): return ops.dropout_add_ln_bwd(dz, dx, x, mu, rsigma, gamma, rowscale, colscale, x0_subset, z_subset, dropout_p, rowscale_const, x0_numrows, has_residual, is_rms_norm)
def dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm): return ops.dropout_add_ln_parallel_residual_fwd(input, gamma0, beta0, gamma1, beta1, dropout_p, epsilon, gen, residual_in_fp32, is_rms_norm)
def dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm): return ops.dropout_add_ln_parallel_residual_bwd(dz0, dz1, dx, x, mu, rsigma, gamma0, gamma1, dropout_p, has_x1, has_residual, is_rms_norm)
__all__ = [ "layers", "dropout_add_ln_fwd", "dropout_add_ln_bwd", "dropout_add_ln_parallel_residual_fwd", "dropout_add_ln_parallel_residual_bwd",]123version https://git-lfs.github.com/spec/v1oid sha256:5edebe8b0f52b1c169e80f3502abb83cfc4cf2438b5771387e8dfd9254eef1a8size 1282721000123456789import torchfrom . import _layer_norm_cuda_143103bops = torch.ops._layer_norm_cuda_143103b
def add_op_namespace_prefix(op_name: str): """ Prefix op by namespace. """ return f"_layer_norm_cuda_143103b::{op_name}"1234567891011121314151617181920212223242526import ctypesimport importlib.utilimport sysfrom pathlib import Pathfrom types import ModuleType
def _import_from_path(file_path: Path) -> ModuleType: # We cannot use the module name as-is, after adding it to `sys.modules`, # it would also be used for other imports. So, we make a module name that # depends on the path for it to be unique using the hex-encoded hash of # the path. path_hash = "{:x}".format(ctypes.c_size_t(hash(file_path.absolute())).value) module_name = path_hash spec = importlib.util.spec_from_file_location(module_name, file_path) if spec is None: raise ImportError(f"Cannot load spec for {module_name} from {file_path}") module = importlib.util.module_from_spec(spec) if module is None: raise ImportError(f"Cannot load module {module_name} from spec") sys.modules[module_name] = module spec.loader.exec_module(module) # type: ignore return module
globals().update(vars(_import_from_path(Path(__file__).parent.parent / "__init__.py")))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051import torchimport torch.nn as nn
from ._ops import ops
class LayerNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = False, ) return output[0].view(hidden_states.shape)
class LlamaRMSNorm(nn.Module): weight: torch.Tensor variance_epsilon: float
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: output = ops.dropout_add_ln_fwd( hidden_states.view(-1, hidden_states.shape[-1]), gamma = self.weight, beta = None, rowscale = None, colscale = None, x0_subset = None, z_subset = None, dropout_p = 0, epsilon = self.variance_epsilon, rowscale_const = 1.0, z_numrows = hidden_states.shape[1], gen = None, residual_in_fp32 = False, is_rms_norm = True, ) return output[0].view(hidden_states.shape)123456789101112131415{ "version": 1, "license": "BSD-3-Clause", "python-depends": [], "backend": { "type": "cuda", "archs": [ "10.0", "12.0", "8.0", "8.9", "9.0" ] }}.gitattributes+7
build/torch210-cxx11-cu126-aarch64-linux/__init__.pyAdded+26
build/torch210-cxx11-cu126-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch210-cxx11-cu126-aarch64-linux/_ops.pyAdded+9
build/torch210-cxx11-cu126-aarch64-linux/layer_norm/__init__.pyAdded+26
build/torch210-cxx11-cu126-aarch64-linux/layers.pyAdded+51
build/torch210-cxx11-cu126-aarch64-linux/metadata.jsonAdded+13
build/torch210-cxx11-cu128-aarch64-linux/__init__.pyAdded+26
build/torch210-cxx11-cu128-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch210-cxx11-cu128-aarch64-linux/_ops.pyAdded+9
build/torch210-cxx11-cu128-aarch64-linux/layer_norm/__init__.pyAdded+26
build/torch210-cxx11-cu128-aarch64-linux/layers.pyAdded+51
build/torch210-cxx11-cu128-aarch64-linux/metadata.jsonAdded+15
build/torch210-cxx11-cu130-aarch64-linux/__init__.pyAdded+26
build/torch210-cxx11-cu130-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch210-cxx11-cu130-aarch64-linux/_ops.pyAdded+9
build/torch210-cxx11-cu130-aarch64-linux/layer_norm/__init__.pyAdded+26
build/torch210-cxx11-cu130-aarch64-linux/layers.pyAdded+51
build/torch210-cxx11-cu130-aarch64-linux/metadata.jsonAdded+15
build/torch211-cxx11-cu126-aarch64-linux/__init__.pyAdded+26
build/torch211-cxx11-cu126-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch211-cxx11-cu126-aarch64-linux/_ops.pyAdded+9
build/torch211-cxx11-cu126-aarch64-linux/layer_norm/__init__.pyAdded+26
build/torch211-cxx11-cu126-aarch64-linux/layers.pyAdded+51
build/torch211-cxx11-cu126-aarch64-linux/metadata.jsonAdded+13
build/torch211-cxx11-cu128-aarch64-linux/__init__.pyAdded+26
build/torch211-cxx11-cu128-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch211-cxx11-cu128-aarch64-linux/_ops.pyAdded+9
build/torch211-cxx11-cu128-aarch64-linux/layer_norm/__init__.pyAdded+26
build/torch211-cxx11-cu128-aarch64-linux/layers.pyAdded+51
build/torch211-cxx11-cu128-aarch64-linux/metadata.jsonAdded+15
build/torch211-cxx11-cu130-aarch64-linux/__init__.pyAdded+26
build/torch211-cxx11-cu130-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch211-cxx11-cu130-aarch64-linux/_ops.pyAdded+9
build/torch211-cxx11-cu130-aarch64-linux/layer_norm/__init__.pyAdded+26
build/torch211-cxx11-cu130-aarch64-linux/layers.pyAdded+51
build/torch211-cxx11-cu130-aarch64-linux/metadata.jsonAdded+15
build/torch29-cxx11-cu129-aarch64-linux/__init__.pyAdded+26
build/torch29-cxx11-cu129-aarch64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch29-cxx11-cu129-aarch64-linux/_ops.pyAdded+9
build/torch29-cxx11-cu129-aarch64-linux/layer_norm/__init__.pyAdded+26
build/torch29-cxx11-cu129-aarch64-linux/layers.pyAdded+51
build/torch29-cxx11-cu129-aarch64-linux/metadata.jsonAdded+15