class_docstr: Represents an abstract base class for sequence-to-text converters.
class_docstr_tok: ["Represents","an","abstract","base","class","for","sequence-to-text","converters","."]
docstr: :param generator:
      The sequence-to-sequence generator.
  :param tokenizer:
      The text tokenizer.
  :param task:
      The conversion task (e.g. translation, transcription).
  :param target_lang:
      The target language for conversion.
docstr_tok: [":","param","generator",":","The","sequence-to-sequence","generator",".",":","param","tokenizer",":","The","text","tokenizer",".",":","param","task",":","The","conversion","task","(","e.g",".","translation",",","transcription",")",".",":","param","target_lang",":","The","target","language","for","conversion","."]
code: def __init__(
      self,
      generator: Seq2SeqGenerator,
      tokenizer: TextTokenizer,
      task: str,
      target_lang: Optional[str] = None,
  ) -> None:
      """
      :param generator:
          The sequence-to-sequence generator.
      :param tokenizer:
          The text tokenizer.
      :param task:
          The conversion task (e.g. translation, transcription).
      :param target_lang:
          The target language for conversion.
      """
      self.generator = generator
  
      device = infer_device(generator.model)
  
      target_text_encoder = tokenizer.create_encoder(
          task=task, lang=target_lang, mode="target", device=device
      )
  
      # (S)
      target_prefix_seq = target_text_encoder.prefix_indices
      if target_prefix_seq is None:
          raise ValueError(
              "`tokenizer` must specify a prefix sequence for the target language."
          )
  
      self.target_prefix_seq = target_prefix_seq
  
      self.text_decoder = tokenizer.create_decoder()
  
imports: from abc import ABC
  from typing import List, Optional, Sequence, Tuple, final
  from torch import Tensor
  from fairseq2.data import StringLike
  from fairseq2.data.text import TextTokenDecoder, TextTokenEncoder, TextTokenizer
  from fairseq2.generation.generator import Seq2SeqGenerator, Seq2SeqGeneratorOutput, SequenceGenerator, SequenceGeneratorOutput
  from fairseq2.nn.padding import PaddingMask, pad_seqs
  from fairseq2.nn.utils.module import infer_device
label_desc: Use image node_id 1 to create a new SequenceToTextConverterBase object from inherited base classes: ABC with example: obj = SequenceToTextConverterBase(generator, tokenizer, task, target_lang)