code: def build_model(
      cls, args: argparse.Namespace
  ) -> ESPnetExtractionModel:
      assert check_argument_types()
  
      encoder = encoder_choices.get_class(args.encoder)(
          **args.encoder_conf
      )
      extractor = extractor_choices.get_class(args.extractor)(
          encoder.output_dim, **args.extractor_conf
      )
      decoder = decoder_choices.get_class(args.decoder)(
          **args.decoder_conf
      )
  
      loss_wrappers = []
  
      if getattr(args, "criterions", None) is not None:
          # This check is for the compatibility when load models
          # that packed by older version
          for ctr in args.criterions:
              criterion_conf = ctr.get("conf", {})
              criterion = criterion_choices.get_class(ctr["name"])(
                  **criterion_conf
              )
              loss_wrapper = loss_wrapper_choices.get_class(
                  ctr["wrapper"]
              )(criterion=criterion, **ctr["wrapper_conf"])
              loss_wrappers.append(loss_wrapper)
  
      # 1. Build model
      model = ESPnetExtractionModel(
          encoder=encoder,
          extractor=extractor,
          decoder=decoder,
          loss_wrappers=loss_wrappers,
          **args.model_conf,
      )
  
      # FIXME(kamo): Should be done in model?
      # 2. Initialize
      if args.init is not None:
          initialize(model, args.init)
  
      assert check_return_type(model)
      return model
  
imports: import argparse
  from typing import Callable, Collection, Dict, List, Optional, Tuple
  import numpy
  import torch
  from typeguard import check_argument_types, check_return_type
  from espnet2.enh.espnet_model_tse import ESPnetExtractionModel
  from espnet2.enh.extractor.abs_extractor import AbsExtractor
  from espnet2.enh.extractor.td_speakerbeam_extractor import TDSpeakerBeamExtractor
  from espnet2.tasks.abs_task import AbsTask
  from espnet2.tasks.enh import criterion_choices, decoder_choices, encoder_choices, loss_wrapper_choices
  from espnet2.torch_utils.initialize import initialize
  from espnet2.train.class_choices import ClassChoices
  from espnet2.train.collate_fn import CommonCollateFn
  from espnet2.train.preprocessor import AbsPreprocessor, TSEPreprocessor
  from espnet2.train.trainer import Trainer
  from espnet2.utils.get_default_kwargs import get_default_kwargs
  from espnet2.utils.nested_dict_action import NestedDictAction
  from espnet2.utils.types import int_or_none, str2bool, str_or_none
label_desc: Use image node_id 6 for calling the TargetSpeakerExtractionTask obj's underlying member method code with example usage: obj.build_model(cls, args) and returns: model