code: def find_free_network_port() -> str:
      """
      在 localhost 上找到一个空闲端口；
      当我们不想连接到真正的主节点但必须设置“MASTER_PORT”环境变量时在单节点训练中很有用。
      """
      s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      s.bind(("", 0))
      s.listen(1)
      port = s.getsockname()[1]
      s.close()
      return str(port)
  
imports: import os
  import sys
  import __main__
  import socket
  import numpy
  from time import sleep
  from typing import List, Optional, Union, Dict, Tuple, Callable
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from .torch_driver import TorchDriver
  from fastNLP.core.drivers.torch_driver.utils import _DDPWrappingModel, replace_sampler, replace_batch_sampler
  from fastNLP.core.drivers.utils import distributed_open_proc
  from fastNLP.core.utils import auto_param_call, check_user_specific_params
  from fastNLP.core.samplers import ReproducibleSampler, RandomSampler, UnrepeatedSequentialSampler, ReproducibleBatchSampler, re_instantiate_sampler, UnrepeatedSampler, conversion_between_reproducible_and_unrepeated_sampler
  from fastNLP.envs import FASTNLP_DISTRIBUTED_CHECK, FASTNLP_GLOBAL_RANK, FASTNLP_GLOBAL_SEED, FASTNLP_NO_SYNC
  from fastNLP.core.log import logger
  from fastNLP.core.drivers.torch_driver.dist_utils import fastnlp_torch_all_gather, fastnlp_torch_broadcast_object
  from .utils import _check_dataloader_args_for_distributed
label_desc: Use image node_id 1 for calling a global function with example usage: find_free_network_port() and returns: str