docstr: The class to convert the models from asteroid to AbsSeprator.
  
  Args:
      encoder_output_dim: input feature dimension, default=1 after the NullEncoder
      num_spk: number of speakers
      loss_type: loss type of enhancement
      model_name: Asteroid model names, e.g. ConvTasNet, DPTNet. Refers to
                  https://github.com/asteroid-team/asteroid/
                  blob/master/asteroid/models/__init__.py
      pretrained_path: the name of pretrained model from Asteroid in HF hub.
                       Refers to: https://github.com/asteroid-team/asteroid/
                       blob/master/docs/source/readmes/pretrained_models.md and
                       https://huggingface.co/models?filter=asteroid
      model_related_kwargs: more args towards each specific asteroid model.
docstr_tok: ["The","class","to","convert","the","models","from","asteroid","to","AbsSeprator",".","Args",":","encoder_output_dim",":","input","feature","dimension",",","default=1","after","the","NullEncoder","num_spk",":","number","of","speakers","loss_type",":","loss","type","of","enhancement","model_name",":","Asteroid","model","names",",","e.g",".","ConvTasNet",",","DPTNet",".","Refers","to","https",":","\/\/github.com\/asteroid-team\/asteroid\/","blob\/master\/asteroid\/models\/__init__.py","pretrained_path",":","the","name","of","pretrained","model","from","Asteroid","in","HF","hub",".","Refers","to",":","https",":","\/\/github.com\/asteroid-team\/asteroid\/","blob\/master\/docs\/source\/readmes\/pretrained_models.md","and","https",":","\/\/huggingface.co\/models","?","filter=asteroid","model_related_kwargs",":","more","args","towards","each","specific","asteroid","model","."]
code: def __init__(
      self,
      encoder_output_dim: int,
      model_name: str,
      num_spk: int,
      pretrained_path: str = "",
      loss_type: str = "si_snr",
      **model_related_kwargs,
  ):
      """The class to convert the models from asteroid to AbsSeprator.
  
      Args:
          encoder_output_dim: input feature dimension, default=1 after the NullEncoder
          num_spk: number of speakers
          loss_type: loss type of enhancement
          model_name: Asteroid model names, e.g. ConvTasNet, DPTNet. Refers to
                      https://github.com/asteroid-team/asteroid/
                      blob/master/asteroid/models/__init__.py
          pretrained_path: the name of pretrained model from Asteroid in HF hub.
                           Refers to: https://github.com/asteroid-team/asteroid/
                           blob/master/docs/source/readmes/pretrained_models.md and
                           https://huggingface.co/models?filter=asteroid
          model_related_kwargs: more args towards each specific asteroid model.
      """
      super(AsteroidModel_Converter, self).__init__()
  
      assert (
          encoder_output_dim == 1
      ), encoder_output_dim  # The input should in raw-wave domain.
  
      # Please make sure the installation of Asteroid.
      # https://github.com/asteroid-team/asteroid
      from asteroid import models
  
      model_related_kwargs = {
          k: None if v == "None" else v
          for k, v in model_related_kwargs.items()
      }
      # print('args:',model_related_kwargs)
  
      if pretrained_path:
          model = getattr(models, model_name).from_pretrained(
              pretrained_path
          )
          print("model_kwargs:", model_related_kwargs)
          if model_related_kwargs:
              warnings.warn(
                  "Pratrained model should get no args with %s"
                  % model_related_kwargs
              )
  
      else:
          model_name = getattr(models, model_name)
          model = model_name(**model_related_kwargs)
  
      self.model = model
      self._num_spk = num_spk
  
      self.loss_type = loss_type
      if loss_type != "si_snr":
          raise ValueError("Unsupported loss type: %s" % loss_type)
  
file_path: espnet/espnet2/enh/separator/asteroid_models.py
imports: import warnings
  from collections import OrderedDict
  from typing import Dict, Optional, Tuple
  import torch
  from espnet2.enh.separator.abs_separator import AbsSeparator
label_desc: Use image node_id 1 to create a new AsteroidModel_Converter object from inherited base classes: AbsSeparator with example: obj = AsteroidModel_Converter(encoder_output_dim, model_name, num_spk, pretrained_path, loss_type)