paddlespeech.t2s.models.tacotron2.tacotron2_updater module

class paddlespeech.t2s.models.tacotron2.tacotron2_updater.Tacotron2Evaluator(model: Layer, dataloader: DataLoader, use_masking: bool = True, use_weighted_masking: bool = False, bce_pos_weight: float = 5.0, loss_type: str = 'L1+L2', use_guided_attn_loss: bool = True, guided_attn_loss_sigma: float = 0.4, guided_attn_loss_lambda: float = 1.0, output_dir=None)[source]

Bases: StandardEvaluator

Attributes:
name

Methods

__call__([trainer])

Main action of the extention.

finalize(trainer)

Action that is executed when training is done.

initialize(trainer)

Action that is executed once to get the corect trainer state.

on_error(trainer, exc, tb)

Handles the error raised during training before finalization.

evaluate

evaluate_core

evaluate_core(batch)[source]
class paddlespeech.t2s.models.tacotron2.tacotron2_updater.Tacotron2Updater(model: Layer, optimizer: Optimizer, dataloader: DataLoader, init_state=None, use_masking: bool = True, use_weighted_masking: bool = False, bce_pos_weight: float = 5.0, loss_type: str = 'L1+L2', use_guided_attn_loss: bool = True, guided_attn_loss_sigma: float = 0.4, guided_attn_loss_lambda: float = 1.0, output_dir: Optional[Path] = None)[source]

Bases: StandardUpdater

Attributes:
updates_per_epoch

Number of updater per epoch, determined by the length of the dataloader.

Methods

new_epoch()

Start a new epoch.

read_batch()

Read a batch from the data loader, auto renew when data is exhausted.

set_state_dict(state_dict)

Set state dict for a Updater.

state_dict()

State dict of a Updater, model, optimizer and updater state are included.

update_core(batch)

A simple case for a training step.

load

save

update

update_core(batch)[source]

A simple case for a training step. Basic assumptions are: Single model; Single optimizer; A batch from the dataloader is just the input of the model; The model return a single loss, or a dict containing serval losses. Parameters updates at every batch, no gradient accumulation.