autodl-projects/xautodl/xmisc/yaml_utils.py

14 lines
390 B
Python
Raw Permalink Normal View History

2021-06-10 11:11:27 +02:00
#####################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2021.06 #
#####################################################
import os
import yaml
def load_yaml(path):
if not os.path.isfile(path):
raise ValueError("{:} is not a file.".format(path))
with open(path, "r") as stream:
data = yaml.safe_load(stream)
return data