code: def test_lit_training(model, model_kwargs, training_loop):
      """Test training models with PyTorch Lightning."""
      # some models require inverse relations
      create_inverse_triples = model is not models.RGCN
      dataset = get_dataset(
          dataset="nations",
          dataset_kwargs=dict(
              create_inverse_triples=create_inverse_triples
          ),
      )
  
      # some model require access to the training triples
      if "triples_factory" in model_kwargs:
          model_kwargs["triples_factory"] = dataset.training
  
      # inductive models require an inductive mode to be set, and an inference factory to be passed
      if issubclass(model, models.InductiveNodePiece):
          # fake an inference factory
          model_kwargs["inference_factory"] = dataset.training
          mode = TRAINING
      else:
          mode = None
  
      lit_pipeline(
          training_loop=training_loop,
          training_loop_kwargs=dict(
              model=model,
              dataset=dataset,
              model_kwargs=model_kwargs,
              batch_size=8,
              mode=mode,
          ),
          trainer_kwargs=dict(
              # automatically choose accelerator
              accelerator="auto",
              # defaults to TensorBoard; explicitly disabled here
              logger=False,
              # disable checkpointing
              enable_checkpointing=False,
              # fast run
              max_epochs=2,
          ),
      )
  
file_path: pykeen/tests/test_lightning.py
imports: import itertools
  import pytest
  from pykeen import models
  from pykeen.datasets import EagerDataset, get_dataset
  from pykeen.typing import TRAINING
  from tests.utils import needs_packages
label_desc: Use image node_id 1 for calling a global function with example usage: test_lit_training(model, model_kwargs, training_loop) without return types