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: 加载模型的函数；将 ``filepath`` 中的模型加载并赋值给当前 model 。
  
  :param filepath: 需要被加载的对象的文件位置（需要包括文件名）或一个 ``BytesIO`` 对象。
  :param load_state_dict: 保存的文件是否只是模型的权重，还是完整的模型。即便是保存的完整的模型，此处也只能使用尝试加载filepath
      模型中的权重到自身模型，而不会直接替代当前 Driver 中的模型。
docstr_tok: ["\u52a0\u8f7d\u6a21\u578b\u7684\u51fd\u6570\uff1b\u5c06","``","filepath","``","\u4e2d\u7684\u6a21\u578b\u52a0\u8f7d\u5e76\u8d4b\u503c\u7ed9\u5f53\u524d","model","\u3002",":","param","filepath",":","\u9700\u8981\u88ab\u52a0\u8f7d\u7684\u5bf9\u8c61\u7684\u6587\u4ef6\u4f4d\u7f6e\uff08\u9700\u8981\u5305\u62ec\u6587\u4ef6\u540d\uff09\u6216\u4e00\u4e2a","``","BytesIO","``","\u5bf9\u8c61\u3002",":","param","load_state_dict",":","\u4fdd\u5b58\u7684\u6587\u4ef6\u662f\u5426\u53ea\u662f\u6a21\u578b\u7684\u6743\u91cd\uff0c\u8fd8\u662f\u5b8c\u6574\u7684\u6a21\u578b\u3002\u5373\u4fbf\u662f\u4fdd\u5b58\u7684\u5b8c\u6574\u7684\u6a21\u578b\uff0c\u6b64\u5904\u4e5f\u53ea\u80fd\u4f7f\u7528\u5c1d\u8bd5\u52a0\u8f7dfilepath","\u6a21\u578b\u4e2d\u7684\u6743\u91cd\u5230\u81ea\u8eab\u6a21\u578b\uff0c\u800c\u4e0d\u4f1a\u76f4\u63a5\u66ff\u4ee3\u5f53\u524d","Driver","\u4e2d\u7684\u6a21\u578b\u3002"]
code: def load_model(
      self,
      filepath: Union[str, Path, BytesIO],
      only_state_dict: bool = False,
      **kwargs,
  ):
      r"""
      加载模型的函数；将 ``filepath`` 中的模型加载并赋值给当前 model 。
  
      :param filepath: 需要被加载的对象的文件位置（需要包括文件名）或一个 ``BytesIO`` 对象。
      :param load_state_dict: 保存的文件是否只是模型的权重，还是完整的模型。即便是保存的完整的模型，此处也只能使用尝试加载filepath
          模型中的权重到自身模型，而不会直接替代当前 Driver 中的模型。
      """
      raise NotImplementedError(
          "Each specific driver should implemented its own `load_model` function."
      )
  
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 26 for calling the Driver obj's underlying member method code with example usage: obj.load_model(filepath, only_state_dict) without return types