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: 对于用户传入 trainer 的每一个 optimizer，检测其是否合理，因为不同的深度学习框架所使用的的 optimizer 是不相同的。
  
  :param optimizers: 需要检测的 `optimizers`。
docstr_tok: ["\u5bf9\u4e8e\u7528\u6237\u4f20\u5165","trainer","\u7684\u6bcf\u4e00\u4e2a","optimizer\uff0c\u68c0\u6d4b\u5176\u662f\u5426\u5408\u7406\uff0c\u56e0\u4e3a\u4e0d\u540c\u7684\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u6240\u4f7f\u7528\u7684\u7684","optimizer","\u662f\u4e0d\u76f8\u540c\u7684\u3002",":","param","optimizers",":","\u9700\u8981\u68c0\u6d4b\u7684","`","optimizers","`","\u3002"]
code: def _check_optimizer_legality(optimizers):
      r"""
      对于用户传入 trainer 的每一个 optimizer，检测其是否合理，因为不同的深度学习框架所使用的的 optimizer 是不相同的。
  
      :param optimizers: 需要检测的 `optimizers`。
      """
      raise NotImplementedError(
          "Each specific driver should implemented its own `_check_optimizer_legality` 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 15 for calling the Driver obj's underlying member method code with example usage: obj._check_optimizer_legality(optimizers) without return types