code: def forward(
      self,
      inputs: List[torch.Tensor],
      input_lengths: List[int],
      max_new_tokens: int,
  ):
      # Extract the sequences tensor from the LLMs forward pass
      generated_outputs = extract_generated_tokens(
          raw_generated_output_sequences=inputs,
          input_lengths=input_lengths,
          max_new_tokens=max_new_tokens,
          pad_sequence=True,
      )
      # Stack the predictions for each example in the batch. The padding should ensure they are all the same shape.
      for output in generated_outputs:
          if output.shape[0] > max_new_tokens:
              raise ValueError(
                  f"Output {output} is longer than the max_new_tokens {max_new_tokens} during decoding. "
                  f"This should never happen– please file an issue on GitHub."
              )
  
      generated_outputs = torch.stack(generated_outputs, dim=0)
      outputs_device = generated_outputs.device
  
      return {
          PREDICTIONS: generated_outputs,
          # TODO(Arnav): Add support for probabilities and logits
          PROBABILITIES: torch.zeros(
              (
                  len(generated_outputs),
                  max_new_tokens,
                  self.tokenizer_vocab_size,
              )
          ).to(outputs_device),
          LOGITS: torch.zeros(
              (
                  len(generated_outputs),
                  max_new_tokens,
                  self.tokenizer_vocab_size,
              )
          ).to(outputs_device),
      }
  
imports: import logging
  import re
  from typing import Any, Dict, List, Union
  import torch
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import CATEGORY, LOGITS, PREDICTIONS, PROBABILITIES, TEXT
  from ludwig.decoders.base import Decoder
  from ludwig.decoders.registry import register_decoder
  from ludwig.decoders.utils import extract_generated_tokens
  from ludwig.schema.decoders.llm_decoders import CategoryExtractorDecoderConfig, TextExtractorDecoderConfig
  from ludwig.utils.strings_utils import get_tokenizer
label_desc: Use image node_id 5 for calling the TextExtractorDecoder obj's underlying member method code with example usage: obj.forward(inputs, input_lengths, max_new_tokens) and returns: dict