code: def model_and_optimizers(request):
      trainer_params = TrainerParameters()
  
      trainer_params.model = TorchNormalModel_Classification_1(
          num_labels=ArgMaxDatasetConfig.num_labels,
          feature_dimension=ArgMaxDatasetConfig.feature_dimension,
      )
      trainer_params.optimizers = SGD(
          trainer_params.model.parameters(), lr=0.001
      )
      dataset = TorchArgMaxDataset(
          feature_dimension=ArgMaxDatasetConfig.feature_dimension,
          data_num=ArgMaxDatasetConfig.data_num,
          seed=ArgMaxDatasetConfig.seed,
      )
      _dataloader = DataLoader(
          dataset=dataset,
          batch_size=ArgMaxDatasetConfig.batch_size,
          shuffle=True,
      )
  
      class LossMetric(Metric):
          def __init__(self):
              super().__init__()
              self.register_element("loss")
  
          def update(self, loss):
              self.loss += loss.item()
  
          def get_metric(self) -> dict:
              return self.loss.item()
  
      trainer_params.train_dataloader = _dataloader
      trainer_params.evaluate_dataloaders = _dataloader
      trainer_params.metrics = {"loss": LossMetric()}
  
      trainer_params.more_metrics = {"acc": Accuracy()}
  
      return trainer_params
  
file_path: fastNLP/tests/core/callbacks/test_more_evaluate_callback.py
imports: import os
  import pytest
  from typing import Any
  from dataclasses import dataclass
  from pathlib import Path
  from fastNLP.core.controllers.trainer import Trainer
  from fastNLP.envs import FASTNLP_LAUNCH_TIME, FASTNLP_DISTRIBUTED_CHECK
  from tests.helpers.utils import magic_argv_env_context
  from fastNLP.envs.distributed import rank_zero_rm
  from tests.helpers.models.torch_model import TorchNormalModel_Classification_1
  from tests.helpers.datasets.torch_data import TorchArgMaxDataset
  from fastNLP.core.metrics import Metric
  from fastNLP.core.callbacks import MoreEvaluateCallback
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
label_desc: Use image node_id 1 for calling a global function with example usage: model_and_optimizers(request) and returns: trainer_params, self