Load your hyper parameters from a json file.
    :param filepath: Path to the json file.
    :return: A hyper parameters object.

def load_params(filepath):
    """
    Load your hyper parameters from a json file.
    :param filepath: Path to the json file.
    :return: A hyper parameters object.
    """
    # Read the file
    with open(filepath) as file:
        content = file.read()

    # Detect all environment variables referenced (using %EXAMPLE%, use windows style since it is easier to match)
    q = [m.start() for m in re.finditer("%", content)]
    env_vars = []
    for i in range(0, len(q), 2):
        env_var = content[q[i]+1:q[i+1]]
        if env_var not in env_vars:
            if env_var in os.environ:
                env_vars.append(env_var)
            else:
                print("WARNING: Detected an environment variable which is not set.")
    
    # Fill in environment variables
    for env_var in env_vars:
        s = "%" + env_var + "%"
        # Use unix style path linebreaks, since windows style might break stuff (and linux is more common anyways.)
        content = content.replace(s, os.environ[env_var].replace("\\", "/"))

    # Try to match linux path style with anything that matches
    for env_var in list(os.environ.keys()):
        s = "$" + env_var
        content = content.replace(s, os.environ[env_var].replace("\\", "/"))

    # Finally load hyperparams
    return HyperParams(json.loads(jsmin(content)))