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: 用来将模型转移到指定的 ``device`` 上；
  之所以写成 :class:`staticmethod`，是因为一方面在 `Driver` 中我们要使用 :meth:`unwrap_model` 来拿到最原始的模型，另一方面，在 :meth`save_model`
  中，我们需要先将模型移到 cpu 后，又再移到 gpu 上，因此不适宜在该函数内部调用 :meth:`unwrap_model`，而是将 ``model`` 作为该函数的参数。
docstr_tok: ["\u7528\u6765\u5c06\u6a21\u578b\u8f6c\u79fb\u5230\u6307\u5b9a\u7684","``","device","``","\u4e0a\uff1b","\u4e4b\u6240\u4ee5\u5199\u6210",":","class",":","`","staticmethod","`","\uff0c\u662f\u56e0\u4e3a\u4e00\u65b9\u9762\u5728","`","Driver","`","\u4e2d\u6211\u4eec\u8981\u4f7f\u7528",":","meth",":","`","unwrap_model","`","\u6765\u62ff\u5230\u6700\u539f\u59cb\u7684\u6a21\u578b\uff0c\u53e6\u4e00\u65b9\u9762\uff0c\u5728",":","meth","`","save_model","`","\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u5148\u5c06\u6a21\u578b\u79fb\u5230","cpu","\u540e\uff0c\u53c8\u518d\u79fb\u5230","gpu","\u4e0a\uff0c\u56e0\u6b64\u4e0d\u9002\u5b9c\u5728\u8be5\u51fd\u6570\u5185\u90e8\u8c03\u7528",":","meth",":","`","unwrap_model","`","\uff0c\u800c\u662f\u5c06","``","model","``","\u4f5c\u4e3a\u8be5\u51fd\u6570\u7684\u53c2\u6570\u3002"]
code: def move_model_to_device(model, device):
      r"""
      用来将模型转移到指定的 ``device`` 上；
      之所以写成 :class:`staticmethod`，是因为一方面在 `Driver` 中我们要使用 :meth:`unwrap_model` 来拿到最原始的模型，另一方面，在 :meth`save_model`
      中，我们需要先将模型移到 cpu 后，又再移到 gpu 上，因此不适宜在该函数内部调用 :meth:`unwrap_model`，而是将 ``model`` 作为该函数的参数。
      """
  
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 32 for calling the Driver obj's underlying member method code with example usage: obj.move_model_to_device(model, device) without return types