-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·22 lines (21 loc) · 1.03 KB
/
Copy pathmain.py
File metadata and controls
executable file
·22 lines (21 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from src.trainer import Trainer
from src.rerank_data_generation import RerankDataGenerator
from utils.arguments import get_configuration
from utils.config import ModelType, DatasetType
if __name__ == "__main__":
cfg = get_configuration()
if cfg.model.model_type == ModelType.fine_matching and cfg.generate_data:
cfg.model.model_type = ModelType.coarse_matching
generator = RerankDataGenerator(device=cfg.gpus.device, model_cfg=cfg.model, snapshot=cfg.snapshot,
distance_type=cfg.loss.distance_type, sanity_check=cfg.sanity_check,
data_loader_cfg=cfg.data_loader, rerank_num=cfg.rerank_num)
types = [DatasetType.training]
if cfg.evaluation_freq > 0:
types.append(DatasetType.evaluation)
if cfg.recall_frequency > 0:
types.append(DatasetType.test)
generator.run(types)
# cfg.model.model_type = ModelType.fine_matching
else:
trainner = Trainer(cfgs=cfg)
trainner.run()