Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] Delete redundant set_random_seed function #104

Merged
merged 7 commits into from
Mar 16, 2022

Conversation

wutongshenqiu
Copy link
Contributor

@wutongshenqiu wutongshenqiu commented Mar 7, 2022

Motivation

Delete redundant set_random_seed function.

Modification

Delete the set_random_seed function in apis/xxx/train.py and put it in a separated utils.py file.
Modify mmrazor.api.mmseg.train_segmentor to mmrazor.api.mmseg.train_mmseg_model
Modify mmrazor.api.mmdet.train_detector to mmrazor.api.mmseg.train_mmdet_model
Modify mmrazor.api.mmseg.train_model to mmrazor.api.mmseg.train_mmcls_model

BC-Breaking

If train_segmentor, train_detector, or train_model is used in your developed codes, you need to modify them.

Checklist

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues.

@codecov
Copy link

codecov bot commented Mar 7, 2022

Codecov Report

Merging #104 (3738545) into dev_v0.3.0 (f48509a) will increase coverage by 2.56%.
The diff coverage is 76.92%.

Impacted file tree graph

@@              Coverage Diff               @@
##           dev_v0.3.0     #104      +/-   ##
==============================================
+ Coverage       62.89%   65.45%   +2.56%     
==============================================
  Files              89       91       +2     
  Lines            3202     3257      +55     
  Branches          585      597      +12     
