def _determine_model_name(ckpt_path: Optional[_PATH], default_model_registry: Optional[str]) -> str:
    """Determine the model name from the checkpoint path.

    Args:
        ckpt_path: The checkpoint path
        default_model_registry: The default model registry

    Returns:
        string name of the model with optional version

    >>> _determine_model_name("registry:model-name:version:1.0", "default-model")
    'model-name:1.0'
    >>> _determine_model_name("registry:model-name", "default-model")
    'model-name'
    >>> _determine_model_name("registry:version:v2", "default-model")
    'default-model:v2'

    """
    # try to find model and version
    model_name, model_version = _parse_registry_model_version(ckpt_path)
    # omitted model name try to use the model registry from Trainer
    if not model_name and default_model_registry:
        model_name = default_model_registry
    if not model_name:
        raise ValueError(f"Invalid model registry: '{ckpt_path}'")
    model_registry = model_name
    model_registry += f":{model_version}" if model_version else ""
    return model_registry
Determine the model name from the checkpoint path.

    Args:
        ckpt_path: The checkpoint path
        default_model_registry: The default model registry

    Returns:
        string name of the model with optional version

    >>> _determine_model_name("registry:model-name:version:1.0", "default-model")
    'model-name:1.0'
    >>> _determine_model_name("registry:model-name", "default-model")
    'model-name'
    >>> _determine_model_name("registry:version:v2", "default-model")
    'default-model:v2'

    
src/lightning/pytorch/utilities/model_registry.py