def test_model_properties_fit_ckpt_path(tmp_path):
    """Test that properties like `current_epoch` and `global_step` in model and trainer are always the same."""
    model = BoringModel()
    checkpoint_callback = ModelCheckpoint(dirpath=tmp_path, save_last=True)
    trainer_args = {
        "default_root_dir": tmp_path,
        "max_epochs": 1,
        "limit_train_batches": 2,
        "limit_val_batches": 2,
        "logger": False,
        "callbacks": [checkpoint_callback, ModelTrainerPropertyParity()],  # this performs the assertions
    }
    trainer = Trainer(**trainer_args)
    trainer.fit(model)

    trainer_args.update(max_epochs=2)
    trainer = Trainer(**trainer_args)
    trainer.fit(model, ckpt_path=str(tmp_path / "last.ckpt"))
Test that properties like `current_epoch` and `global_step` in model and trainer are always the same.
tests/tests_pytorch/models/test_restore.py