class_docstr: 实现了 **jittor** 框架训练功能的基本 ``Driver``。这个类被以下子类继承：
  
      1. :class:`~fastNLP.core.drivers.jittor_driver.JittorSingleDriver` ：实现了使用单卡和 ``cpu`` 训练的具体功能；
      2. :class:`~fastNLP.core.drivers.jittor_driver.JittorMPIDriver` ：实现了使用 ``mpi`` 启动 **jittor** 分布式训练的功能；
  
  .. warning::
  
      您不应当直接初始化该类，然后传入给 ``Trainer``，换句话说，您应当使用该类的子类 ``JittorSingleDriver`` 和 ``TorchDDPDriver``，而不是
      该类本身。
  
  .. note::
  
      您可以在使用 ``JittorSingleDriver`` 和 ``JittorMPIDriver`` 时使用 ``JittorDriver`` 提供的接口。
  
  :param model: 训练时使用的 **jittor** 模型
  :param fp16: 是否开启混合精度训练
  :param jittor_kwargs:
class_docstr_tok: ["\u5b9e\u73b0\u4e86","*","*","jittor","*","*","\u6846\u67b6\u8bad\u7ec3\u529f\u80fd\u7684\u57fa\u672c","``","Driver","``","\u3002\u8fd9\u4e2a\u7c7b\u88ab\u4ee5\u4e0b\u5b50\u7c7b\u7ee7\u627f\uff1a","1.",":","class",":","`","~fastNLP.core.drivers.jittor_driver.JittorSingleDriver","`","\uff1a\u5b9e\u73b0\u4e86\u4f7f\u7528\u5355\u5361\u548c","``","cpu","``","\u8bad\u7ec3\u7684\u5177\u4f53\u529f\u80fd\uff1b","2.",":","class",":","`","~fastNLP.core.drivers.jittor_driver.JittorMPIDriver","`","\uff1a\u5b9e\u73b0\u4e86\u4f7f\u7528","``","mpi","``","\u542f\u52a8","*","*","jittor","*","*","\u5206\u5e03\u5f0f\u8bad\u7ec3\u7684\u529f\u80fd\uff1b","..","warning",":",":","\u60a8\u4e0d\u5e94\u5f53\u76f4\u63a5\u521d\u59cb\u5316\u8be5\u7c7b\uff0c\u7136\u540e\u4f20\u5165\u7ed9","``","Trainer","``","\uff0c\u6362\u53e5\u8bdd\u8bf4\uff0c\u60a8\u5e94\u5f53\u4f7f\u7528\u8be5\u7c7b\u7684\u5b50\u7c7b","``","JittorSingleDriver","``","\u548c","``","TorchDDPDriver","``","\uff0c\u800c\u4e0d\u662f","\u8be5\u7c7b\u672c\u8eab\u3002","..","note",":",":","\u60a8\u53ef\u4ee5\u5728\u4f7f\u7528","``","JittorSingleDriver","``","\u548c","``","JittorMPIDriver","``","\u65f6\u4f7f\u7528","``","JittorDriver","``","\u63d0\u4f9b\u7684\u63a5\u53e3\u3002",":","param","model",":","\u8bad\u7ec3\u65f6\u4f7f\u7528\u7684","*","*","jittor","*","*","\u6a21\u578b",":","param","fp16",":","\u662f\u5426\u5f00\u542f\u6df7\u5408\u7cbe\u5ea6\u8bad\u7ec3",":","param","jittor_kwargs",":"]
docstr: 对于分布式的 ``sampler``，需要在每一个 ``epoch`` 前设置随机数种子，来保证每一个进程上的 ``shuffle`` 是一样的。
  
  :param dataloader: 需要设置 ``epoch`` 的 ``dataloader``
  :param cur_epoch_idx: 当前是第几个 ``epoch``
docstr_tok: ["\u5bf9\u4e8e\u5206\u5e03\u5f0f\u7684","``","sampler","``","\uff0c\u9700\u8981\u5728\u6bcf\u4e00\u4e2a","``","epoch","``","\u524d\u8bbe\u7f6e\u968f\u673a\u6570\u79cd\u5b50\uff0c\u6765\u4fdd\u8bc1\u6bcf\u4e00\u4e2a\u8fdb\u7a0b\u4e0a\u7684","``","shuffle","``","\u662f\u4e00\u6837\u7684\u3002",":","param","dataloader",":","\u9700\u8981\u8bbe\u7f6e","``","epoch","``","\u7684","``","dataloader","``",":","param","cur_epoch_idx",":","\u5f53\u524d\u662f\u7b2c\u51e0\u4e2a","``","epoch","``"]
code: def set_sampler_epoch(
      self,
      dataloader: Union["JittorDataLoader", "Dataset"],
      cur_epoch_idx: int,
  ):
      r"""
      对于分布式的 ``sampler``，需要在每一个 ``epoch`` 前设置随机数种子，来保证每一个进程上的 ``shuffle`` 是一样的。
  
      :param dataloader: 需要设置 ``epoch`` 的 ``dataloader``
      :param cur_epoch_idx: 当前是第几个 ``epoch``
      """
      # 保证 ddp 训练时的 shuffle=True 时的正确性，因为需要保证每一个进程上的 sampler 的shuffle 的随机数种子是一样的；
      if callable(getattr(dataloader.sampler, "set_epoch", None)):
          dataloader.sampler.set_epoch(cur_epoch_idx)
  
imports: import os
  from pathlib import Path
  from typing import Union, Optional, Dict
  from dataclasses import dataclass
  from fastNLP.envs.imports import _NEED_IMPORT_JITTOR
  from fastNLP.core.drivers.driver import Driver
  from fastNLP.core.dataloaders import JittorDataLoader
  from fastNLP.core.dataloaders import OverfitDataLoader
  from fastNLP.core.samplers import ReproducibleSampler, RandomSampler
  from fastNLP.core.log import logger
  from fastNLP.core.utils import apply_to_collection, nullcontext
  from fastNLP.envs import FASTNLP_MODEL_FILENAME, FASTNLP_CHECKPOINT_FILENAME
label_desc: Use image node_id 21 for calling the JittorDriver obj's underlying member method code with example usage: obj.set_sampler_epoch(dataloader, cur_epoch_idx) without return types