code: def get_raw_instance(document, max_sequence_length=512):
      """
      Get the initial training instances, split the whole segment into multiple parts according to the max_sequence_length, and return as multiple processed instances.
      :param document: document
      :param max_sequence_length:
      :return: a list. each element is a sequence of text
      """
      # document = self.documents[index]
      max_sequence_length_allowed = max_sequence_length - 2
      # document = [seq for seq in document if len(seq)<max_sequence_length_allowed]
      sizes = [len(seq) for seq in document]
  
      result_list = []
      curr_seq = []
      sz_idx = 0
      while sz_idx < len(sizes):
          if (
              len(curr_seq) + sizes[sz_idx]
              <= max_sequence_length_allowed
          ):  # or len(curr_seq)==0:
              curr_seq += document[sz_idx]
              sz_idx += 1
          elif sizes[sz_idx] >= max_sequence_length_allowed:
              if len(curr_seq) > 0:
                  result_list.append(curr_seq)
              curr_seq = []
              result_list.append(
                  document[sz_idx][:max_sequence_length_allowed]
              )
              sz_idx += 1
          else:
              result_list.append(curr_seq)
              curr_seq = []
  
      if len(curr_seq) > max_sequence_length_allowed / 2:  # /2
          result_list.append(curr_seq)
  
      # num_instance=int(len(big_list)/max_sequence_length_allowed)+1
      # print("num_instance:",num_instance)
  
      # result_list=[]
      # for j in range(num_instance):
      #     index=j*max_sequence_length_allowed
      #     end_index=index+max_sequence_length_allowed if j!=num_instance-1 else -1
      #     result_list.append(big_list[index:end_index])
      return result_list
  
file_path: colossalai/examples/community/roberta/preprocessing/tokenize_mask.py
imports: import argparse
  import multiprocessing
  import os
  import time
  from random import shuffle
  import h5py
  import numpy
  import psutil
  from get_mask import PreTrainingDataset
  from tqdm import tqdm
  from transformers import AutoTokenizer
label_desc: Use image node_id 1 for calling a global function with example usage: get_raw_instance(document, max_sequence_length) and returns: result_list