code: def _check_valid_parameters_number(
      fn, expected_params: List[str], fn_name=None
  ):
      """
      检查一个函数是否需要 expected_params 参数(检测数量是否匹配)。除掉 self （如果是method），给定默认值的参数等。
      如果匹配不上，就会进行报错。
  
      :param fn: 需要检测的函数，可以是 method 或者 function 。
      :param expected_params: 期待应该支持的参数。
      :param fn_name: fn 的名字，当传入的 fn 不是 callable 的时候方便报错。
      :return:
      """
      if fn_name is not None:
          assert callable(
              fn
          ), f"`{fn_name}` should be callable, instead of `{type(fn)}`."
  
      try:
          args = []
          kwargs = {}
          name = ""
          if isinstance(fn, functools.partial) and not hasattr(
              fn, "__name__"
          ):
              name = "partial:"
              f = fn.func
              while isinstance(f, functools.partial):
                  name += "partial:"
                  f = f.func
              fn.__name__ = name + f.__name__
          inspect.getcallargs(fn, *args, *expected_params, **kwargs)
          if name:  # 如果一开始没有name的，需要给人家删除掉
              delattr(fn, "__name__")
  
      except TypeError as e:
          logger.error(
              f"The function:{_get_fun_msg(fn)} will be provided with parameters:{expected_params}. "
              f"The following exception will happen."
          )
          raise e
  
imports: import functools
  import inspect
  from inspect import Parameter
  import dataclasses
  from dataclasses import is_dataclass
  from copy import deepcopy
  from collections import defaultdict, OrderedDict
  from typing import Callable, List, Any, Dict, AnyStr, Union, Mapping, Sequence
  from typing import Tuple, Optional
  from time import sleep
  import os
  from contextlib import contextmanager
  from functools import wraps
  from prettytable import PrettyTable
  from pathlib import Path
  from fastNLP.core.log import logger
label_desc: Use image node_id 5 for calling a global function with example usage: _check_valid_parameters_number(fn, expected_params, fn_name) without return types