specaug#
(s3prl.nn.specaug)
Specaug modules
- Authors:
Xuankai Chang 2021
ShampooWang, cornliu 2021
Leo 2022
ModelWithSpecaug#
- class s3prl.nn.specaug.ModelWithSpecaug(model: Module, **specaug_conf)[source][source]#
Bases:
Module
Insert a Specaug module in front of the input model
- Parameters:
model (torch.nn.Module) –
specaug_conf (dict) – the arguments for
SpecAug
- forward(x, x_len, **others)[source][source]#
The input
x
will be augmented with Specaug and feed into the followingmodel
- Parameters:
x (torch.FloatTensor) – (batch_size, seq_len, input_size)
x_len (torch.LongTensor) – (batch_size)
- Returns:
The exact returns as that of the
model
during initialization
SpecAug#
- class s3prl.nn.specaug.SpecAug(apply_time_warp: bool = True, time_warp_window: int = 5, time_warp_mode: str = 'bicubic', apply_freq_mask: bool = True, freq_mask_width_range: tuple = (0, 20), num_freq_mask: int = 2, apply_time_mask: bool = True, time_mask_width_range: tuple = (0, 100), num_time_mask: int = 2, adaptive_number_ratio: float = 0.04, adaptive_size_ratio: float = 0.04, max_n_time_masks: int = 20, adaptive: bool = False)[source][source]#
Bases:
Module