File size: 1,795 Bytes
9877759
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
44
45
46
47
48
49
50
51
52
53
54
55
56
import json
import argparse
from trainer import train
import json

def string_to_list(args):
    """
    Convert a JSON string to a Python list.
    
    Args:
        args (str): JSON string representing a list.
    
    Returns:
        list: Parsed list from the JSON string.
    """
    return json.loads(args)

def main():
    """
    Function to set up the training process. 
    Parses command line arguments, loads configuration from a JSON file, and starts the training.
    """
    # Parse command-line arguments
    args = setup_parser().parse_args()
    param = load_json(args.config)
    args = vars(args) 
    args.update(param) 
    train(args)

def load_json(settings_path):
    """
    Load parameters from a JSON file.
    
    Args:
        settings_path (str): Path to the JSON configuration file.
    
    Returns:
        dict: Configuration parameters loaded from the JSON file.
    """
    with open(settings_path) as data_file:
        param = json.load(data_file)
    return param

def setup_parser():
    parser = argparse.ArgumentParser(description='Reproduce of multiple continual learning algorthms.')
    parser.add_argument('--config', type=str, default='./exps/finetune.json', help='Json file of settings.')
    parser.add_argument('--dataset', default="gnss", help="Kind of dataset",  type=str)
    parser.add_argument('--summary_file', type=str, default='run_new',help='path for the tensorboard experiment')
    parser.add_argument('--layers', help='delimited list input',  type=string_to_list)
    parser.add_argument('--type', default="normal", help='Type of memo models (normal or avg)',  type=str)
    parser.add_argument('--convnet_type', default="memo_resnet32", help="Kind of resnet",  type=str)
    return parser

if __name__ == '__main__':
    main()