def get_peft_task_type_from_task(task: str, fail_on_not_found=False) -> str:
    """Get peft task type from task."""
    peft_task_type = TASK_TO_PEFT_TASK_TYPE.get(task.replace("-with-past", ""), None)
    not_found_msg = f"There is no peft task type for task {task}"
    if peft_task_type is None and fail_on_not_found:
        raise ValueError(not_found_msg)
    elif peft_task_type is None:
        logger.warning(not_found_msg)
    return peft_task_type
Get peft task type from task.
olive/common/hf/utils.py