code: def compute_length_splits(
      length_col: NDArray[np.int32], max_tokens: int
  ) -> List[NDArray[np.int32]]:
      """split sequence of length_col in the chunks such that total length is ~ max_tokens
          countint the padding to max length of elements in a chunk
  
      Args:
          length_col (np.ndarray):
          max_tokens (int):
  
      Returns:
          List[np.ndarray]: splits that contain indices over the original length_col
      """
      argsort_ind = np.argsort(length_col)
      # TODO: remove 0 lengths
      sorted_length_col = length_col[argsort_ind]
  
      splits = []
      ptr = 0
      for i, length in enumerate(sorted_length_col):
          if length * (i - ptr) > max_tokens:
              splits.append(argsort_ind[ptr : (i - 1)])
              ptr = i - 1
      if (
          length <= max_tokens
      ):  # we drop the last iteration if it results in a batch greater than max_tokens
          splits.append(argsort_ind[ptr:])
      return splits
  
imports: from contextlib import contextmanager
  from typing import Dict, Generator, List, Optional, Union
  import numpy
  import pandas
  import pyarrow
  import pyarrow.parquet
  import torch
  from numpy.typing import NDArray
  from pyarrow.dataset import get_partition_keys
  from fairseq2.data import CString
  from fairseq2.data.data_pipeline import DataPipeline, DataPipelineBuilder, read_sequence
label_desc: Use image node_id 12 for calling a global function with example usage: compute_length_splits(length_col, max_tokens) and returns: splits