-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun.py
43 lines (36 loc) · 1.21 KB
/
run.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
41
42
43
import hydra
from omegaconf import DictConfig
# Imports experiments (necessary to register experiments)
from qinco.qinco_tasks import QincoConvertTask, QincoEvalTask, QincoTrainTask
from qinco.search.search_tasks import (
BuildIndexTask,
EncodeDBTask,
IVFTrainTask,
SearchTask,
TrainPairwiseDecoderTask,
)
EXPERIMENTS = {
"train": QincoTrainTask,
"eval_valset": QincoTrainTask,
"eval": QincoEvalTask,
"eval_time": QincoEvalTask,
"convert": QincoConvertTask,
"ivf_centroids": IVFTrainTask,
"encode": EncodeDBTask,
"build_index": BuildIndexTask,
"train_pairwise_decoder": TrainPairwiseDecoderTask,
"search": SearchTask,
}
@hydra.main(version_base=None, config_path="config", config_name="qinco_cfg")
def main(cfg: DictConfig):
if cfg.task is None:
raise ValueError(
"Please specify a task (train, eval, etc.) using the 'train=<...>' argument"
)
expe = EXPERIMENTS[cfg.task](cfg)
expe.accelerator.print(f"====================== RUNNING TASK {cfg.task}")
expe.run()
expe.accelerator.print("Task done")
expe.accelerator.end_training() # Destroy process group
if __name__ == "__main__":
main() # pylint: disable=all