training_batch_wer fast growth from 0,9 to 200 model predict only "⁇" 
State: closed | Pull request: no
Labels: name: bug

I try perform steps from https://colab.research.google.com/github/NVIDIA/NeMo/blob/stable/tutorials/asr/ASR_with_Transducers.ipynb witn my own dataset. 

After 10% of first epoch i see in tensorboard fast growth training_batch_wer from from 0,9 to 200. 
![image](https://user-images.githubusercontent.com/8361949/156882650-b899bbaf-8c3c-4f7b-a223-69b1e25573b6.png)
![image](https://user-images.githubusercontent.com/8361949/156882655-88e4d233-3b79-4f6c-b7ea-29fa751f2d34.png)


When it happen i see in console weird predictions:
![image](https://user-images.githubusercontent.com/8361949/156880589-a2fae822-1bdb-416b-802b-805227f3c2da.png)









My data is calls with  sample_rate = 8000. My maximum train_ds.batch_size = 8, if I try somthing biger i get OOM error. 

**My train data**
[NeMo I 2022-03-05 16:36:45 mixins:146] Tokenizer SentencePieceTokenizer initialized with 1000 tokens
[NeMo I 2022-03-05 16:36:53 collections:173] Dataset loaded with 361193 files totalling 610.54 hours
[NeMo I 2022-03-05 16:36:53 collections:174] 38078 files were filtered totalling 208.93 hours
[NeMo I 2022-03-05 16:36:54 collections:173] Dataset loaded with 26211 files totalling 63.04 hours
[NeMo I 2022-03-05 16:36:54 collections:174] 0 files were filtered totalling 0.00 hours
[NeMo I 2022-03-05 16:36:54 collections:173] Dataset loaded with 435 files totalling 1.00 hours
[NeMo I 2022-03-05 16:36:54 collections:174] 0 files were filtered totalling 0.00 hours



**My config is:**
name: &name "ContextNet-8x-Stride-RNNT"

model:
  sample_rate: &sample_rate 8000
  compute_eval_loss: false  # eval samples can be very long and exhaust memory. Disable computation of transducer loss during validation/testing with this flag.

  train_ds:
    manifest_filepath: 'demo_kz/manifest_train.json'
    sample_rate: 8000
    batch_size: 8  # Can be increased if memory allows or when using smaller model
    trim_silence: false
    max_duration: 16.7
    shuffle: true
    use_start_end_token: false
    num_workers: 38
    pin_memory: true
    is_tarred: false
    tarred_audio_filepaths: null
    tarred_shard_strategy: "scatter"
    shuffle_n: 2048
    bucketing_strategy: "synced_randomized"
    bucketing_batch_size: null
    
  validation_ds:
    manifest_filepath: 'demo_kz/manifest_dev.json'
    sample_rate: 8000
    batch_size: 8
    shuffle: false
    use_start_end_token: false
    num_workers: 38
    pin_memory: true

  test_ds:
    manifest_filepath: 'demo_kz/manifest_test.json'
    sample_rate: 8000
    batch_size: 8
    shuffle: false
    use_start_end_token: false
    num_workers: 38
    pin_memory: true

  model_defaults:
    filters: 1024
    repeat: 5
    dropout: 0.1
    separable: true
    se: true
    se_context_size: -1
    kernel_size_factor: 1.0
    # encoder / decoder / joint values
    enc_hidden: 640
    pred_hidden: 640
    joint_hidden: 640

  tokenizer:
    dir: "demo_kz/tokenizer/dev/tokenizer_spe_unigram_v1000/"
    type: bpe

  preprocessor:
    _target_: nemo.collections.asr.modules.AudioToMelSpectrogramPreprocessor
    sample_rate: 8000
    normalize: "per_feature"
    window_size: 0.025
    window_stride: 0.01
    window: "hann"
    features: &n_mels 80
    n_fft: 512
    frame_splicing: 1
    dither: 0.00001
    pad_to: 16
    stft_conv: false

  spec_augment:
    _target_: nemo.collections.asr.modules.SpectrogramAugmentation
    freq_masks: 0  # should be kept at 2
    time_masks: 0  # can be 5 for small-med models, 10 for larger models.
    freq_width: 27
    time_width: 0.05

  encoder:
    _target_: nemo.collections.asr.modules.ConvASREncoder
    feat_in: *n_mels
    activation: swish
    conv_mask: true
    init_mode: "tds_uniform"

    jasper:
      - filters: 1024
        repeat: 1
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.0
        residual: false
        separable: true
        se: true
        se_context_size: -1

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [2]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        stride_last: true
        residual_mode: "stride_add"
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [2]  # *stride
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        stride_last: true
        residual_mode: "stride_add"
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [2]  # stride
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        stride_last: true
        residual_mode: "stride_add"
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 1024
        repeat: 5
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.1
        residual: true
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0

      - filters: 640
        repeat: 1
        kernel: [5]
        stride: [1]
        dilation: [1]
        dropout: 0.0
        residual: false
        separable: true
        se: true
        se_context_size: -1
        kernel_size_factor: 1.0


  decoder:
    _target_: nemo.collections.asr.modules.RNNTDecoder
    normalization_mode: null  # Currently only null is supported for export.
    random_state_sampling: false  # Random state sampling: https://arxiv.org/pdf/1910.11455.pdf
    blank_as_pad: true  # This flag must be set in order to support exporting of RNNT models + efficient inference.

    prednet:
      pred_hidden: 640
      pred_rnn_layers: 1  # only 1 layer LSTM networks are exportable.
      t_max: null  # Maximum possible target seq length used for Chrono Initialization - https://arxiv.org/abs/1804.11188. Disabled by default.
      dropout: 0.1

  joint:
    _target_: nemo.collections.asr.modules.RNNTJoint
    log_softmax: null  # sets it according to cpu/gpu device
    preserve_memory: false  # dramatically slows down training, but might preserve some memory

    fuse_loss_wer: true
    fused_batch_size: 4

    jointnet:
      joint_hidden: 640
      activation: "relu"
      dropout: 0.1

  decoding:
    strategy: "greedy_batch"  # can be greedy, greedy_batch, beam, tsd, alsd.

    greedy:
      max_symbols: 10

    beam:
      beam_size: 4
      score_norm: true
      return_best_hypothesis: False
      softmax_temperature: 1.0  # scale the logits by some temperature prior to softmax
      tsd_max_sym_exp: 10  # for Time Synchronous Decoding, int > 0
      alsd_max_target_len: 5.0  # for Alignment-Length Synchronous Decoding, float > 1.0
      maes_num_steps: 2  # for modified Adaptive Expansion Search, int > 0
      maes_prefix_alpha: 1  # for modified Adaptive Expansion Search, int > 0
      maes_expansion_beta: 2  # for modified Adaptive Expansion Search, int >= 0
      maes_expansion_gamma: 2.3  # for modified Adaptive Expansion Search, float >= 0

  loss:
    loss_name: "default"

    warprnnt_numba_kwargs:
      fastemit_lambda: 0.001  # Values can be in range [1e-4, 1e-2]. Generally, 0.001 is good start.
      clamp: -1.0  # if > 0, applies gradient clamping in range [-clamp, clamp] for the joint tensor only.

  optim:
    name: novograd
    lr: 0.05

    betas: [0.9, 0.0]
    weight_decay: 0.001

    sched:
      name: CosineAnnealing

      warmup_steps: null
      warmup_ratio: null
      min_lr: 1e-6
      last_epoch: -1

trainer:
  devices: 4 # number of gpus
  max_steps: null # computed at runtime if not set
  num_nodes: 1  # Should be set via SLURM variable `SLURM_JOB_NUM_NODES`
  accelerator: gpu
  strategy: ddp
  accumulate_grad_batches: 1
  enable_checkpointing: False  # Provided by exp_manager
  logger: false  # Provided by exp_manager
  log_every_n_steps: 100  # Interval of logging.
  val_check_interval: 1.0 # Set to 0.25 to check 4 times per epoch, or an int for number of iterations
  check_val_every_n_epoch: 1  # RNNT decoding is slower than CTC, so eval takes longer. Increase value to speed up training slightly.
  precision: 32  # RNNT requires a lot of memory, so precision 16 is very important. Use very small batch size for precision 32.
  gradient_clip_val: 1.0  # Gradient norm clip value
  sync_batchnorm: true
  benchmark: false


exp_manager:
  exp_dir: "/nemo/demo_kz/nemo_checkpoint/exp"
  name: *name
  create_tensorboard_logger: true
  create_checkpoint_callback: true
  checkpoint_callback_params:
    monitor: "val_wer"
    mode: "min"
    save_top_k: 3
    always_save_nemo: true
  create_wandb_logger: false
  wandb_logger_kwargs:
    name: null
    project: null
    entity: null
  resume_if_exists: false
  resume_ignore_no_checkpoint: false






**My python code:**

import nemo.collections.asr as nemo_asr
from ruamel.yaml import YAML
import gc
import torch
	
config_path = 'demo_kz/contextnet_rnnt2.yaml'

yaml = YAML(typ='safe')
with open(config_path) as f:
    params = yaml.load(f)

import pytorch_lightning as pl
from pytorch_lightning import loggers as pl_loggers
tb_logger = pl_loggers.TensorBoardLogger("/nemo/demo_kz/TensorBoard/", name = 'BPE_1000', version = 'ContextNet_1epoch2')

trainer = pl.Trainer(strategy='ddp', gpus=[0, 1, 2, 3], max_epochs=1, logger=tb_logger, precision=16)

from omegaconf import DictConfig
first_asr_model = nemo_asr.models.EncDecRNNTBPEModel(cfg=DictConfig(params['model']), trainer=trainer)

gc.collect()
torch.cuda.empty_cache()

trainer.fit(first_asr_model)

first_asr_model.save_to('demo_kz/checkpoint/ContextNet_1epoch_BPE_10002.nemo')







**I train my model on 4 Titan X server:**

![image](https://user-images.githubusercontent.com/8361949/156880354-7fe7ad34-0a1e-4635-b9a6-8f1b09acdf24.png)


- OS version: Ubuntu
- PyTorch version: torch==1.11.0a0+b6df043
- Python version:  Python 3.8.12
- Nemo: nemo-toolkit==1.5.1