MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT-LLM / __init__

Method __init__

tensorrt_llm/layers/normalization.py:308–330  ·  view source on GitHub ↗
(self,
                 embedding_dim: int,
                 norm_type: str = "layer_norm",
                 bias: bool = True,
                 mapping=Mapping(),
                 dtype=None)

Source from the content-addressed store, hash-verified

306class SD35AdaLayerNormZeroX(Module):
307
308 def __init__(self,
309 embedding_dim: int,
310 norm_type: str = "layer_norm",
311 bias: bool = True,
312 mapping=Mapping(),
313 dtype=None):
314 super().__init__()
315 self.silu = ACT2FN['silu']
316 self.linear = Linear(embedding_dim,
317 9 * embedding_dim,
318 bias=bias,
319 tp_group=mapping.tp_group,
320 tp_size=mapping.tp_size,
321 dtype=dtype)
322 if norm_type == "layer_norm":
323 self.norm = LayerNorm(embedding_dim,
324 elementwise_affine=False,
325 eps=1e-6,
326 dtype=dtype)
327 else:
328 raise ValueError(
329 f"Unsupported `norm_type` ({norm_type}) provided. Supported ones are: 'layer_norm'."
330 )
331
332 def forward(self, hidden_states: Tensor, emb: Tensor):
333 emb = self.linear(self.silu(emb).cast(hidden_states.dtype))

Callers

nothing calls this directly

Calls 4

MappingClass · 0.85
LinearClass · 0.70
LayerNormClass · 0.70
__init__Method · 0.45

Tested by

no test coverage detected