class_docstr: ``Jittor`` 框架下用于 ``cpu`` 和单卡 ``gpu`` 运算的 ``Driver``。
  
  :param model: 传入给 ``Trainer`` 的 ``model`` 参数。
  :param device: 训练和模型所在的设备，在 **Jittor** 中，应当为以下值之一：``[None, 'cpu', 'gpu', 'cuda']``：
      
      * 为 ``None`` 或 ``cpu`` 时，表示在 ``cpu`` 上进行训练；
      * 为 ``gpu`` 或 ``cuda`` 时，表示在显卡设备上进行训练；
  
  :param fp16: 是否开启 fp16 混合精度训练。
  :param jittor_kwargs:
  :kwargs:
      * *model_wo_auto_param_call* (``bool``) -- 是否关闭在训练时调用我们的 ``auto_param_call`` 函数来自动匹配 batch 和前向函数的参数的行为
  
      .. note::
  
          关于该参数的详细说明，请参见 :class:`~fastNLP.core.controllers.Trainer` 中的描述；函数 ``auto_param_call`` 详见 :func:`fastNLP.core.utils.auto_param_call`。
class_docstr_tok: ["``","Jittor","``","\u6846\u67b6\u4e0b\u7528\u4e8e","``","cpu","``","\u548c\u5355\u5361","``","gpu","``","\u8fd0\u7b97\u7684","``","Driver","``","\u3002",":","param","model",":","\u4f20\u5165\u7ed9","``","Trainer","``","\u7684","``","model","``","\u53c2\u6570\u3002",":","param","device",":","\u8bad\u7ec3\u548c\u6a21\u578b\u6240\u5728\u7684\u8bbe\u5907\uff0c\u5728","*","*","Jittor","*","*","\u4e2d\uff0c\u5e94\u5f53\u4e3a\u4ee5\u4e0b\u503c\u4e4b\u4e00\uff1a","``","[","None",",","'cpu","'",",","'gpu","'",",","'cuda","'","]","``","\uff1a","*","\u4e3a","``","None","``","\u6216","``","cpu","``","\u65f6\uff0c\u8868\u793a\u5728","``","cpu","``","\u4e0a\u8fdb\u884c\u8bad\u7ec3\uff1b","*","\u4e3a","``","gpu","``","\u6216","``","cuda","``","\u65f6\uff0c\u8868\u793a\u5728\u663e\u5361\u8bbe\u5907\u4e0a\u8fdb\u884c\u8bad\u7ec3\uff1b",":","param","fp16",":","\u662f\u5426\u5f00\u542f","fp16","\u6df7\u5408\u7cbe\u5ea6\u8bad\u7ec3\u3002",":","param","jittor_kwargs",":",":","kwargs",":","*","*","model_wo_auto_param_call","*","(","``","bool","``",")","--","\u662f\u5426\u5173\u95ed\u5728\u8bad\u7ec3\u65f6\u8c03\u7528\u6211\u4eec\u7684","``","auto_param_call","``","\u51fd\u6570\u6765\u81ea\u52a8\u5339\u914d","batch","\u548c\u524d\u5411\u51fd\u6570\u7684\u53c2\u6570\u7684\u884c\u4e3a","..","note",":",":","\u5173\u4e8e\u8be5\u53c2\u6570\u7684\u8be6\u7ec6\u8bf4\u660e\uff0c\u8bf7\u53c2\u89c1",":","class",":","`","~fastNLP.core.controllers.Trainer","`","\u4e2d\u7684\u63cf\u8ff0\uff1b\u51fd\u6570","``","auto_param_call","``","\u8be6\u89c1",":","func",":","`","fastNLP.core.utils.auto_param_call","`","\u3002"]
docstr: 初始化训练环境；根据传入的 ``device`` 值设置模型的训练场景为 ``cpu`` 或 ``gpu``。
docstr_tok: ["\u521d\u59cb\u5316\u8bad\u7ec3\u73af\u5883\uff1b\u6839\u636e\u4f20\u5165\u7684","``","device","``","\u503c\u8bbe\u7f6e\u6a21\u578b\u7684\u8bad\u7ec3\u573a\u666f\u4e3a","``","cpu","``","\u6216","``","gpu","``","\u3002"]
code: def setup(self):
      r"""
      初始化训练环境；根据传入的 ``device`` 值设置模型的训练场景为 ``cpu`` 或 ``gpu``。
      """
      if self.model_device in ["cpu", None]:
          jt.flags.use_cuda = 0  # 使用 cpu
      else:
          jt.flags.use_cuda = 1
  
file_path: fastNLP/fastNLP/core/drivers/jittor_driver/single_device.py
imports: from typing import Dict, Union, Tuple, Callable, Optional
  from .jittor_driver import JittorDriver
  from .utils import replace_batch_sampler, replace_sampler
  from fastNLP.core.utils import auto_param_call
  from fastNLP.core.utils.utils import _get_fun_msg
  from fastNLP.envs.imports import _NEED_IMPORT_JITTOR
  from fastNLP.core.samplers import ReproducibleBatchSampler, ReproducibleSampler, re_instantiate_sampler, ReproduceBatchSampler
  from fastNLP.core.samplers import RandomSampler
  from fastNLP.core.log import logger
label_desc: Use image node_id 2 for calling the JittorSingleDriver obj's underlying member method code with example usage: obj.setup() without return types