code: def generate_preprocess_files(
      part=0,
      parts=1,
      annotation_file="./kinetics/annotation/anno_400.json",
      use_ray=False,
      num_cpus=4,
      overwrite=False,
      force_encode=False,
      short_edge_res=256,
      distributed=False,
      shuffle_seed=None,
      dataset=None,
  ):
      if dataset is None:
          dataset = GluonCVMotionDataset(annotation_file)
  
      generator_list = [
          lambda sample, overwrite: generate_video(
              sample, force_encode, overwrite
          ),
          generate_thumbnail,
          lambda sample, overwrite: generate_gt_vis_json(
              sample, dataset.get_anno_subpath(), overwrite
          ),
      ]
  
      samples = sorted(dataset.samples)
      if shuffle_seed is not None and shuffle_seed != "None":
          random.seed(shuffle_seed)
          random.shuffle(samples)
      samples = samples[part::parts]
  
      logging.info(
          "Using ray {} ,  distributed: {}".format(use_ray, distributed)
      )
      if use_ray:
          num_ray_threads = 500
          if distributed:
              ray.init(redis_address="localhost:6379")
          else:
              ray.init(num_cpus=num_cpus)
          ray.get(
              [
                  generate_files_for_multi_samples_ray.remote(
                      samples[i::num_ray_threads],
                      generator_list,
                      overwrite,
                  )
                  for i in range(num_ray_threads)
              ]
          )
      else:
          for id, data_sample in tqdm(samples, mininterval=1.0):
              generate_files_for_one_sample(
                  data_sample, generator_list, overwrite
              )
  
file_path: gluon-cv/gluoncv/torch/data/gluoncv_motion_dataset/dataset_pre_processor.py
imports: import os
  import random
  import logging
  import ray
  from pathlib import Path
  from tqdm import tqdm
  from .io.video_io import VideoFrameReader, write_img_files_to_vid_ffmpeg, resize_and_write_video_ffmpeg, convert_vid_ffmpeg
  from .utils.serialization_utils import save_json
  from .dataset import GluonCVMotionDataset, DataSample, FieldNames, get_resized_video_location, get_vis_gt_location, get_vis_thumb_location, get_vis_video_location
label_desc: Use image node_id 8 for calling a global function with example usage: generate_preprocess_files(part, parts, annotation_file, use_ray, num_cpus, overwrite, force_encode, short_edge_res, distributed, shuffle_seed, dataset) without return types