def METHOD_NAME(path, **kwargs):
    """
    Attempts to detect the model task from path.
    Args:
        path: path to model
        kwargs: optional additional keyword arguments
    Returns:
        inferred model task
    """
    # Get model configuration
    config = None
    if isinstance(path, (list, tuple)) and hasattr(path[0], "config"):
        config = path[0].config
    elif isinstance(path, str):
        config = AutoConfig.from_pretrained(path, **kwargs)
    # Attempt to resolve task using configuration
    METHOD_NAME = None
    if config:
        architecture = config.architectures[0] if config.architectures else None
        if architecture:
            if any(x for x in ["LMHead", "CausalLM"] if x in architecture):
                METHOD_NAME = "language-generation"
            elif "QuestionAnswering" in architecture:
                METHOD_NAME = "question-answering"
            elif "ConditionalGeneration" in architecture:
                METHOD_NAME = "sequence-sequence"
    return METHOD_NAME