code: def test_trainer_fleet(
      driver,
      device,
      callbacks,
      n_epochs,
  ):
      model = PaddleNormalModel_Classification_1(
          num_labels=MNISTTrainFleetConfig.num_labels,
          feature_dimension=MNISTTrainFleetConfig.feature_dimension,
      )
      optimizers = Adam(
          parameters=model.parameters(), learning_rate=0.0001
      )
  
      train_dataloader = DataLoader(
          dataset=PaddleArgMaxDataset(
              20, MNISTTrainFleetConfig.feature_dimension
          ),
          batch_size=MNISTTrainFleetConfig.batch_size,
          shuffle=True,
      )
      val_dataloader = DataLoader(
          dataset=PaddleArgMaxDataset(
              12, MNISTTrainFleetConfig.feature_dimension
          ),
          batch_size=MNISTTrainFleetConfig.batch_size,
          shuffle=True,
      )
      train_dataloader = train_dataloader
      validate_dataloaders = val_dataloader
      validate_every = MNISTTrainFleetConfig.validate_every
      metrics = {"acc": Accuracy()}
      trainer = Trainer(
          model=model,
          driver=driver,
          device=device,
          optimizers=optimizers,
          train_dataloader=train_dataloader,
          evaluate_dataloaders=validate_dataloaders,
          evaluate_every=validate_every,
          input_mapping=None,
          output_mapping=None,
          metrics=metrics,
          n_epochs=n_epochs,
          callbacks=callbacks,
          output_from_new_proc="logs",
      )
      trainer.run()
  
file_path: fastNLP/tests/core/controllers/_test_trainer_fleet.py
imports: import os
  import sys
  from dataclasses import dataclass
  from fastNLP.core.controllers.trainer import Trainer
  from fastNLP.core.metrics.accuracy import Accuracy
  from fastNLP.core.callbacks.progress_callback import RichCallback
  from fastNLP.core.callbacks import Callback
  import paddle
  from paddle.optimizer import Adam
  from paddle.io import DataLoader
  from tests.helpers.models.paddle_model import PaddleNormalModel_Classification_1
  from tests.helpers.datasets.paddle_data import PaddleArgMaxDataset
  from tests.helpers.callbacks.helper_callbacks import RecordMetricCallback
label_desc: Use image node_id 1 for calling a global function with example usage: test_trainer_fleet(driver, device, callbacks, n_epochs) without return types