# Stage 1 Smoke Config: FastConformer Hybrid CTC+RNNT on tiny subset
# Purpose: Validate training pipeline end-to-end before scaling up
# Expected: ~50-200 steps, <5 min on single GPU

name: maya-asr-stage1-smoke

trainer:
  devices: 1
  num_nodes: 1
  accelerator: gpu
  strategy: auto
  precision: bf16-mixed
  max_steps: 100
  val_check_interval: 50
  accumulate_grad_batches: 1
  gradient_clip_val: 1.0
  log_every_n_steps: 10
  enable_checkpointing: false
  default_root_dir: experiments/stage1_smoke

model:
  model_defaults:
    asr_enc_hidden: 256
    enc_hidden: 256
    dec_hidden: 256
    pred_hidden: 256

  preprocessor:
    _target_: nemo.collections.asr.modules.AudioToMelSpectrogramPreprocessor
    sample_rate: 16000
    normalize: per_feature
    window_size: 0.025
    window_stride: 0.01
    features: 80
    n_fft: 512
    dither: 0.00001

  encoder:
    _target_: nemo.collections.asr.modules.ConformerEncoder
    feat_in: 80
    n_layers: 4
    d_model: ${model.model_defaults.enc_hidden}
    subsampling: dw_striding
    subsampling_factor: 8
    subsampling_conv_channels: 256
    ff_expansion_factor: 4
    self_attention_model: rel_pos
    n_heads: 4
    conv_kernel_size: 9
    dropout: 0.1
    dropout_pre_encoder: 0.1
    dropout_emb: 0.0

  decoder:
    _target_: nemo.collections.asr.modules.RNNTDecoder
    prednet:
      pred_hidden: ${model.model_defaults.pred_hidden}
      pred_rnn_layers: 1
      dropout: 0.1

  joint:
    _target_: nemo.collections.asr.modules.RNNTJoint
    jointnet:
      joint_hidden: 256
      activation: relu
      dropout: 0.1
      encoder_hidden: ${model.model_defaults.enc_hidden}
      pred_hidden: ${model.model_defaults.pred_hidden}

  loss:
    loss_name: default
    warprnnt_numba_kwargs:
      fastemit_lambda: 0.0

  decoding:
    strategy: greedy_batch
    greedy:
      max_symbols_per_step: 10
      loop_labels: true
      use_cuda_graph_decoder: false

  # Auxiliary CTC decoder (required for hybrid model)
  aux_ctc:
    ctc_loss_weight: 0.3
    use_cer: false
    decoder:
      _target_: nemo.collections.asr.modules.ConvASRDecoder
      feat_in: null
      num_classes: -1

  tokenizer:
    dir: tokenizers/smoke_bpe
    type: bpe

  train_ds:
    manifest_filepath: data/manifests/smoke_train.jsonl
    # For multi-corpus training, replace manifest_filepath with:
    #   input_cfg: configs/data/stage1_smoke_input_cfg.yaml
    # Auto-generated by preflight; metadata at configs/data/input_cfg_metadata.json
    batch_size: 4
    shuffle: true
    num_workers: 2
    max_duration: 20.0
    min_duration: 0.5
    sample_rate: 16000
    trim_silence: false

  validation_ds:
    manifest_filepath: data/manifests/smoke_val.jsonl
    batch_size: 4
    shuffle: false
    num_workers: 2
    sample_rate: 16000

  optim:
    name: adamw
    lr: 0.001
    betas: [0.9, 0.98]
    weight_decay: 0.0001
    sched:
      name: CosineAnnealing
      warmup_steps: 10
      min_lr: 0.0001

exp_manager:
  exp_dir: experiments/stage1_smoke
  name: smoke_run
  create_tensorboard_logger: true
  create_wandb_logger: false
  resume_if_exists: false
  resume_ignore_no_checkpoint: true
  create_checkpoint_callback: true
  checkpoint_callback_params:
    monitor: val_loss
    mode: min
    save_top_k: 1
    every_n_epochs: 1
