# network architecture
# encoder related
encoder: squeezeformer
encoder_conf:
    encoder_dim: 512
    output_size: 512    # dimension of attention
    attention_heads: 8
    num_blocks: 12      # the number of encoder blocks
    reduce_idx: 5
    recover_idx: 11
    feed_forward_expansion_factor: 4
    input_dropout_rate: 0.1
    feed_forward_dropout_rate: 0.1
    attention_dropout_rate: 0.1
    cnn_module_kernel: 31
    cnn_norm_type: batch_norm
    adaptive_scale: true
    normalize_before: false

# decoder related
decoder: bitransformer
decoder_conf:
    attention_heads: 8
    linear_units: 2048
    num_blocks: 3
    r_num_blocks: 3
    dropout_rate: 0.1
    positional_dropout_rate: 0.1
    self_attention_dropout_rate: 0.1
    src_attention_dropout_rate: 0.1

# hybrid CTC/attention
model_conf:
    ctc_weight: 0.3
    lsm_weight: 0.1     # label smoothing option
    length_normalized_loss: false
    reverse_weight: 0.3

# dataset related
dataset_conf:
    syncbn: true
    filter_conf:
        max_length: 2000
        min_length: 50
        token_max_length: 400
        token_min_length: 1
        min_output_input_ratio: 0.0005
        max_output_input_ratio: 0.1
    resample_conf:
        resample_rate: 16000
    speed_perturb: true
    fbank_conf:
        num_mel_bins: 80
        frame_shift: 10
        frame_length: 25
        dither: 1.0
    spec_aug: true
    spec_aug_conf:
        num_t_mask: 3
        num_f_mask: 2
        max_t: 100
        max_f: 27
        max_w: 80
#        warp_for_time: true
    spec_sub: true
    spec_sub_conf:
        num_t_sub: 3
        max_t: 30
    shuffle: true
    shuffle_conf:
        shuffle_size: 1500
    sort: true
    sort_conf:
        sort_size: 500  # sort_size should be less than shuffle_size
    batch_conf:
        batch_type: 'static' # static or dynamic
        batch_size: 12

grad_clip: 5
accum_grad: 4
max_epoch: 120
log_interval: 100

optim: adamw
optim_conf:
    lr: 1.e-3
    weight_decay: 4.e-5

scheduler: NoamHoldAnnealing
scheduler_conf:
    warmup_ratio: 0.2
    hold_ratio: 0.3
    max_steps: 87960
    decay_rate: 1.0
    min_lr: 1.e-5

