code: def test_e2e_hf_data(ray_start_6_cpus_2_gpus, config_id):
      train_loop_config = CONFIGURATIONS[config_id]
  
      # Specify `num_train_epochs` for Map-style Dataset
      train_loop_config["use_ray_data"] = False
      train_loop_config["num_train_epochs"] = MAX_EPOCHS
  
      # Calculate the num of Ray training iterations
      if train_loop_config["save_strategy"] == "steps":
          num_iterations = MAX_STEPS // train_loop_config["save_steps"]
      else:
          num_iterations = MAX_EPOCHS
  
      use_gpu = not train_loop_config["no_cuda"]
  
      trainer = TorchTrainer(
          train_func,
          train_loop_config=train_loop_config,
          scaling_config=ScalingConfig(
              num_workers=NUM_WORKERS, use_gpu=use_gpu
          ),
      )
      result = trainer.fit()
  
      assert result.metrics["epoch"] == MAX_EPOCHS
      assert result.metrics["step"] == MAX_STEPS
      assert result.metrics["training_iteration"] == num_iterations
      assert result.checkpoint
      assert isinstance(result.checkpoint, Checkpoint)
      assert len(result.best_checkpoints) == num_iterations
      assert "eval_loss" in result.metrics
  
file_path: ray/python/ray/train/tests/test_torch_transformers_train.py
imports: import pandas
  import pytest
  from datasets import Dataset
  from transformers import AutoConfig, AutoModelForCausalLM, Trainer, TrainingArguments
  import ray.data
  from ray import tune
  from ray.train import Checkpoint, ScalingConfig
  from ray.train.huggingface.transformers import RayTrainReportCallback, prepare_trainer
  from ray.train.tests._huggingface_data import train_data, validation_data
  from ray.train.torch import TorchTrainer
  from ray.tune import Tuner
  from ray.tune.schedulers.async_hyperband import ASHAScheduler
  from ray.tune.schedulers.resource_changing_scheduler import DistributeResources, ResourceChangingScheduler
label_desc: Use image node_id 4 for calling a global function with example usage: test_e2e_hf_data(ray_start_6_cpus_2_gpus, config_id) without return types