code: def train(
      adapter: str = AudioAdapterOption,
      data: str = TrainingDataDirectoryOption,
      params_filename: str = ModelParametersOption,
      verbose: bool = VerboseOption,
  ) -> None:
      """
      Train a source separation model
      """
      import tensorflow as tf  # type: ignore
  
      from .audio.adapter import AudioAdapter
      from .dataset import get_training_dataset, get_validation_dataset
      from .model import model_fn
      from .model.provider import ModelProvider
      from .utils.configuration import load_configuration
  
      configure_logger(verbose)
      audio_adapter = AudioAdapter.get(adapter)
      params = load_configuration(params_filename)
      session_config = tf.compat.v1.ConfigProto()
      session_config.gpu_options.per_process_gpu_memory_fraction = 0.45
      estimator = tf.estimator.Estimator(
          model_fn=model_fn,
          model_dir=params["model_dir"],
          params=params,
          config=tf.estimator.RunConfig(
              save_checkpoints_steps=params["save_checkpoints_steps"],
              tf_random_seed=params["random_seed"],
              save_summary_steps=params["save_summary_steps"],
              session_config=session_config,
              log_step_count_steps=10,
              keep_checkpoint_max=2,
          ),
      )
      input_fn = partial(
          get_training_dataset, params, audio_adapter, data
      )
      train_spec = tf.estimator.TrainSpec(
          input_fn=input_fn, max_steps=params["train_max_steps"]
      )
      input_fn = partial(
          get_validation_dataset, params, audio_adapter, data
      )
      evaluation_spec = tf.estimator.EvalSpec(
          input_fn=input_fn,
          steps=None,
          throttle_secs=params["throttle_secs"],
      )
      logger.info("Start model training")
      tf.estimator.train_and_evaluate(
          estimator, train_spec, evaluation_spec
      )
      ModelProvider.writeProbe(params["model_dir"])
      logger.info("Model training done")
  
file_path: spleeter/spleeter/__main__.py
imports: import json
  from functools import partial
  from glob import glob
  from itertools import product
  from os.path import join
  from typing import Dict, List, Optional, Tuple
  from typer import Exit, Typer
  from .None import SpleeterError
  from .audio import Codec
  from .options import AudioAdapterOption, AudioBitrateOption, AudioCodecOption, AudioDurationOption, AudioInputArgument, AudioInputOption, AudioOffsetOption, AudioOutputOption, FilenameFormatOption, ModelParametersOption, MUSDBDirectoryOption, MWFOption, TrainingDataDirectoryOption, VerboseOption, VersionOption
  from .utils.logging import configure_logger, logger
label_desc: Use image node_id 2 for calling a global function with example usage: train(adapter, data, params_filename, verbose) without return types