code: def remove_left_padding(
      input_ids_sample: torch.Tensor, tokenizer: PreTrainedTokenizer
  ):
      """Removes left padding and other tokens until the first BOS token from the input_ids tensor.
  
      Args:
          input_ids_sample (torch.Tensor): The input tensor with padding and other tokens.
          tokenizer (PreTrainedTokenizer): The tokenizer used to encode the input.
  
      Returns:
          torch.Tensor: The input tensor without left padding and other tokens until the first BOS token.
  
      Example:
          >>> import torch
          >>> from transformers import PreTrainedTokenizer
          >>> tokenizer = PreTrainedTokenizer.from_pretrained('bert-base-uncased')
          >>> input_sentence = "This is an example sentence."
          >>> input_ids = tokenizer.encode(input_sentence, add_special_tokens=True)
          >>> padded_input_ids = torch.nn.functional.pad(input_ids, (10 - len(input_ids), 0))
          >>> input_ids_no_padding = remove_left_padding(padded_input_ids, tokenizer)
          >>> input_ids_no_padding
          tensor([[1, 2, 3]])
      """
      # Remove all PAD tokens
      pad_idxs = torch.where(
          input_ids_sample == tokenizer.pad_token_id
      )[
          0
      ]  # all PAD token locations
      input_ids_no_padding = input_ids_sample
      if len(pad_idxs) != 0:
          pad_idx = pad_idxs[-1]  # get last PAD token location
          input_ids_no_padding = input_ids_sample[pad_idx + 1 :]
  
      # Start from the first BOS token
      bos_idxs = torch.where(
          input_ids_no_padding == tokenizer.bos_token_id
      )[
          0
      ]  # all BOS token locations
      if len(bos_idxs) != 0:
          bos_idx = bos_idxs[0]  # get first BOS token location
      else:
          bos_idx = 0
  
      input_ids_no_bos = input_ids_no_padding[bos_idx:].unsqueeze(0)
      return input_ids_no_bos
  
imports: import copy
  import logging
  import tempfile
  from typing import Dict, Optional, Tuple, TYPE_CHECKING, Union
  import torch
  import torch.nn.functional
  import transformers
  from bitsandbytes.nn.modules import Embedding
  from packaging import version
  from transformers import AutoConfig, AutoModelForCausalLM, PreTrainedModel, PreTrainedTokenizer, TextStreamer
  from ludwig.constants import IGNORE_INDEX_TOKEN_ID, LOGITS, PREDICTIONS, PROBABILITIES
  from ludwig.schema.trainer import LLMTrainerConfig
  from ludwig.utils.error_handling_utils import default_retry
  from ludwig.utils.logging_utils import log_once
  from ludwig.utils.model_utils import find_embedding_layer_with_path
label_desc: Use image node_id 6 for calling a global function with example usage: remove_left_padding(input_ids_sample, tokenizer) and returns: input_ids_no_bos