|
import os |
|
from typing import List, Union |
|
|
|
from lm_eval.utils import load_yaml_config |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def load_changed_files(file_path: str) -> List[str]: |
|
with open(file_path, "r") as f: |
|
content = f.read() |
|
words_list = [x for x in content.split()] |
|
return words_list |
|
|
|
|
|
|
|
|
|
|
|
|
|
def parser(full_path: List[str]) -> List[str]: |
|
_output = set() |
|
for x in full_path: |
|
if os.path.exists(x) and x.endswith(".yaml"): |
|
config = load_yaml_config(x, mode="simple") |
|
if isinstance(config["task"], str): |
|
_output.add(config["task"]) |
|
elif isinstance(config["task"], list): |
|
_output.add(config["group"]) |
|
return list(_output) |
|
|
|
|
|
def new_tasks() -> Union[List[str], None]: |
|
FILENAME = ".github/outputs/tasks_all_changed_and_modified_files.txt" |
|
if os.path.exists(FILENAME): |
|
|
|
|
|
return parser(load_changed_files(FILENAME)) |
|
elif os.getenv("API") is not None: |
|
|
|
|
|
return ["arc_easy", "hellaswag", "piqa", "wikitext"] |
|
|
|
else: |
|
return |
|
|