docstr: Unpacks the swappable_components, then forwards the call up the MRO chain.
docstr_tok: ["Unpacks","the","swappable_components",",","then","forwards","the","call","up","the","MRO","chain","."]
code: def __init__(
      self,
      *args,
      subcomponents: Optional[SwappableSubcomponents] = None,
      **kwargs,
  ):
      """
      Unpacks the swappable_components, then forwards the call up the MRO chain.
      """
      self.swappables = (
          subcomponents or type(self).SwappableSubcomponents()
      )
      assert (
          type(self.swappables)
          is not ModularComponent.SwappableSubcomponents
      ), "Modular components must declare their own SwappableSubcomponents"
      super().__init__(*args, **kwargs)
  
file_path: ParlAI/parlai/agents/transformer/modules/modular.py
imports: from __future__ import annotations
  from dataclasses import dataclass
  from typing import Any, Callable, Dict, Generic, Optional, Type, TypeVar
label_desc: Use image node_id 2 to create a new ModularComponent object from inherited base classes: Generic with example: obj = ModularComponent()