class_docstr: Base `vc` class. Every new `vc` model must inherit this.
  
  It defines common `vc` specific functions on top of `Model` implementation.
class_docstr_tok: ["Base","`","vc","`","class",".","Every","new","`","vc","`","model","must","inherit","this",".","It","defines","common","`","vc","`","specific","functions","on","top","of","`","Model","`","implementation","."]
docstr: Save the speaker.pth and language_ids.json at the beginning of the training. Also update both paths.
docstr_tok: ["Save","the","speaker.pth","and","language_ids.json","at","the","beginning","of","the","training",".","Also","update","both","paths","."]
code: def on_init_start(self, trainer):
      """Save the speaker.pth and language_ids.json at the beginning of the training. Also update both paths."""
      if self.speaker_manager is not None:
          output_path = os.path.join(
              trainer.output_path, "speakers.pth"
          )
          self.speaker_manager.save_ids_to_file(output_path)
          trainer.config.speakers_file = output_path
          # some models don't have `model_args` set
          if hasattr(trainer.config, "model_args"):
              trainer.config.model_args.speakers_file = output_path
          trainer.config.save_json(
              os.path.join(trainer.output_path, "config.json")
          )
          print(f" > `speakers.pth` is saved to {output_path}.")
          print(" > `speakers_file` is updated in the config.json.")
  
      if self.language_manager is not None:
          output_path = os.path.join(
              trainer.output_path, "language_ids.json"
          )
          self.language_manager.save_ids_to_file(output_path)
          trainer.config.language_ids_file = output_path
          if hasattr(trainer.config, "model_args"):
              trainer.config.model_args.language_ids_file = output_path
          trainer.config.save_json(
              os.path.join(trainer.output_path, "config.json")
          )
          print(f" > `language_ids.json` is saved to {output_path}.")
          print(" > `language_ids_file` is updated in the config.json.")
  
imports: import os
  import random
  from typing import Dict, List, Tuple, Union
  import torch
  import torch.distributed
  from coqpit import Coqpit
  from torch import nn
  from torch.utils.data import DataLoader
  from torch.utils.data.sampler import WeightedRandomSampler
  from trainer.torch import DistributedSampler, DistributedSamplerWrapper
  from TTS.model import BaseTrainerModel
  from TTS.tts.datasets.dataset import TTSDataset
  from TTS.tts.utils.data import get_length_balancer_weights
  from TTS.tts.utils.languages import LanguageManager, get_language_balancer_weights
  from TTS.tts.utils.speakers import SpeakerManager, get_speaker_balancer_weights
  from TTS.tts.utils.synthesis import synthesis
  from TTS.tts.utils.visual import plot_alignment, plot_spectrogram
label_desc: Use image node_id 11 for calling the BaseVC obj's underlying member method code with example usage: obj.on_init_start(trainer) without return types