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-x86_64-linux/__init__.pyAdded+26
- build/torch210-cxx11-cu126-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch210-cxx11-cu126-x86_64-linux/_ops.pyAdded+9
- build/torch210-cxx11-cu126-x86_64-linux/layer_norm/__init__.pyAdded+26
- build/torch210-cxx11-cu126-x86_64-linux/layers.pyAdded+51
- build/torch210-cxx11-cu126-x86_64-linux/metadata.jsonAdded+13
- build/torch210-cxx11-cu128-x86_64-linux/__init__.pyAdded+26
- build/torch210-cxx11-cu128-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch210-cxx11-cu128-x86_64-linux/_ops.pyAdded+9
- build/torch210-cxx11-cu128-x86_64-linux/layer_norm/__init__.pyAdded+26
- build/torch210-cxx11-cu128-x86_64-linux/layers.pyAdded+51
- build/torch210-cxx11-cu128-x86_64-linux/metadata.jsonAdded+15
- build/torch210-cxx11-cu130-x86_64-linux/__init__.pyAdded+26
- build/torch210-cxx11-cu130-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch210-cxx11-cu130-x86_64-linux/_ops.pyAdded+9
- build/torch210-cxx11-cu130-x86_64-linux/layer_norm/__init__.pyAdded+26
- build/torch210-cxx11-cu130-x86_64-linux/layers.pyAdded+51
- build/torch210-cxx11-cu130-x86_64-linux/metadata.jsonAdded+15
- build/torch211-cxx11-cu126-x86_64-linux/__init__.pyAdded+26
- build/torch211-cxx11-cu126-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch211-cxx11-cu126-x86_64-linux/_ops.pyAdded+9
- build/torch211-cxx11-cu126-x86_64-linux/layer_norm/__init__.pyAdded+26
- build/torch211-cxx11-cu126-x86_64-linux/layers.pyAdded+51
- build/torch211-cxx11-cu126-x86_64-linux/metadata.jsonAdded+13
- build/torch211-cxx11-cu128-x86_64-linux/__init__.pyAdded+26
- build/torch211-cxx11-cu128-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch211-cxx11-cu128-x86_64-linux/_ops.pyAdded+9
- build/torch211-cxx11-cu128-x86_64-linux/layer_norm/__init__.pyAdded+26
- build/torch211-cxx11-cu128-x86_64-linux/layers.pyAdded+51
- build/torch211-cxx11-cu128-x86_64-linux/metadata.jsonAdded+15
- build/torch211-cxx11-cu130-x86_64-linux/__init__.pyAdded+26
- build/torch211-cxx11-cu130-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch211-cxx11-cu130-x86_64-linux/_ops.pyAdded+9
- build/torch211-cxx11-cu130-x86_64-linux/layer_norm/__init__.pyAdded+26
- build/torch211-cxx11-cu130-x86_64-linux/layers.pyAdded+51
- build/torch211-cxx11-cu130-x86_64-linux/metadata.jsonAdded+15
- build/torch29-cxx11-cu129-x86_64-linux/__init__.pyAdded+26
- build/torch29-cxx11-cu129-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
- build/torch29-cxx11-cu129-x86_64-linux/_ops.pyAdded+9
- build/torch29-cxx11-cu129-x86_64-linux/layer_norm/__init__.pyAdded+26
- build/torch29-cxx11-cu129-x86_64-linux/layers.pyAdded+51
- build/torch29-cxx11-cu129-x86_64-linux/metadata.jsonAdded+15
39 unmodified lines4041424344454647484939 unmodified linesbuild/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 -textbuild/torch210-cxx11-cu126-x86_64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch210-cxx11-cu128-x86_64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch210-cxx11-cu130-x86_64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch211-cxx11-cu126-x86_64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch211-cxx11-cu128-x86_64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch211-cxx11-cu130-x86_64-linux/_layer_norm_cuda_143103b.abi3.so filter=lfs diff=lfs merge=lfs -textbuild/torch29-cxx11-cu129-x86_64-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:e466713afb0ca13d2c60a66eae845ddfcaf1ac98e5297d52068e54da831564c4size 712093824123456789import 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:9ac7b943c6c28ccdfd408ef86ccc7ae5eb21adc6385f8e832141e0cbccd3eecdsize 1231419520123456789import 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:3821d36be629ae880f15967c86f432bb1c26b4d1dfef430d7f905121eaf0781bsize 1238332560123456789import 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:aa655742dc940fbe87dc0d87a17bbd1dc6a4d7a5fb99ec4d3f0f16bbb875243dsize 712082776123456789import 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:047a71d1ae85841cc6d6a1a3fdd70aeda0f5f23ded37e74537d1f21d2f47d670size 1231408464123456789import 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:0eb22c7b8606869f2aaeb4e5163bfae654ab5a405b123a102cf6568fda508ca0size 1238325592123456789import 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:8d0e08047c46ba37ec87cdd6ebd77249d8e347737318de96cdc011bad18dd61asize 1283022120123456789import 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-x86_64-linux/__init__.pyAdded+26
build/torch210-cxx11-cu126-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch210-cxx11-cu126-x86_64-linux/_ops.pyAdded+9
build/torch210-cxx11-cu126-x86_64-linux/layer_norm/__init__.pyAdded+26
build/torch210-cxx11-cu126-x86_64-linux/layers.pyAdded+51
build/torch210-cxx11-cu126-x86_64-linux/metadata.jsonAdded+13
build/torch210-cxx11-cu128-x86_64-linux/__init__.pyAdded+26
build/torch210-cxx11-cu128-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch210-cxx11-cu128-x86_64-linux/_ops.pyAdded+9
build/torch210-cxx11-cu128-x86_64-linux/layer_norm/__init__.pyAdded+26
build/torch210-cxx11-cu128-x86_64-linux/layers.pyAdded+51
build/torch210-cxx11-cu128-x86_64-linux/metadata.jsonAdded+15
build/torch210-cxx11-cu130-x86_64-linux/__init__.pyAdded+26
build/torch210-cxx11-cu130-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch210-cxx11-cu130-x86_64-linux/_ops.pyAdded+9
build/torch210-cxx11-cu130-x86_64-linux/layer_norm/__init__.pyAdded+26
build/torch210-cxx11-cu130-x86_64-linux/layers.pyAdded+51
build/torch210-cxx11-cu130-x86_64-linux/metadata.jsonAdded+15
build/torch211-cxx11-cu126-x86_64-linux/__init__.pyAdded+26
build/torch211-cxx11-cu126-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch211-cxx11-cu126-x86_64-linux/_ops.pyAdded+9
build/torch211-cxx11-cu126-x86_64-linux/layer_norm/__init__.pyAdded+26
build/torch211-cxx11-cu126-x86_64-linux/layers.pyAdded+51
build/torch211-cxx11-cu126-x86_64-linux/metadata.jsonAdded+13
build/torch211-cxx11-cu128-x86_64-linux/__init__.pyAdded+26
build/torch211-cxx11-cu128-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch211-cxx11-cu128-x86_64-linux/_ops.pyAdded+9
build/torch211-cxx11-cu128-x86_64-linux/layer_norm/__init__.pyAdded+26
build/torch211-cxx11-cu128-x86_64-linux/layers.pyAdded+51
build/torch211-cxx11-cu128-x86_64-linux/metadata.jsonAdded+15
build/torch211-cxx11-cu130-x86_64-linux/__init__.pyAdded+26
build/torch211-cxx11-cu130-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch211-cxx11-cu130-x86_64-linux/_ops.pyAdded+9
build/torch211-cxx11-cu130-x86_64-linux/layer_norm/__init__.pyAdded+26
build/torch211-cxx11-cu130-x86_64-linux/layers.pyAdded+51
build/torch211-cxx11-cu130-x86_64-linux/metadata.jsonAdded+15
build/torch29-cxx11-cu129-x86_64-linux/__init__.pyAdded+26
build/torch29-cxx11-cu129-x86_64-linux/_layer_norm_cuda_143103b.abi3.soAdded+3
build/torch29-cxx11-cu129-x86_64-linux/_ops.pyAdded+9
build/torch29-cxx11-cu129-x86_64-linux/layer_norm/__init__.pyAdded+26
build/torch29-cxx11-cu129-x86_64-linux/layers.pyAdded+51
build/torch29-cxx11-cu129-x86_64-linux/metadata.jsonAdded+15