class_docstr: Wrapper class to load the vocoder trained with parallel_wavegan repo.
docstr: Initialize ParallelWaveGANPretrainedVocoder module.
docstr_tok: ["Initialize","ParallelWaveGANPretrainedVocoder","module","."]
code: def __init__(
      self,
      model_file: Union[Path, str],
      config_file: Optional[Union[Path, str]] = None,
  ):
      """Initialize ParallelWaveGANPretrainedVocoder module."""
      super().__init__()
      try:
          from parallel_wavegan.utils import load_model
      except ImportError:
          logging.error(
              "`parallel_wavegan` is not installed. "
              "Please install via `pip install -U parallel_wavegan`."
          )
          raise
      if config_file is None:
          dirname = os.path.dirname(str(model_file))
          config_file = os.path.join(dirname, "config.yml")
      with open(config_file) as f:
          config = yaml.load(f, Loader=yaml.Loader)
      self.fs = config["sampling_rate"]
      self.vocoder = load_model(model_file, config)
      if hasattr(self.vocoder, "remove_weight_norm"):
          self.vocoder.remove_weight_norm()
      self.normalize_before = False
      if hasattr(self.vocoder, "mean"):
          self.normalize_before = True
  
file_path: espnet/espnet2/tts/utils/parallel_wavegan_pretrained_vocoder.py
imports: import logging
  import os
  from pathlib import Path
  from typing import Optional, Union
  import torch
  import yaml
label_desc: Use image node_id 1 to create a new ParallelWaveGANPretrainedVocoder object from inherited base classes: torch.nn with example: obj = ParallelWaveGANPretrainedVocoder(model_file, config_file)