Merge pull request #38 from wangg12/master

allow .yml extension for config file
pull/39/head
Kai Chen 2019-03-09 15:36:46 -08:00 committed by GitHub
commit 76bcbe2d5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -89,11 +89,11 @@ class Config(object):
for name, value in mod.__dict__.items() for name, value in mod.__dict__.items()
if not name.startswith('__') if not name.startswith('__')
} }
elif filename.endswith(('.yaml', '.json')): elif filename.endswith(('.yml', '.yaml', '.json')):
import mmcv import mmcv
cfg_dict = mmcv.load(filename) cfg_dict = mmcv.load(filename)
else: else:
raise IOError('Only py/yaml/json type are supported now!') raise IOError('Only py/yml/yaml/json type are supported now!')
return Config(cfg_dict, filename=filename) return Config(cfg_dict, filename=filename)
@staticmethod @staticmethod