class_docstr: Translation (Sequence Generation) task for Levenshtein Transformer
  See `"Levenshtein Transformer" <https://arxiv.org/abs/1905.11006>`_.
class_docstr_tok: ["Translation","(","Sequence","Generation",")","task","for","Levenshtein","Transformer","See","`","``","Levenshtein","Transformer","''","<","https",":","\/\/arxiv.org\/abs\/1905.11006",">","`","_","."]
code: def build_generator(self, models, args, **unused):
      # add models input to match the API for SequenceGenerator
      from fairseq.iterative_refinement_generator import (
          IterativeRefinementGenerator,
      )
  
      return IterativeRefinementGenerator(
          self.target_dictionary,
          eos_penalty=getattr(args, "iter_decode_eos_penalty", 0.0),
          max_iter=getattr(args, "iter_decode_max_iter", 10),
          beam_size=getattr(args, "iter_decode_with_beam", 1),
          reranking=getattr(
              args, "iter_decode_with_external_reranker", False
          ),
          decoding_format=getattr(args, "decoding_format", None),
          adaptive=not getattr(
              args, "iter_decode_force_max_iter", False
          ),
          retain_history=getattr(args, "retain_iter_history", False),
      )
  
file_path: fairseq/fairseq/tasks/translation_lev.py
imports: from dataclasses import dataclass, field
  import torch
  from fairseq import utils
  from fairseq.data import LanguagePairDataset
  from fairseq.dataclass import ChoiceEnum
  from fairseq.tasks import register_task
  from fairseq.tasks.translation import TranslationConfig, TranslationTask, load_langpair_dataset
  from fairseq.utils import new_arange
label_desc: Use image node_id 3 for calling the TranslationLevenshteinTask obj's underlying member method code with example usage: obj.build_generator(models, args) and returns: IterativeRefinementGenerator