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: 从 ``src`` 端将 ``obj`` 对象（可能是 ``tensor``，可能是 ``object`` ）broadcast 到其它所有进程。如果是非 ``tensor`` 的对象会尝试使用 ``pickle`` 进行打包进行
  传输，然后再 ``dst`` 处再加载回来。仅在分布式的 ``driver`` 中有实际意义。
  
  :param obj: obj，可能是 ``Tensor`` 或 嵌套类型的数据
  :param src: source 的 ``global rank``
  :param group: 所属的通信组
  :return: 输入的 ``obj``
docstr_tok: ["\u4ece","``","src","``","\u7aef\u5c06","``","obj","``","\u5bf9\u8c61\uff08\u53ef\u80fd\u662f","``","tensor","``","\uff0c\u53ef\u80fd\u662f","``","object","``","\uff09broadcast","\u5230\u5176\u5b83\u6240\u6709\u8fdb\u7a0b\u3002\u5982\u679c\u662f\u975e","``","tensor","``","\u7684\u5bf9\u8c61\u4f1a\u5c1d\u8bd5\u4f7f\u7528","``","pickle","``","\u8fdb\u884c\u6253\u5305\u8fdb\u884c","\u4f20\u8f93\uff0c\u7136\u540e\u518d","``","dst","``","\u5904\u518d\u52a0\u8f7d\u56de\u6765\u3002\u4ec5\u5728\u5206\u5e03\u5f0f\u7684","``","driver","``","\u4e2d\u6709\u5b9e\u9645\u610f\u4e49\u3002",":","param","obj",":","obj\uff0c\u53ef\u80fd\u662f","``","Tensor","``","\u6216","\u5d4c\u5957\u7c7b\u578b\u7684\u6570\u636e",":","param","src",":","source","\u7684","``","global","rank","``",":","param","group",":","\u6240\u5c5e\u7684\u901a\u4fe1\u7ec4",":","return",":","\u8f93\u5165\u7684","``","obj","``"]
code: def broadcast_object(self, obj, src: int = 0, group=None, **kwargs):
      r"""
      从 ``src`` 端将 ``obj`` 对象（可能是 ``tensor``，可能是 ``object`` ）broadcast 到其它所有进程。如果是非 ``tensor`` 的对象会尝试使用 ``pickle`` 进行打包进行
      传输，然后再 ``dst`` 处再加载回来。仅在分布式的 ``driver`` 中有实际意义。
  
      :param obj: obj，可能是 ``Tensor`` 或 嵌套类型的数据
      :param src: source 的 ``global rank``
      :param group: 所属的通信组
      :return: 输入的 ``obj``
      """
      if not self.is_distributed():
          return obj
      raise NotImplementedError(
          f"Driver:{self.__class__.__name__} does not support `broadcast_object` 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 38 for calling the Driver obj's underlying member method code with example usage: obj.broadcast_object(obj, src, group) and returns: obj