code: def _check_dataloader_args_for_distributed(
      args, controller="Trainer"
  ):
      """
      检查 dataloader 的 sampler 情况，如果用户替换了自己定制的 sampler ，为了防止
      在分布式训练中出现错误会报错。
      """
      error_flag = type(args.sampler) not in {
          TorchRandomSampler,
          TorchSequentialSampler,
      }
      if controller == "Trainer":
          mode = "training"
          substitution = "fastNLP.RandomSampler"
          error_flag = (
              type(args.batch_sampler) != TorchBatchSampler
          ) or error_flag
      else:  # Evaluator
          mode = "evaluation"
          substitution = "fastNLP.UnrepeatedSequentialSampler"
      if error_flag:
          raise TypeError(
              f"Using customized ``batch_sampler`` or ``sampler`` for distributed {mode} may cause "
              f"unpredictable problems, because fastNLP will substitute the dataloader's sampler into "
              f"``{substitution}``. The customized sampler should set for distributed running  "
              f"before initializing ``{controller}`` , and then set the "
              f"parameter ``use_dist_sampler`` of ``{controller}`` to ``False``."
              f"\n Current batch_sampler: {type(args.batch_sampler)}"
              f"\n Current sampler: {type(args.sampler)}"
          )
  
imports: import os
  from typing import Any, Dict, Optional, Union
  from enum import IntEnum
  import contextlib
  import random
  import numpy
  import inspect
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from fastNLP.envs.utils import get_global_seed
  from fastNLP.envs import get_global_rank, FASTNLP_BACKEND_LAUNCH, FASTNLP_GLOBAL_SEED
  from fastNLP.core.samplers import re_instantiate_sampler, ReproducibleBatchSampler, ReproducibleSampler
  from fastNLP.core.utils import auto_param_call, apply_to_collection
  from fastNLP.core.log import logger
label_desc: Use image node_id 6 for calling a global function with example usage: _check_dataloader_args_for_distributed(args, controller) without return types