lattice-finetune: !Experiment
  exp_global: !ExpGlobal
    dropout: 0.5
    default_layer_dim: 512
    save_num_checkpoints: 3
    loss_comb_method: avg
    model_file: models/{EXP}.mod
    placeholders:
			VOCAB_FILE_ES: <path>
			DATA_DIR: <path>
  model: !LoadSerialized
    filename: models/lattice-pretrain.mod
    path: model
    overwrite:
    - path: src_reader.text_input
      val: False
    - path: encoder.modules.1.modules.0.modules.0.child.probabilistic_masks
      val: True
    - path: encoder.modules.1.modules.1.modules.0.child.probabilistic_masks
      val: True
    - path: encoder.modules.1.modules.2.modules.0.child.probabilistic_masks
      val: True
  train: !SimpleTrainingRegimen
    trainer: !NoamTrainer
      alpha: 1.0
      warmup_steps: 4000
    update_every: 8
    lr_decay: 0.5
    lr_decay_times: 0
    patience: 15
    batcher: !WordSrcBatcher
      avg_batch_size: 128
    src_file: '{DATA_DIR}/fisher_train.es.xlat'
    trg_file: '{DATA_DIR}/fisher_train.en'
    dev_tasks:
      - !AccuracyEvalTask
        eval_metrics: bleu
        src_file: '{DATA_DIR}/fisher_dev.es.xlat'
        ref_file: '{DATA_DIR}/fisher_dev.en.0'
        hyp_file: '{EXP_DIR}/hyp/{EXP}.dev_hyp'
        inference: !AutoRegressiveInference
          batcher: !InOrderBatcher { batch_size: 1 }
          max_src_len: 50
          max_num_sents: 1000
          # no beam search for auxiliary tasks
          search_strategy: !BeamSearch
            max_len: 100
      - !LossEvalTask
        src_file: '{DATA_DIR}/fisher_dev.es.xlat'
        ref_file: '{DATA_DIR}/fisher_dev.en.0'
  evaluate:
    - !AccuracyEvalTask
      desc: ref
      eval_metrics: bleu
      src_file: '{DATA_DIR}/fisher_test.es'
      ref_file: '{DATA_DIR}/fisher_test.en.0'
      hyp_file: '{EXP_DIR}/hyp/{EXP}.eval_ref_hyp'
      model: !DefaultTranslator
        _xnmt_id: seq_translator
        src_reader: !LatticeReader
          vocab: !Vocab {vocab_file: '{VOCAB_FILE_ES}'}
          text_input: True
        trg_reader: !Ref { path: model.trg_reader }
        src_embedder: !Ref { path: model.src_embedder }
        encoder: !Ref { path: model.encoder }
        attender: !Ref { path: model.attender }
        trg_embedder: !Ref { path: model.trg_embedder }
        decoder: !Ref { path: model.decoder }
      inference: !AutoRegressiveInference
        batcher: !InOrderBatcher { batch_size: 1 }
        search_strategy: !BeamSearch
          max_len: 100
          beam_size: 8
    - !AccuracyEvalTask
      desc: asr
      eval_metrics: bleu
      src_file: '{DATA_DIR}/fisher_test.es'
      ref_file: '{DATA_DIR}/fisher_test.en.0'
      hyp_file: '{EXP_DIR}/hyp/{EXP}.eval_asr_hyp'
      model: !Ref { name: seq_translator }
      inference: !AutoRegressiveInference
        batcher: !InOrderBatcher { batch_size: 1 }
        search_strategy: !BeamSearch
          max_len: 100
          beam_size: 8
    - !AccuracyEvalTask
      desc: lattice
      eval_metrics: bleu
      src_file: '{DATA_DIR}/fisher_test.es.xlat'
      ref_file: '{DATA_DIR}/fisher_test.en.0'
      hyp_file: '{EXP_DIR}/hyp/{EXP}.eval_latt_hyp'
      inference: !AutoRegressiveInference
        batcher: !InOrderBatcher { batch_size: 1 }
        search_strategy: !BeamSearch
          max_len: 100
          beam_size: 8