==============================================
+ Hits             2014     2132     +118     
+ Misses           1084     1025      -59     
+ Partials          104      100       -4     
Flag Coverage Δ
unittests 65.42% <76.92%> (+2.53%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmrazor/apis/mmcls/train.py 28.20% <37.50%> (+5.66%) ⬆️
mmrazor/apis/mmdet/train.py 26.31% <37.50%> (+6.02%) ⬆️
mmrazor/apis/mmseg/train.py 34.54% <37.50%> (+7.46%) ⬆️
mmrazor/apis/__init__.py 100.00% <100.00%> (ø)
mmrazor/apis/mmcls/__init__.py 100.00% <100.00%> (ø)
mmrazor/apis/mmdet/__init__.py 62.50% <100.00%> (ø)
mmrazor/apis/mmseg/__init__.py 62.50% <100.00%> (ø)
mmrazor/apis/utils.py 100.00% <100.00%> (ø)
mmrazor/utils/__init__.py 100.00% <100.00%> (ø)
mmrazor/utils/misc.py 100.00% <100.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 31daca6...3738545. Read the comment docs.

@pppppM pppppM closed this Mar 8, 2022
@pppppM pppppM reopened this Mar 8, 2022
@wutongshenqiu wutongshenqiu changed the base branch from master to dev_v0.3.0 March 9, 2022 02:01
@pppppM pppppM merged commit 20d1e0b into open-mmlab:dev_v0.3.0 Mar 16, 2022
pppppM pushed a commit to humu789/mmrazor that referenced this pull request Mar 27, 2022
* refactor set_random_seed

* add unittests

* fix unittests error

* fix lint

* avoid bc breaking
pppppM added a commit that referenced this pull request Apr 2, 2022
* [Feature] Add function to meet mmdeploy support (#102)

* add init_model function for mmdeploy

* fix lint

* add unittest for init_xxx_model

* fix lint

* mv test_inference.py to test_apis directory

* [Feature] Add function to meet mmdeploy support (#102)

* add init_model function for mmdeploy

* fix lint

* add unittest for init_xxx_model

* fix lint

* mv test_inference.py to test_apis directory

* [Refactor] Delete redundant `set_random_seed` function (#104)

* refactor set_random_seed

* add unittests

* fix unittests error

* fix lint

* avoid bc breaking

* [Feature] Add diff seeds to diff ranks and set torch seed in worker_init_fn (#113)

* add init_random_seed

* Set diff seed to diff workers

* [Feature] Add multi machine dist_train (#114)

* support multi nodes

* update training doc

* fix lints

* remove fixed seed

* fix ddp wrapper registry (#128)

* [Docs] Add brief installation steps in README(_zh-CN).md (#121)

* Add brief installation

* add brief installtion ref to mmediting pr#816

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* [BUG]Fix bugs in pruner (#126)

* fix bugs in pruner when pruning models with shared modules

* pruner can trace models with dilation conv2d

* fix deploy_subnet

* fix add_pruning_attrs

* fix bugs in modify_forward

* fix lint

* fix StructurePruner

* test tracing models with shared modules

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* [Docs]Add some more details to docs (#133)

* add docs for dataset

* add cfg-options for distillation

* fix docs

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* reset norm running status after prepare_from_supernet (#81)

* [Improvement]Sync train api (#115)

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* [Feature]Support Relational Knowledge Distillation (#127)

* add rkd

* add rkd pytest

* add rkd configs

* fix readme

* fix rkd

* split rkd loss to distance-wise and angle-wise losses

* rename rkd losses

* add rkd metaflie

* add rkd related links

* rename rkd metafile and add to model index

* delete cifar100

Co-authored-by: caoweihan <caoweihan@sensetime.com>
Co-authored-by: pppppM <gjf_mail@126.com>

Co-authored-by: qiufeng <44188071+wutongshenqiu@users.noreply.github.com>
Co-authored-by: wutongshenqiu <690364065@qq.com>
Co-authored-by: whcao <41630003+HIT-cwh@users.noreply.github.com>
Co-authored-by: caoweihan <caoweihan@sensetime.com>
@wutongshenqiu wutongshenqiu deleted the refactor-set-random-seed branch May 12, 2022 05:24
pppppM added a commit to pppppM/mmrazor that referenced this pull request Jul 15, 2022
* [Feature] Add function to meet mmdeploy support (open-mmlab#102)

* add init_model function for mmdeploy

* fix lint

* add unittest for init_xxx_model

* fix lint

* mv test_inference.py to test_apis directory

* [Feature] Add function to meet mmdeploy support (open-mmlab#102)

* add init_model function for mmdeploy

* fix lint

* add unittest for init_xxx_model

* fix lint

* mv test_inference.py to test_apis directory

* [Refactor] Delete redundant `set_random_seed` function (open-mmlab#104)

* refactor set_random_seed

* add unittests

* fix unittests error

* fix lint

* avoid bc breaking

* [Feature] Add diff seeds to diff ranks and set torch seed in worker_init_fn (open-mmlab#113)

* add init_random_seed

* Set diff seed to diff workers

* [Feature] Add multi machine dist_train (open-mmlab#114)

* support multi nodes

* update training doc

* fix lints

* remove fixed seed

* fix ddp wrapper registry (open-mmlab#128)

* [Docs] Add brief installation steps in README(_zh-CN).md (open-mmlab#121)

* Add brief installation

* add brief installtion ref to mmediting pr#816

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* [BUG]Fix bugs in pruner (open-mmlab#126)

* fix bugs in pruner when pruning models with shared modules

* pruner can trace models with dilation conv2d

* fix deploy_subnet

* fix add_pruning_attrs

* fix bugs in modify_forward

* fix lint

* fix StructurePruner

* test tracing models with shared modules

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* [Docs]Add some more details to docs (open-mmlab#133)

* add docs for dataset

* add cfg-options for distillation

* fix docs

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* reset norm running status after prepare_from_supernet (open-mmlab#81)

* [Improvement]Sync train api (open-mmlab#115)

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* [Feature]Support Relational Knowledge Distillation (open-mmlab#127)

* add rkd

* add rkd pytest

* add rkd configs

* fix readme

* fix rkd

* split rkd loss to distance-wise and angle-wise losses

* rename rkd losses

* add rkd metaflie

* add rkd related links

* rename rkd metafile and add to model index

* delete cifar100

Co-authored-by: caoweihan <caoweihan@sensetime.com>
Co-authored-by: pppppM <gjf_mail@126.com>

Co-authored-by: qiufeng <44188071+wutongshenqiu@users.noreply.github.com>
Co-authored-by: wutongshenqiu <690364065@qq.com>
Co-authored-by: whcao <41630003+HIT-cwh@users.noreply.github.com>
Co-authored-by: caoweihan <caoweihan@sensetime.com>
pppppM added a commit to pppppM/mmrazor that referenced this pull request Jul 15, 2022
* [Feature] Add function to meet mmdeploy support (open-mmlab#102)

* add init_model function for mmdeploy

* fix lint

* add unittest for init_xxx_model

* fix lint

* mv test_inference.py to test_apis directory

* [Feature] Add function to meet mmdeploy support (open-mmlab#102)

* add init_model function for mmdeploy

* fix lint

* add unittest for init_xxx_model

* fix lint

* mv test_inference.py to test_apis directory

* [Refactor] Delete redundant `set_random_seed` function (open-mmlab#104)

* refactor set_random_seed

* add unittests

* fix unittests error

* fix lint

* avoid bc breaking

* [Feature] Add diff seeds to diff ranks and set torch seed in worker_init_fn (open-mmlab#113)

* add init_random_seed

* Set diff seed to diff workers

* [Feature] Add multi machine dist_train (open-mmlab#114)

* support multi nodes

* update training doc

* fix lints

* remove fixed seed

* fix ddp wrapper registry (open-mmlab#128)

* [Docs] Add brief installation steps in README(_zh-CN).md (open-mmlab#121)

* Add brief installation

* add brief installtion ref to mmediting pr#816

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* [BUG]Fix bugs in pruner (open-mmlab#126)

* fix bugs in pruner when pruning models with shared modules

* pruner can trace models with dilation conv2d

* fix deploy_subnet

* fix add_pruning_attrs

* fix bugs in modify_forward

* fix lint

* fix StructurePruner

* test tracing models with shared modules

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* [Docs]Add some more details to docs (open-mmlab#133)

* add docs for dataset

* add cfg-options for distillation

* fix docs

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* reset norm running status after prepare_from_supernet (open-mmlab#81)

* [Improvement]Sync train api (open-mmlab#115)

Co-authored-by: caoweihan <caoweihan@sensetime.com>

* [Feature]Support Relational Knowledge Distillation (open-mmlab#127)

* add rkd

* add rkd pytest

* add rkd configs

* fix readme

* fix rkd

* split rkd loss to distance-wise and angle-wise losses

* rename rkd losses

* add rkd metaflie

* add rkd related links

* rename rkd metafile and add to model index

* delete cifar100

Co-authored-by: caoweihan <caoweihan@sensetime.com>
Co-authored-by: pppppM <gjf_mail@126.com>

Co-authored-by: qiufeng <44188071+wutongshenqiu@users.noreply.github.com>
Co-authored-by: wutongshenqiu <690364065@qq.com>
Co-authored-by: whcao <41630003+HIT-cwh@users.noreply.github.com>
Co-authored-by: caoweihan <caoweihan@sensetime.com>
humu789 pushed a commit to humu789/mmrazor that referenced this pull request Feb 13, 2023
* add cuda11.1 config

* add onnx

* update

* remove onnx

* lock mmcls version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants