class_docstr: 用来初始化 `Driver` 的基类，所有定制的 `driver` 都需要继承此类；
  **fastNLP** 提供的 driver 实例都会同时被 :class:`~fastNLP.core.controllers.Trainer` 和 :class:`~fastNLP.core.controllers.Evaluator` 调用。
  
  :param model: 训练或者评测的模型，需要注意该模型可能为用户已经使用类似 :class:`torch.nn.DataParallel` 或者
      :class:`torch.nn.parallel.DistributedDataParallel` 包裹过的模型。
class_docstr_tok: ["\u7528\u6765\u521d\u59cb\u5316","`","Driver","`","\u7684\u57fa\u7c7b\uff0c\u6240\u6709\u5b9a\u5236\u7684","`","driver","`","\u90fd\u9700\u8981\u7ee7\u627f\u6b64\u7c7b\uff1b","*","*","fastNLP","*","*","\u63d0\u4f9b\u7684","driver","\u5b9e\u4f8b\u90fd\u4f1a\u540c\u65f6\u88ab",":","class",":","`","~fastNLP.core.controllers.Trainer","`","\u548c",":","class",":","`","~fastNLP.core.controllers.Evaluator","`","\u8c03\u7528\u3002",":","param","model",":","\u8bad\u7ec3\u6216\u8005\u8bc4\u6d4b\u7684\u6a21\u578b\uff0c\u9700\u8981\u6ce8\u610f\u8be5\u6a21\u578b\u53ef\u80fd\u4e3a\u7528\u6237\u5df2\u7ecf\u4f7f\u7528\u7c7b\u4f3c",":","class",":","`","torch.nn.DataParallel","`","\u6216\u8005",":","class",":","`","torch.nn.parallel.DistributedDataParallel","`","\u5305\u88f9\u8fc7\u7684\u6a21\u578b\u3002"]
docstr: 将 ``obj`` 互相传送到其它所有的 rank 上，其中 ``obj`` 可能是 Tensor，也可能是嵌套结构的 object 。如果不是基础类型的数据，尝试通过
  pickle 进行序列化，接收到之后再反序列化。
  
  :param obj: 可以是 ``float/int/bool/np.ndarray/{}/[]/Tensor`` 等类型的数据
  :param group: 用于不同进程之间互相通信的通信组
  :return: 返回值应该是 ``[obj0, obj1, ...]``，其中 ``obj0`` 是 ``rank0`` 上的对象，``obj1`` 是 ``rank1`` 上的对象。以此类推
docstr_tok: ["\u5c06","``","obj","``","\u4e92\u76f8\u4f20\u9001\u5230\u5176\u5b83\u6240\u6709\u7684","rank","\u4e0a\uff0c\u5176\u4e2d","``","obj","``","\u53ef\u80fd\u662f","Tensor\uff0c\u4e5f\u53ef\u80fd\u662f\u5d4c\u5957\u7ed3\u6784\u7684","object","\u3002\u5982\u679c\u4e0d\u662f\u57fa\u7840\u7c7b\u578b\u7684\u6570\u636e\uff0c\u5c1d\u8bd5\u901a\u8fc7","pickle","\u8fdb\u884c\u5e8f\u5217\u5316\uff0c\u63a5\u6536\u5230\u4e4b\u540e\u518d\u53cd\u5e8f\u5217\u5316\u3002",":","param","obj",":","\u53ef\u4ee5\u662f","``","float\/int\/bool\/np.ndarray\/","{","}","\/","[","]","\/Tensor","``","\u7b49\u7c7b\u578b\u7684\u6570\u636e",":","param","group",":","\u7528\u4e8e\u4e0d\u540c\u8fdb\u7a0b\u4e4b\u95f4\u4e92\u76f8\u901a\u4fe1\u7684\u901a\u4fe1\u7ec4",":","return",":","\u8fd4\u56de\u503c\u5e94\u8be5\u662f","``","[","obj0",",","obj1",",","...","]","``","\uff0c\u5176\u4e2d","``","obj0","``","\u662f","``","rank0","``","\u4e0a\u7684\u5bf9\u8c61\uff0c","``","obj1","``","\u662f","``","rank1","``","\u4e0a\u7684\u5bf9\u8c61\u3002\u4ee5\u6b64\u7c7b\u63a8"]
code: def all_gather(self, obj, group) -> List:
      r"""
      将 ``obj`` 互相传送到其它所有的 rank 上，其中 ``obj`` 可能是 Tensor，也可能是嵌套结构的 object 。如果不是基础类型的数据，尝试通过
      pickle 进行序列化，接收到之后再反序列化。
  
      :param obj: 可以是 ``float/int/bool/np.ndarray/{}/[]/Tensor`` 等类型的数据
      :param group: 用于不同进程之间互相通信的通信组
      :return: 返回值应该是 ``[obj0, obj1, ...]``，其中 ``obj0`` 是 ``rank0`` 上的对象，``obj1`` 是 ``rank1`` 上的对象。以此类推
      """
      if not self.is_distributed():
          return [obj]
      raise NotImplementedError(
          f"Driver:{self.__class__.__name__} does not support `all_gather` method right "
          f"now."
      )
  
imports: import os
  import signal
  import sys
  from typing import Sequence, List, Optional, Callable, Dict, Union, Tuple
  from abc import ABC, abstractmethod
  from datetime import datetime
  from pathlib import Path
  from io import BytesIO
  import json
  from fastNLP.core.utils import nullcontext
label_desc: Use image node_id 39 for calling the Driver obj's underlying member method code with example usage: obj.all_gather(obj, group) and returns: list