code: def train_mnist_tune(config, num_epochs=10, num_gpus=0):
      data_dir = os.path.abspath("./data")
      model = LightningMNISTClassifier(config, data_dir)
      with FileLock(os.path.expanduser("~/.data.lock")):
          dm = MNISTDataModule(
              data_dir=data_dir, batch_size=config["batch_size"]
          )
      metrics = {"loss": "ptl/val_loss", "acc": "ptl/val_accuracy"}
      trainer = pl.Trainer(
          max_epochs=num_epochs,
          # If fractional GPUs passed in, convert to int.
          gpus=math.ceil(num_gpus),
          enable_progress_bar=False,
          callbacks=[
              TuneReportCheckpointCallback(
                  metrics, on="validation_end", save_checkpoints=False
              )
          ],
      )
      trainer.fit(model, dm)
  
imports: import math
  import os
  import torch
  from filelock import FileLock
  import pytorch_lightning
  from torch.nn import functional
  from torch.utils.data import DataLoader, random_split
  from torchmetrics import Accuracy
  from torchvision import transforms
  from torchvision.datasets import MNIST
  from ray.tune.integration.pytorch_lightning import TuneReportCheckpointCallback
  from ray import train, tune
label_desc: Use image node_id 1 for calling a global function with example usage: train_mnist_tune(config, num_epochs, num_gpus) without return types