Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jbwang1997 committed Jan 31, 2023
1 parent 8b89757 commit 4de2554
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/en/advanced_tutorials/config.md
Expand Up @@ -528,7 +528,7 @@ Config (path: replace_data_root.py): {'dataset_type': 'CocoDataset', 'data_root'

The value of `data_root` has been substituted with the value of `DATASET` as `/new/dataset/path`.

It is noteworthy that both `--cfg-options` and `{{$ENV_VAR:DEF_VAL}}` allow users modified fields in command line. But there is a small difference between those two methods. Environment variable substitution occurs before the configuration parsing. If the replaced field is also involved in other fields assignment, the environment variable substitution will also affect the other fields.
It is noteworthy that both `--cfg-options` and `{{$ENV_VAR:DEF_VAL}}` allow users to modify fields in command line. But there is a small difference between those two methods. Environment variable substitution occurs before the configuration parsing. If the replaced field is also involved in other fields assignment, the environment variable substitution will also affect the other fields.

We take `demo_train.py` and `replace_data_root.py` for example. If we replace `data_root` by setting `--cfg-options data_root='/new/dataset/path'`:

Expand Down
2 changes: 1 addition & 1 deletion mmengine/config/config.py
Expand Up @@ -152,7 +152,7 @@ def __init__(self,
else:
text = ''
super().__setattr__('_text', text)
if not env_variables:
if env_variables is None:
env_variables = dict()
super().__setattr__('_env_variables', env_variables)

Expand Down

0 comments on commit 4de2554

Please sign in to comment.