def parse_params(s):
    """
    Parse parameters into a dictionary, useful for optimizer and scheduler.
    Input should be of the form:
        - "SGD,lr=0.01"
        - "Adam"
    """
    s = s.replace(' ', '').split(',')
    params = {}
    params['name'] = s[0]
    for x in s[1:]:
        x = x.split('=')
        params[x[0]]=float(x[1])
    return params