MCPcopy Create free account
hub / github.com/apple/axlearn / __init__

Method __init__

axlearn/common/bert.py:147–156  ·  view source on GitHub ↗
(self, cfg: Config, *, parent: Optional[Module])

Source from the content-addressed store, hash-verified

145 ignored_target_id: int = -100 # Value of target that should be ignored.
146
147 def __init__(self, cfg: Config, *, parent: Optional[Module]):
148 super().__init__(cfg, parent=parent)
149 cfg = self.config
150 if hasattr(cfg.inner_head, "input_dim"):
151 self._add_child("inner_head", cfg.inner_head.set(input_dim=cfg.input_dim))
152 else:
153 self._add_child("inner_head", cfg.inner_head.set(dim=cfg.input_dim))
154 self._add_child(
155 "transform", cfg.transform.set(input_dim=cfg.input_dim, output_dim=cfg.input_dim)
156 )
157
158 def _create_layer_parameter_specs(self) -> dict[str, ParameterSpec]:
159 cfg = self.config

Callers

nothing calls this directly

Calls 3

_add_childMethod · 0.80
__init__Method · 0.45
setMethod · 0.45

Tested by

no test coverage detected