def get_params(experiment_dir_str):
  """Extracts hyperparams from experiment directory string.

  Args:
    experiment_dir_str: The folder-name for the set of hyperparams. Eg:
      '1-al=1.0,ap=False,lr=0.0001,ms=small,qat=False,tbs=512'

  Returns:
    A dict mapping param key (str) to eval'ed value (float/eval/string).
  """
  parsed_params = {}
  start_idx = experiment_dir_str.find('-') + 1
  for kv in experiment_dir_str[start_idx:].split(','):
    cur_split = kv.split('=')
    if len(cur_split) != 2:
      raise ValueError(f'Folder doesn\'t split properly: {kv}')
    key, value = cur_split
    try:
      value = eval(value)  # pylint: disable=eval-used
    except:  # pylint: disable=bare-except
      pass
    parsed_params[key] = value
  return parsed_params