MCPcopy Create free account
hub / github.com/csuhan/OneLLM / __init__

Method __init__

model/components.py:11–26  ·  view source on GitHub ↗

Initialize the RMSNorm normalization layer. Args: dim (int): The dimension of the input tensor. eps (float, optional): A small value added to the denominator for numerical stability. Default is 1e-6. Attributes: e

(self, dim: int, eps: float = 1e-6)

Source from the content-addressed store, hash-verified

9
10 class RMSNorm(torch.nn.Module):
11 def __init__(self, dim: int, eps: float = 1e-6):
12 """
13 Initialize the RMSNorm normalization layer.
14
15 Args:
16 dim (int): The dimension of the input tensor.
17 eps (float, optional): A small value added to the denominator for numerical stability. Default is 1e-6.
18
19 Attributes:
20 eps (float): A small value added to the denominator for numerical stability.
21 weight (nn.Parameter): Learnable scaling parameter.
22
23 """
24 super().__init__()
25 self.eps = eps
26 self.weight = nn.Parameter(torch.ones(dim))
27
28 def _norm(self, x):
29 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected