File size: 549 Bytes
8c02843
 
f392320
8c02843
 
 
 
 
 
f392320
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os


def get_checkpoint_path_from_dir(checkpoint_dir):
    checkpoint_path = None
    for file in os.listdir(checkpoint_dir):
        if "ckpt" in file:
            checkpoint_path = os.path.join(checkpoint_dir, file)
    assert checkpoint_path is not None
    return checkpoint_path


def replace_config_for_testing_data(cfg, testing_data_cfg):
    cfg.DATASET.data_roots = testing_data_cfg.DATASET.data_roots
    cfg.DATASET.index_roots = testing_data_cfg.DATASET.index_roots
    cfg.DATASET.vocab_dir = testing_data_cfg.DATASET.vocab_dir