Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ICV-mmengine_basecode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Schiffel
ICV-mmengine_basecode
Commits
276ca24e
Unverified
Commit
276ca24e
authored
2 years ago
by
Xiangxu-0103
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Docs] Fix typo in docs/zh_cn/tutorials/config.md (#596)
parent
c5bddea1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/zh_cn/tutorials/config.md
+4
-4
4 additions, 4 deletions
docs/zh_cn/tutorials/config.md
with
4 additions
and
4 deletions
docs/zh_cn/tutorials/config.md
+
4
−
4
View file @
276ca24e
...
...
@@ -308,7 +308,7 @@ print(cfg.a)
{'type': 'MobileNet', 'depth': 50}
```
解析后发现,
`a`
的 type 变成了
`MobileNet
。
`
解析后发现,
`a`
的 type 变成了
`MobileNet`
。
## 配置文件的导出
...
...
@@ -316,7 +316,7 @@ print(cfg.a)
接口来导出更改后的配置文件。与读取配置文件类似,用户可以通过
`cfg.dump('config.xxx')`
来选择导出文件的格式。
`dump`
同样可以导出有继承关系的配置文件,导出的文件可以被独立使用,不再依赖于
`_base_`
中定义的文件。
基于继承一节定义的
`resnet50.py`
,
我们将其加载后导出
:
基于继承一节定义的
`resnet50.py`
,
我们将其加载后导出
:
```
python
cfg
=
Config
.
fromfile
(
'
resnet50.py
'
)
...
...
@@ -394,14 +394,14 @@ print(cfg.work_dir)
-
`{{fileDirname}}`
- 当前文件的目录名,例如
`/home/your-username/your-project/folder`
-
`{{fileBasename}}`
- 当前文件的文件名,例如
`file.py`
-
`{{fileBasenameNoExtension}}`
- 当前文件不包含扩展名的文件名,例如 file
-
`{{fileBasenameNoExtension}}`
- 当前文件不包含扩展名的文件名,例如
`
file
`
-
`{{fileExtname}}`
- 当前文件的扩展名,例如
`.py`
### 命令行修改配置
有时候我们只希望修改部分配置,而不想修改配置文件本身,例如实验过程中想更换学习率,但是又不想重新写一个配置文件,常用的做法是在命令行传入参数来覆盖相关配置。考虑到我们想修改的配置通常是一些内层参数,如优化器的学习率、模型卷积层的通道数等,因此 MMEngine 提供了一套标准的流程,让我们能够在命令行里轻松修改配置文件中任意层级的参数。
1.
使用
`argparse
r
`
解析脚本运行的参数
1.
使用
`argparse`
解析脚本运行的参数
2.
使用
`argparse.ArgumentParser.add_argument`
方法时,让
`action`
参数的值为
[
DictAction
](
mmengine.config.DictAction
)
,用它来进一步解析命令行参数中用于修改配置文件的参数
3.
使用配置类的
`merge_from_dict`
方法来更新配置
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment