Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion convert_params_compute_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
def load_config(file_path):
_, ext = os.path.splitext(file_path)
assert ext in [".yml", ".yaml"], "only support yaml files for now"
config = yaml.load(open(file_path, "rb"), Loader=yaml.Loader)
config = yaml.load(open(file_path, "rb"), Loader=yaml.SafeLoader)
return config


Expand Down
6 changes: 3 additions & 3 deletions torchocr/engine/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ def _parse_opt(self, opts):
s = s.strip()
k, v = s.split('=', 1)
if '.' not in k:
config[k] = yaml.load(v, Loader=yaml.Loader)
config[k] = yaml.load(v, Loader=yaml.SafeLoader)
else:
keys = k.split('.')
if keys[0] not in config:
config[keys[0]] = {}
cur = config[keys[0]]
for idx, key in enumerate(keys[1:]):
if idx == len(keys) - 2:
cur[key] = yaml.load(v, Loader=yaml.Loader)
cur[key] = yaml.load(v, Loader=yaml.SafeLoader)
else:
cur[key] = {}
cur = cur[key]
Expand Down Expand Up @@ -116,7 +116,7 @@ def _load_config_with_base(self, file_path):
assert ext in ['.yml', '.yaml'], "only support yaml files for now"

with open(file_path) as f:
file_cfg = yaml.load(f, Loader=yaml.Loader)
file_cfg = yaml.load(f, Loader=yaml.SafeLoader)

# NOTE: cfgs outside have higher priority than cfgs in _BASE_
if self.BASE_KEY in file_cfg:
Expand Down