class_docstr: Torchscript-enabled version of preprocessing done by SequenceFeatureMixin.add_feature_data.
code: def _process_sequence(self, sequence: str) -> torch.Tensor:
      sequence = (
          self.computed_fill_value if sequence == "nan" else sequence
      )
  
      # If tokenizer is HF, we defer lowercase transformation to the tokenizer.
      if self.lowercase and self.tokenizer_type != "hf_tokenizer":
          sequence_str: str = sequence.lower()
      else:
          sequence_str: str = sequence
  
      sequence_vector = torch.full(
          [self.max_sequence_length],
          self.unit_to_id[self.padding_symbol],
      )
  
      if self.tokenizer_type == "hf_tokenizer":
          # Handles start, stop, and unknown symbols implicitly
          unit_sequence = self.tokenizer(sequence)
          assert torch.jit.isinstance(unit_sequence, List[int])
          # Ensures that the sequence lengths are aligned between the input and output tensors.
          sequence_length = min(
              len(unit_sequence), self.max_sequence_length
          )
          sequence_vector[:sequence_length] = torch.tensor(
              unit_sequence
          )[:sequence_length]
          return sequence_vector
  
      # If tokenizer is not HF, we manually convert tokens to IDs and insert start, stop, and unknown symbols.
      unit_sequence = self.tokenizer(sequence_str)
      assert torch.jit.isinstance(unit_sequence, List[str])
  
      sequence_vector[0] = self.unit_to_id[self.start_symbol]
      if len(unit_sequence) + 1 < self.max_sequence_length:
          sequence_length = len(unit_sequence)
          sequence_vector[len(unit_sequence) + 1] = self.unit_to_id[
              self.stop_symbol
          ]
      else:
          sequence_length = self.max_sequence_length - 1
  
      for i in range(sequence_length):
          curr_unit = unit_sequence[i]
          if curr_unit in self.unit_to_id:
              curr_id = self.unit_to_id[curr_unit]
          else:
              curr_id = self.unit_to_id[self.unknown_symbol]
          sequence_vector[i + 1] = curr_id
      return sequence_vector
  
imports: import logging
  from functools import partial
  from typing import Dict, List, Union
  import numpy
  import torch
  from ludwig.constants import COLUMN, LAST_PREDICTIONS, LENGTHS, NAME, PREDICTIONS, PROBABILITIES, PROBABILITY, PROC_COLUMN, SEQUENCE
  from ludwig.features.base_feature import BaseFeatureMixin, InputFeature, OutputFeature, PredictModule
  from ludwig.features.feature_utils import compute_sequence_probability, compute_token_probabilities
  from ludwig.schema.features.sequence_feature import SequenceInputFeatureConfig, SequenceOutputFeatureConfig
  from ludwig.types import FeatureMetadataDict, FeaturePostProcessingOutputDict, ModelConfigDict, PreprocessingConfigDict, TrainingSetMetadataDict
  from ludwig.utils import output_feature_utils
  from ludwig.utils.math_utils import softmax
  from ludwig.utils.strings_utils import build_sequence_matrix, create_vocabulary, SpecialSymbol, START_SYMBOL, STOP_SYMBOL, UNKNOWN_SYMBOL
  from ludwig.utils.tokenizers import get_tokenizer_from_registry
  from ludwig.utils.types import TorchscriptPreprocessingInput
label_desc: Use image node_id 3 for calling the _SequencePreprocessing obj's underlying member method code with example usage: obj._process_sequence(sequence) and returns: sequence_vector, sequence_vector