Skip to content

Commit 6c0a6e7

Browse files
committed
master: fix readme
1 parent fc32640 commit 6c0a6e7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ Following is a recommended usage.
5252
config.parse()
5353
```
5454

55-
2-1. Parse command line arguments.
55+
2-1. Parse command line arguments. example)
5656

5757
```
58-
python -m your_module --use_gpu False
58+
python -m your_module --use_gpu False --model_config.output_dim 256
5959
```
6060

61-
2-2. Import from pre-exported configuration json file. Use ```--load_json``` option.
61+
2-2. Import from pre-exported configuration json file. Use ```--load_json``` option. example)
6262

6363
```
6464
python -m your_module --load_json PATH_TO_JSON_FILE

importify/interface.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,22 @@ def export_json(self, path: str, ignore_error=True) -> bool:
6969
return succeed
7070

7171
# Import Methods
72-
def import_dict(self, data: Dict[str, Any]):
72+
def import_dict(self, data: Dict[str, Any], ignore_error: bool = True):
7373
"""Import arguments from dictionary
7474
7575
Args:
7676
data: dictionary that consists child argument recursively.
77+
ignore_error: ignore error if True.
7778
"""
7879
for key, value in data.items():
7980
if hasattr(self, key):
8081
if isinstance(getattr(self, key), Serializable):
8182
setattr(self, key, getattr(self, key).import_dict(value))
8283
else:
8384
setattr(self, key, value)
85+
else:
86+
if not ignore_error:
87+
raise KeyError("[!] Invalid key during import")
8488
return self
8589

8690
@classmethod

0 commit comments

Comments
 (0)