class_docstr: Completes text prompts.
class_docstr_tok: ["Completes","text","prompts","."]
docstr: :param generator:
      The sequence generator.
  :param tokenizer:
      The text tokenizer.
docstr_tok: [":","param","generator",":","The","sequence","generator",".",":","param","tokenizer",":","The","text","tokenizer","."]
code: def __init__(
      self, generator: SequenceGenerator, tokenizer: TextTokenizer
  ) -> None:
      """
      :param generator:
          The sequence generator.
      :param tokenizer:
          The text tokenizer.
      """
      self.generator = generator
  
      device = infer_device(generator.model)
  
      self.text_encoder = tokenizer.create_encoder(
          mode="prompt", device=device
      )
      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 TextCompleter object  with example: obj = TextCompleter(generator, tokenizer)