def test_load_raw_checkpoint_validate_single_file(tmp_path):
    """Test that we validate the given checkpoint is a single file when loading a raw PyTorch state-dict checkpoint."""
    strategy = ModelParallelStrategy(parallelize_fn=(lambda m, _: m))
    model = Mock(spec=nn.Module)
    path = tmp_path / "folder"
    path.mkdir()
    with pytest.raises(ValueError, match="The given path must be a single file containing the full state dict"):
        strategy.load_checkpoint(path=path, state=model)
Test that we validate the given checkpoint is a single file when loading a raw PyTorch state-dict checkpoint.
tests/tests_fabric/strategies/test_model_parallel.py