(task_object)
| 378 | |
| 379 | |
| 380 | def get_task_name_from_object(task_object): |
| 381 | for name, class_ in TASK_REGISTRY.items(): |
| 382 | if class_ is task_object: |
| 383 | return name |
| 384 | |
| 385 | # this gives a mechanism for non-registered tasks to have a custom name anyways when reporting |
| 386 | return ( |
| 387 | task_object.EVAL_HARNESS_NAME |
| 388 | if hasattr(task_object, "EVAL_HARNESS_NAME") |
| 389 | else type(task_object).__name__ |
| 390 | ) |
| 391 | |
| 392 | |
| 393 | def get_task_dict(task_name_list: List[Union[str, lm_eval.base.Task]]): |