class_docstr: 实现了 **PaddlePaddle** 框架训练功能的基本 Driver。
  
  这个类被以下子类继承：
  
  1. :class:`~fastNLP.core.drivers.paddle_driver.PaddleSingleDriver`：实现了使用单卡和 ``cpu`` 训练的具体功能；
  2. :class:`~fastNLP.core.drivers.paddle_driver.PaddleFleetDriver`：实现了使用 ``fleet`` 分布式训练 API 进行集群式分布式训练的具体功能；
  
  .. warning::
  
      您不应当直接初始化该类，然后传入给 ``Trainer``，换句话说，您应当使用该类的子类 ``PaddleSingleDriver`` 和 ``PaddleDDPDriver``，而不是
      该类本身。
  
  .. note::
  
      您可以在使用 ``PaddleSingleDriver`` 和 ``PaddleFleetDriver`` 时使用 ``PaddleDriver`` 提供的接口。
  
  :param model: 训练时使用的 **PaddlePaddle** 模型
  :param fp16: 是否开启混合精度训练
  :param paddle_kwargs:
code: def __init__(
      self,
      model: "paddle.nn.Layer",
      fp16: Optional[bool] = False,
      paddle_kwargs: Dict = None,
      **kwargs,
  ):
      if not isinstance(model, paddle.nn.Layer):
          raise ValueError(
              f"Parameter `model` can not be `{type(model)}` in `PaddleDriver`, it should be exactly "
              f"`paddle.nn.Layer` type."
          )
  
      super(PaddleDriver, self).__init__(model)
      self.fp16 = fp16
      self._paddle_kwargs = (
          paddle_kwargs if paddle_kwargs is not None else {}
      )
  
      # scaler的参数
      self.auto_cast, _grad_scaler = _build_fp16_env(dummy=not fp16)
      self.grad_scaler = _grad_scaler(
          **self._paddle_kwargs.get("gradscaler_kwargs", {})
      )
  
      # 用来设置是否关闭 auto_param_call 中的参数匹配问题；
      self.wo_auto_param_call = kwargs.get(
          "model_wo_auto_param_call", False
      )
  
imports: import os
  import random
  from typing import Union, Optional, Dict, Any
  from pathlib import Path
  from functools import partial
  from dataclasses import dataclass
  import numpy
  from .utils import _build_fp16_env, optimizer_state_to_device, DummyGradScaler
  from fastNLP.envs.imports import _NEED_IMPORT_PADDLE
  from fastNLP.core.drivers.driver import Driver
  from fastNLP.core.utils import apply_to_collection, paddle_move_data_to_device
  from fastNLP.core.utils.paddle_utils import _convert_data_device
  from fastNLP.envs import FASTNLP_MODEL_FILENAME, FASTNLP_CHECKPOINT_FILENAME, FASTNLP_GLOBAL_RANK, rank_zero_call
  from fastNLP.core.log import logger
  from fastNLP.core.dataloaders import OverfitDataLoader
  from fastNLP.core.samplers import ReproducibleBatchSampler, ReproducibleSampler, ReproduceBatchSampler, RandomSampler
label_desc: Use image node_id 1 to create a new PaddleDriver object from inherited base classes: Driver with example: obj = PaddleDriver(model, fp16, paddle_kwargs)