code: def test_models(tmpdir, data_class, model_class):
      """Test simple models."""
      dm = data_class() if data_class else data_class
      model = model_class()
      trainer = Trainer(default_root_dir=tmpdir, max_epochs=1)
  
      trainer.fit(model, datamodule=dm)
  
      if dm is not None:
          trainer.test(model, datamodule=dm)
  
      model.to_torchscript()
      if data_class:
          model.to_onnx(
              os.path.join(tmpdir, "my-model.onnx"),
              input_sample=dm.sample,
          )
  
file_path: pytorch-lightning/tests/tests_pytorch/helpers/test_models.py
imports: import os
  import pytest
  from lightning.pytorch import Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel
  from tests_pytorch.helpers.advanced_models import BasicGAN, ParityModuleMNIST, ParityModuleRNN
  from tests_pytorch.helpers.datamodules import ClassifDataModule, RegressDataModule
  from tests_pytorch.helpers.runif import RunIf
  from tests_pytorch.helpers.simple_models import ClassificationModel, RegressionModel
label_desc: Use image node_id 1 for calling a global function with example usage: test_models(tmpdir, data_class, model_class) without return types