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

Method __init__

axlearn/common/lora.py:412–428  ·  view source on GitHub ↗
(self, cfg: Config, *, parent: Module)

Source from the content-addressed store, hash-verified

410 adapter: LoraLinearAdapter.Config = LoraLinearAdapter.default_config()
411
412 def __init__(self, cfg: Config, *, parent: Module):
413 super().__init__(cfg, parent=parent) # Initiate the original linear layer.
414 cfg = self.config
415 self._add_child(
416 "layer",
417 cfg.layer.set(
418 input_dim=cfg.input_dim,
419 output_dim=cfg.output_dim,
420 ),
421 )
422 self._add_child(
423 "adapter",
424 cfg.adapter.set(
425 input_dim=cfg.input_dim,
426 output_dim=cfg.output_dim,
427 ),
428 )
429
430 def forward(self, x: Tensor) -> Tensor:
431 return self.layer(x) + self.adapter(x)

Callers 6

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 2

_add_childMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected