def models_check_access()

in dell_ai/cli/main.py [0:0]


def models_check_access(model_id: str) -> None:
    """
    Check if you have access to a specific model repository.

    This is particularly useful for gated repositories that require specific permissions.
    If you don't have access to a gated repository, you'll need to request access on the
    Hugging Face Hub before you can use it.

    Args:
        model_id: The model ID in the format "organization/model_name"
    """
    try:
        client = get_client()
        # If check_model_access completes without raising an exception, we have access
        client.check_model_access(model_id)
        typer.echo(f"✅ You have access to model: {model_id}")
    except (GatedRepoAccessError, ResourceNotFoundError, AuthenticationError) as e:
        # Handle expected errors with proper error messages
        print_error(str(e))
    except Exception as e:
        # Unexpected errors get a generic message
        print_error(f"Failed to check model access: {str(e)}")