-
Notifications
You must be signed in to change notification settings - Fork 2
/
paths.py
40 lines (29 loc) · 1.65 KB
/
paths.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
import pathlib
ABSOLUTE_PATH_PROJ = str(pathlib.Path(__file__).parent.resolve())
# DATASET_PATH = os.path.join(ABSOLUTE_PATH_PROJ, "data", "_data_old")
DATASET_PATH = os.path.join(ABSOLUTE_PATH_PROJ, "data")
TSV_PATH = os.path.join(DATASET_PATH, "tsv")
JSONL_PATH = os.path.join(DATASET_PATH, "jsonl")
RESULTS_PATH = os.path.join(ABSOLUTE_PATH_PROJ, "results")
TRAINER_OUTPUT_PATH = os.path.join(RESULTS_PATH, "trainer_output")
RAY_RESULTS_PATH = os.path.join(RESULTS_PATH, "ray_results")
EXPERIMENTS_PATH = os.path.join(RESULTS_PATH, "experiments")
METRICS_PATH = os.path.join(EXPERIMENTS_PATH, "metrics")
MODELS_PATH = os.path.join(EXPERIMENTS_PATH, "models")
PREDICTIONS_PATH = os.path.join(EXPERIMENTS_PATH, "predictions")
EXPERIMENT_METRICS_PATH_TEMPLATE = os.path.join(METRICS_PATH, "{task}", "{model}")
EXPERIMENT_PREDICTIONS_PATH_TEMPLATE = os.path.join(PREDICTIONS_PATH, "{model}", "{task}")
EXPERIMENT_MODELS_PATH_TEMPLATE = os.path.join(MODELS_PATH, "{task}", "{model}")
def get_experiment_metrics_path(task: str, model: str) -> str:
safe_task = task.replace("/", "-")
safe_model = model.replace("/", "-")
return EXPERIMENT_METRICS_PATH_TEMPLATE.format(task=safe_task, model=safe_model)
def get_experiment_predictions_path(task: str, model: str) -> str:
safe_task = task.replace("/", "-")
safe_model = model.replace("/", "-")
return EXPERIMENT_PREDICTIONS_PATH_TEMPLATE.format(model=safe_model, task=safe_task)
def get_experiment_models_path(task: str, model: str) -> str:
safe_task = task.replace("/", "-")
safe_model = model.replace("/", "-")
return EXPERIMENT_MODELS_PATH_TEMPLATE.format(task=safe_task, model=safe_model)