code: def add_task_arguments(cls, parser: argparse.ArgumentParser):
      group = parser.add_argument_group(description="Task related")
  
      # NOTE(kamo): add_arguments(..., required=True) can't be used
      # to provide --print_config mode. Instead of it, do as
      # required = parser.get_default("required")
  
      group.add_argument(
          "--init",
          type=lambda x: str_or_none(x.lower()),
          default=None,
          help="The initialization method",
          choices=[
              "chainer",
              "xavier_uniform",
              "xavier_normal",
              "kaiming_uniform",
              "kaiming_normal",
              None,
          ],
      )
  
      group.add_argument(
          "--model_conf",
          action=NestedDictAction,
          default=get_default_kwargs(ESPnetExtractionModel),
          help="The keyword arguments for model class.",
      )
  
      group.add_argument(
          "--criterions",
          action=NestedDictAction,
          default=[
              {
                  "name": "si_snr",
                  "conf": {},
                  "wrapper": "fixed_order",
                  "wrapper_conf": {},
              },
          ],
          help="The criterions binded with the loss wrappers.",
      )
  
      group = parser.add_argument_group(
          description="Preprocess related"
      )
      group.add_argument(
          "--train_spk2enroll",
          type=str_or_none,
          default=None,
          help="The scp file containing the mapping from speakerID to enrollment\n"
          "(This is used to sample the target-speaker enrollment signal)",
      )
      group.add_argument(
          "--enroll_segment",
          type=int_or_none,
          default=None,
          help="Truncate the enrollment audio to the specified length if not None",
      )
      group.add_argument(
          "--load_spk_embedding",
          type=str2bool,
          default=False,
          help="Whether to load speaker embeddings instead of enrollments",
      )
      group.add_argument(
          "--load_all_speakers",
          type=str2bool,
          default=False,
          help="Whether to load target-speaker for all speakers in each sample",
      )
      # inherited from EnhPreprocessor
      group.add_argument(
          "--rir_scp",
          type=str_or_none,
          default=None,
          help="The file path of rir scp file.",
      )
      group.add_argument(
          "--rir_apply_prob",
          type=float,
          default=1.0,
          help="THe probability for applying RIR convolution.",
      )
      group.add_argument(
          "--noise_scp",
          type=str_or_none,
          default=None,
          help="The file path of noise scp file.",
      )
      group.add_argument(
          "--noise_apply_prob",
          type=float,
          default=1.0,
          help="The probability applying Noise adding.",
      )
      group.add_argument(
          "--noise_db_range",
          type=str,
          default="13_15",
          help="The range of signal-to-noise ratio (SNR) level in decibel.",
      )
      group.add_argument(
          "--short_noise_thres",
          type=float,
          default=0.5,
          help="If len(noise) / len(speech) is smaller than this threshold during "
          "dynamic mixing, a warning will be displayed.",
      )
      group.add_argument(
          "--speech_volume_normalize",
          type=str_or_none,
          default=None,
          help="Scale the maximum amplitude to the given value or range. "
          "e.g. --speech_volume_normalize 1.0 scales it to 1.0.\n"
          "--speech_volume_normalize 0.5_1.0 scales it to a random number in "
          "the range [0.5, 1.0)",
      )
      group.add_argument(
          "--use_reverberant_ref",
          type=str2bool,
          default=False,
          help="Whether to use reverberant speech references "
          "instead of anechoic ones",
      )
      group.add_argument(
          "--num_spk",
          type=int,
          default=1,
          help="Number of speakers in the input signal.",
      )
      group.add_argument(
          "--num_noise_type",
          type=int,
          default=1,
          help="Number of noise types.",
      )
      group.add_argument(
          "--sample_rate",
          type=int,
          default=8000,
          help="Sampling rate of the data (in Hz).",
      )
      group.add_argument(
          "--force_single_channel",
          type=str2bool,
          default=False,
          help="Whether to force all data to be single-channel.",
      )
      group.add_argument(
          "--channel_reordering",
          type=str2bool,
          default=False,
          help="Whether to randomly reorder the channels of the "
          "multi-channel signals.",
      )
      group.add_argument(
          "--categories",
          nargs="+",
          default=[],
          type=str,
          help="The set of all possible categories in the dataset. Used to add the "
          "category information to each sample",
      )
      group.add_argument(
          "--speech_segment",
          type=int_or_none,
          default=None,
          help="Truncate the audios (except for the enrollment) to the specified "
          "length if not None",
      )
      group.add_argument(
          "--avoid_allzero_segment",
          type=str2bool,
          default=True,
          help="Only used when --speech_segment is specified. If True, make sure "
          "all truncated segments are not all-zero",
      )
      group.add_argument(
          "--flexible_numspk",
          type=str2bool,
          default=False,
          help="Whether to load variable numbers of speakers in each sample. "
          "In this case, only the first-speaker files such as 'spk1.scp' and "
          "'dereverb1.scp' are used, which are expected to have multiple columns. "
          "Other numbered files such as 'spk2.scp' and 'dereverb2.scp' are ignored.",
      )
  
      for class_choices in cls.class_choices_list:
          # Append --<name> and --<name>_conf.
          # e.g. --encoder and --encoder_conf
          class_choices.add_arguments(group)
  
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 1 for calling the TargetSpeakerExtractionTask obj's underlying member method code with example usage: obj.add_task_arguments(cls, parser) without return types