subaligner.trainer module

class subaligner.trainer.Trainer(feature_embedder: subaligner.embedder.FeatureEmbedder)[source]

Bases: object

Network trainer.

EMBEDDING_TIMEOUT = 300
static get_done_epochs(training_log: str) → int[source]

Get the number of finished epochs.

Parameters

{string} -- The path to the training log file. (training_log) –

pre_train(av_file_paths: List[str], subtitle_file_paths: List[str], training_dump_dir: str, hyperparameters: subaligner.hyperparameters.Hyperparameters, sound_effect_start_marker: Optional[str, None] = None, sound_effect_end_marker: Optional[str, None] = None) → Tuple[List[float], List[float]][source]

Trigger the training process.

Parameters
  • {list} -- A list of paths to the input audio/video files. (av_file_paths) –

  • {list} -- A list of paths to the subtitle files. (subtitle_file_paths) –

  • {string} -- The directory of the training data dump file. (training_dump_dir) –

  • {Hyperparameters} -- A configuration for hyperparameters used for training. (hyperparameters) –

  • sound_effect_start_marker – {string} – A string indicating the start of the ignored sound effect (default: {“(“}).

  • sound_effect_end_marker – {string} – A string indicating the end of the ignored sound effect (default: {“)”}).

train(av_file_paths: List[str], subtitle_file_paths: List[str], model_dir: str, weights_dir: str, config_dir: str, logs_dir: str, training_dump_dir: str, hyperparameters: subaligner.hyperparameters.Hyperparameters, training_log: str = 'training.log', resume: bool = False, sound_effect_start_marker: Optional[str, None] = None, sound_effect_end_marker: Optional[str, None] = None) → None[source]

Trigger the training process.

Parameters
  • {list} -- A list of paths to the input audio/video files. (av_file_paths) –

  • {list} -- A list of paths to the subtitle files. (subtitle_file_paths) –

  • {string} -- The directory of the model file. (model_dir) –

  • {string} -- The directory of the weights file. (weights_dir) –

  • {string} -- The directory of the hyperparameter file where hyperparameters will be saved. (config_dir) –

  • {string} -- The directory of the log file. (logs_dir) –

  • {string} -- The directory of the training data dump file. (training_dump_dir) –

  • {Hyperparameters} -- A configuration for hyperparameters used for training. (hyperparameters) –

  • {string} -- The path to the log file of epoch results (default (training_log) – {“training.log”}).

  • {bool} -- True to continue with previous training result or False to start a new one (default (resume) – {False}).

  • sound_effect_start_marker – {string} – A string indicating the start of the ignored sound effect (default: {“(“}).

  • sound_effect_end_marker – {string} – A string indicating the end of the ignored sound effect (default: {“)”}).