set_config.py 501 Bytes
Newer Older
1
import json
2
import os
3
4
5
6
7
8
9
10
11
12
13
14
from easydict import EasyDict


def set_config(args):
    config = {k: v for k, v in vars(args).items()}
    config = EasyDict(config)

    if args.mm_config:
        config.mm_config = json.loads(args.mm_config)
    else:
        config.mm_config = None

15
16
    try:
        with open(os.path.join(args.model_path, "config.json"), "r") as f:
17
18
            model_config = json.load(f)
        config.update(model_config)
19
20
    except Exception as e:
        print(e)
21
22

    return config