class_docstr: Base class of Adapter Modules, providing common functionality to all Adapter Modules.
class_docstr_tok: ["Base","class","of","Adapter","Modules",",","providing","common","functionality","to","all","Adapter","Modules","."]
docstr: Setup adapter strategy of this class, enabling dynamic change in the way the adapter output is
  merged with the input.
  
  When called successfully, will assign the variable `adapter_strategy` to the module.
  
  Args:
      adapter_strategy: Can be a None or an implementation of AbstractAdapterStrategy.
docstr_tok: ["Setup","adapter","strategy","of","this","class",",","enabling","dynamic","change","in","the","way","the","adapter","output","is","merged","with","the","input",".","When","called","successfully",",","will","assign","the","variable","`","adapter_strategy","`","to","the","module",".","Args",":","adapter_strategy",":","Can","be","a","None","or","an","implementation","of","AbstractAdapterStrategy","."]
code: def setup_adapter_strategy(
      self,
      adapter_strategy: Optional[
          adapter_mixin_strategies.AbstractAdapterStrategy
      ],
  ):
      """
      Setup adapter strategy of this class, enabling dynamic change in the way the adapter output is
      merged with the input.
  
      When called successfully, will assign the variable `adapter_strategy` to the module.
  
      Args:
          adapter_strategy: Can be a None or an implementation of AbstractAdapterStrategy.
      """
      # set default adapter strategy
      if adapter_strategy is None:
          adapter_strategy = self.get_default_strategy_config()
  
      if is_dataclass(adapter_strategy):
          adapter_strategy = OmegaConf.structured(adapter_strategy)
          OmegaConf.set_struct(adapter_strategy, False)
  
      # The config must have the `_target_` field pointing to the actual adapter strategy class
      # which will load that strategy dynamically to this module.
      if isinstance(adapter_strategy, dict) or OmegaConf.is_config(
          adapter_strategy
      ):
          self.adapter_strategy = instantiate(adapter_strategy)
      elif isinstance(
          adapter_strategy,
          adapter_mixin_strategies.AbstractAdapterStrategy,
      ):
          self.adapter_strategy = adapter_strategy
      else:
          raise AttributeError(
              f"`adapter_strategy` provided is invalid : {adapter_strategy}"
          )
  
file_path: NeMo/nemo/collections/common/parts/adapter_modules.py
imports: from dataclasses import dataclass, field, is_dataclass
  from typing import Any, Optional
  from hydra.utils import instantiate
  from omegaconf import OmegaConf
  from torch import nn
  from nemo.collections.common.parts.utils import activation_registry
  from nemo.core.classes.mixins import access_mixins, adapter_mixin_strategies
label_desc: Use image node_id 1 for calling the AdapterModuleUtil obj's underlying member method code with example usage: obj.setup_adapter_strategy(adapter_strategy) without return types