<reponame>kulShah/Tensorflow-Project-Template
import json
import os
from bunch import Bunch

def get_config_from_json(json_file):
    """
    Get the config from a JSON file
    param: json_file
    return: config(namespace) or config(dictionary)
    """

    # parse the configs from the config json file provided
    with open(json_file, 'r') as config_file:
        config_dict = json.load(config_file)

    # convert the dictionary to a namespace using bunch lib
    config = Bunch(config_dict)

    return config, config_dict

def process_config_file(json_file):
    config, _ = get_config_from_json(json_file)
    config.summary_dir = os.path.join("../experiments", config.exp_name, "summary/")
    config.checkpoints_dir = os.path.join("../experiments", config.exp_name, "checkpoint/")
    return config
import json
import os
from bunch import Bunch

def get_config_from_json(json_file):
    """
    Get the config from a JSON file
    param: json_file
    return: config(namespace) or config(dictionary)
    """

    # parse the configs from the config json file provided
    with open(json_file, 'r') as config_file:
        config_dict = json.load(config_file)

    # convert the dictionary to a namespace using bunch lib
    config = Bunch(config_dict)

    return config, config_dict

def process_config_file(json_file):
    config, _ = get_config_from_json(json_file)
    config.summary_dir = os.path.join("../experiments", config.exp_name, "summary/")
    config.checkpoints_dir = os.path.join("../experiments", config.exp_name, "checkpoint/")
    return config
Get the config from a JSON file     param: json_file     return: config(namespace) or config(dictionary) # parse the configs from the config json file provided # convert the dictionary to a namespace using bunch lib