262 Commits

Author SHA1 Message Date
RangiLyu
25014af3c3
[Refactor] Refactor default_scope in Registry. (#158) 2022-04-01 09:13:55 +08:00
Haian Huang(深度眸)
dc594e75bf
[Feature] Add InstanceData (#160)
* [Enhancement] refactor base data elment

* fix comment

* fix comment

* fix pop not existing key without error

* add instance_data

* update

* refine code

* add refer

Co-authored-by: liukuikun <641417025@qq.com>
2022-03-31 23:30:00 +08:00
Zaida Zhou
e80267ae06
[Fix] Fix unit tests of evaluator (#162) 2022-03-31 23:25:50 +08:00
liukuikun
7e246b6f65
[Enhancement] refactor base data element (#143)
* [Enhancement] refactor base data elment

* fix comment

* fix comment

* fix pop not existing key without error
2022-03-31 18:21:45 +08:00
Zaida Zhou
f1de071cf0
[Enhancement] Refactor Runner (#139)
* [Enhancement] Rename build_from_cfg to from_cfg

* refactor build_logger and build_message_hub

* remove time.sleep from unit tests

* minor fix

* move set_randomness from setup_env

* improve docstring

* refine comments

* print a warning information

* refine comments

* simplify the interface of build_logger
2022-03-30 14:26:40 +08:00
RangiLyu
9a61b389e7
[Refactor] Add batch_idx to hook input. (#140)
* [Refactor] Add batch_idx to hook input.

* update
2022-03-29 11:40:38 +08:00
Mashiro
563b4bad16
[Feature] add defaut scope (#149)
* add defaut scope

* Fix docstring

* override get_current_instance method in DefaultScope

clean meta nameing

* remove default mmengine argument of DefaltScope

remove default mmengine argument of DefaltScope

remove default mmengine argument of DefaltScope

* Fix unit test

Fix unit test

* Fix example in docstring

* add explaination of DefaultScope
2022-03-28 23:14:41 +08:00
Mashiro
1048584147
[Enhancement] Refine GlobalAccessble (#144)
* rename global accessible and intergration get_sintance and create_instance

* move ManagerMixin to utils

* fix as docstring and seporate get_instance to get_instance and get_current_instance

* fix lint

* fix docstring, rename and move test_global_meta

* fix manager's runtime error description

fix manager's runtime error description

* Add comments

* Add comments
2022-03-26 21:21:25 +08:00
Yuan Liu
26f24296db
[Feature]: Add dist semantics in checkpoint hook (#131)
* [Feature]: Add dist semantics in checkpoint hook

* [Fix]: Delete sync buffer in checkpoint hook
2022-03-25 13:46:31 +08:00
Zaida Zhou
248ad9aee8
[Feature] Add Runner and Loop (#86)
* [Feature] Add Runner and Loop

* refine docstring

* refine docstring

* refine __init__ of Runner

* add Runner.save_checkpoint

* add comment for data_batch

* rename validation_cfg to val_cfg

* update branch

* update branch

* discard wear reference

* set seed for torch in dataloader worker

* refine comments

* reorder methods

* import module in __init__.py

* add runner.load_checkpoint

* rename attributes

* fix indent

* fix indent

* add comment for LOOPS

* add example for methods

* add example for methods

* refine examples

* add Runner.resume and refactor register_hooks

* remove type hint of runner in CheckpointHook

* rename before_run to before_train

* remove collate

* add before_run after_run for loop.run

* dummy collate_fn

* add more unit tests

* move call_hook('before_run') to runner

* minor fix

* add comments for collate_fn

* fix type hint

* refactor logic to load or resume checkpoint

* fix typo

* add comments for IterBasedTrainLoop

* refactor unit tests

* fix unit tests

* refactor

* fix setup_env

* refine

* minor fix

* Merge branch 'main' of github.com:open-mmlab/mmengine into zzd/add-runner

* minor fix

* minor fix

* refine

* refactor unit tests

* fix unit tests

* add launcher property

* add logger, message_hub and writer unit tests

* add cur_dataloader attribute for runner

* fix IterBasedTrainLoop

* add torch.no_grad decorator

* add master_only decorator for save_checkpoint

* add before_test_epoch in TestLoop

* refactor load_or_resume method

* refine docstring

* fix typo

* build_dataloader can handle dataset object

* add dump_config for runner

* collate_fn should not a lambda function

* minor fix

* refine docstring

* fix unit tests

* improve comments

* refine unit tests

* rename collate_fn to pseduo_collate

* add 'TODO' tag
2022-03-14 13:19:29 +08:00
Zaida Zhou
b3d54481fd
[Fix] Fallback to use self registry if default_scope not found (#122) 2022-03-14 00:44:16 +08:00
Mashiro
fff4742e0b
[Enhancement] Messagehub supports update dict logs. (#120)
* Messagehub support update dict values

* Messagehub support update dict values

* fix assertion error message
2022-03-13 21:28:47 +08:00
Zaida Zhou
f548c81846
[Enhancement] Handle tensor device type in sync_random_seed (#126) 2022-03-13 17:45:02 +08:00
Mashiro
a7961407e4
[Refactor] Refactor the interfaces of Hook and its subclassed (#117)
* Fix hook

* Fix

* Fix docs

* FIx

* Fix

* Fix as comment

* update

* Fix hook

* Fix hook

* Fix hook

* Fix itertimerhook

* Fix iter_timer_hook

* Fix

* Fix

* fix logger hook

* Fix loggerhook

* update cur_dataloader

* Fix docstring

* Fix docstring

* Fix as commet

* Fix as commet

* Fix as comment

* rename is_last_epoch, enhance and add after_val before_val .etc

* fix typo in docstring

* remove resolved TODO

* refactor docstring
2022-03-13 16:48:09 +08:00
Yuan Liu
755f8b5b59
[Refactor]: Change scheduler to param_scheduler (#121)
* [Refactor]: Change scheduler to param_scheduler

* [Fix]: Fix UT of param scheduler hook

Co-authored-by: Your <you@example.com>
2022-03-12 10:47:06 +08:00
Yining Li
61fecabea6
[Feature] Update evaluator prefix (#114)
* update evaluator prefix

* update docstring and comments

* update doc
2022-03-10 17:25:20 +08:00
liukuikun
3e0c064f49
[Feature] NaiveVisualizationHook (#98)
* [WIP] testvisualizationhook

* add TestNaiveVisualizationHook

* fix comment

* unpad

* batch imdenormalize

* fix comment

* fix comment
2022-03-10 17:22:31 +08:00
Mashiro
02ceaedb82
[Enhancement] Config support deep copy (#116)
* Config support deep copy

* Fix end of line
2022-03-10 16:01:18 +08:00
Mashiro
2e4ae21f2b
Fix test_get_max_memory (#113) 2022-03-09 14:05:25 +08:00
RangiLyu
c499d72691
fix evaluator unit test (#112) 2022-03-08 20:07:32 +08:00
Mashiro
6f69039ca9
[Feature] Add LoggerHook (#77)
* add logger hook

* update

* update

* update test

* update

* update test

* update

* update

* update

* update

* update

* Add logger hook

* Fix pre-commit

* Fix as comment

* Fix as comment

* Fix as comment

* Fix as comment

* Fix as comment

* Fix bytes

* update

* Fix as comment

* Fix as comment

* Update runner

* Fix as comment

* Fix as comment

* Fix as comment

* Fix as comment
2022-03-08 16:10:30 +08:00
RangiLyu
49b7d0ce6f
Support default_scope when building optimizer and evaluator. (#109)
* Support default_scope when building optimizer and evaluator.

* add docstring

* fix

* fix
2022-03-08 16:05:29 +08:00
RangiLyu
be6f18988e
Update type hint and unit tests of evaluator. (#110)
* update type hint and ut for evaluator

* update doc

* fix
2022-03-08 16:04:46 +08:00
Yining Li
cfccabc657
[Feature] Support metric prefix in BaseEvaluator (#82)
* support metric prefix in BaseEvaluator

* update docs

* use class attribute default_prefix
2022-03-08 15:12:11 +08:00
Haian Huang(深度眸)
824be950b9
Add writer (#74)
* add writer

* update

* update

* update docstr

* update unittest

* update unittest

* fix comment

* update unittest

* fix comment

* fix comment

* fix comment

* fix comment

* update
2022-03-07 22:39:25 +08:00
liukuikun
7acaca1445
Visualizer (#67)
* [WIP] Visualizer

* add draw featmap

* update docstring

* update docstring

* update docstring

* fix comment

* fix comment

* fix comment

* fix comment

* fix comment
2022-03-07 22:06:32 +08:00
Yuan Liu
be9971781e
[Fix]: Change the type of runner in docstring to Runner (#103)
* [Fix]: Change after inter and epoch to after train iter and epoch

* [Fix]: Add new UT to param scheduler hook

* [Fix]: Change the type of runner in docstring to Runner

Co-authored-by: Your <you@example.com>
2022-03-07 14:00:05 +08:00
liukuikun
3adf4ea6b8
[Fix] data element (#95) 2022-03-06 22:06:12 +08:00
Mashiro
2d782b4998
[Feature] add logging UT and impl (#43)
* first commit

* update logging

* update MessageHub unit test and LogBuffer unitest

* update logging docs

* update logging impl and test

* update test logging

* update test

* update logging test and impl

* Fix logging test

* Update log_buffer.py

* rename statistics argumentes

* fix as comment

* Fix as comment

* Fix as comment

* Fix as comment

* Fix meta class

* Fix as comment

* Fix as comment

* Fix as comment

* Fix name declare

* Fix as comment

* Fix as comment

* Fix as comment

* Fix docstring

* Fix as comment

* Fix as comment
2022-03-06 17:09:12 +08:00
Zaida Zhou
c6a8d72c5e
[Feature] Add distributed module (#59)
* [Feature] Add distributed module

* fix IS_DIST error

* all_reduce_dict does operations in-place

* support 'mean' operation

* provide local group process

* add tmpdir argument for collect_results

* add unit tests

* refactor unit tests

* simplify steps to create multiple processes

* minor fix

* describe the different of *gather* in mmengine and pytorch

* minor fix

* add unit tests for nccl

* test nccl backend in multiple gpu

* add get_default_group function to handle different torch versions

* minor fix

* [Feature] Add distributed module

* fix IS_DIST error

* all_reduce_dict does operations in-place

* support 'mean' operation

* provide local group process

* add tmpdir argument for collect_results

* add unit tests

* refactor unit tests

* simplify steps to create multiple processes

* minor fix

* describe the different of *gather* in mmengine and pytorch

* minor fix

* add unit tests for nccl

* test nccl backend in multiple gpu

* add get_default_group function to handle different torch versions

* minor fix

* minor fix

* handle torch1.5

* handle torch1.5

* minor fix

* fix typo

* refactor unit tests

* nccl does not support gather and gather_object

* fix gather

* fix collect_results_cpu

* fix collect_results and refactor unit tests

* fix collect_results unit tests

* handle torch.cat in torch1.5

* refine docstring

* refine docstring

* fix comments

* fix comments
2022-03-05 22:03:32 +08:00
liukuikun
11b38b12d6
[Fix] fix random may generate same value (#85) 2022-03-05 15:02:54 +08:00
RangiLyu
64b1d183b9
Add runner unit tests. (#68)
* add runner unit tests

* update

* update

* add test custom loop and hook

* add test model wrapper

* add test setup env

* fix typo

* fix launcher

* fix typo

* test default scope

* add logger test

* fix dataloader

* add test loop

* resolve comments

* resolve comments
2022-03-03 19:44:36 +08:00
Yifei Yang
149248ce52
[Feature] Add Sync Buffer Hook (#57)
* [Feature]: Add Part3 of Hooks

* [Feature]: Add Hook

* [Fix]: Add docstring and type hint for base hook

* add sync buffer hook

* update typing hint and docs

* fix lint

* fix mypy

* fix lint

* use mock from unittest

Co-authored-by: seuyou <3463423099@qq.com>
2022-03-03 17:13:43 +08:00
Mashiro
12b916cf6f
[Feature] add base global access (#72)
* add impl

* add test

* Fix as comment

* Fix as comment

* Fix as comment

* Fix as comment
2022-03-02 23:38:04 +08:00
Yuan Liu
cf239a2b17
[Feature]: Add checkpoint hook (#66)
* [Feature]: Add checkpoint hook

* [Fix]: Fix lint

* [Fix]: Delete redundant optional and give an example to our_dir

* [Feature]: Add test the last_ckpt in UT

* [Fix]: Fix docstring problem

* [Fix]: Add patch to UT

* [Feature]: Add Test case for by epoch
2022-03-02 22:01:58 +08:00
Yifei Yang
2448380339
use unittest mock (#71) 2022-03-02 21:53:40 +08:00
Yifei Yang
94ab45d07e
[Feature] Add empty cache hook (#58)
* [Feature]: Add Part3 of Hooks

* [Feature]: Add Hook

* [Fix]: Add docstring and type hint for base hook

* [Fix]: Add test case to not the last iter, inner_iter, epoch

* [Fix]: Add missing type hint

* [Feature]: Add Args and Returns in docstring

* [Fix]: Add missing colon

* [Fix]: Add optional to docstring

* [Fix]: Fix docstring problem

* [Fix]: Fix lint

* fix lint

* update typing and docs

* fix lint

* Update mmengine/hooks/empty_cache_hook.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update mmengine/hooks/empty_cache_hook.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update mmengine/hooks/empty_cache_hook.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update tests/test_hook/test_empty_cache_hook.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* fix lint

* fix comments

* remove test condition

Co-authored-by: seuyou <3463423099@qq.com>
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
2022-03-02 14:04:41 +08:00
Yuan Liu
63a3af4f8c
[Feature]: Add optimizer hook (#70)
* [Feature]: Add optimizer hook

* [Fix]: Update docstring

* [Fix]: Add call with in UT
2022-03-01 17:42:15 +08:00
Yuan Liu
ab31e1936e
[Feature]: Add param scheduler hook (#63)
* [Feature]: Add param scheduler hook

* [Fix]: update docstring and add assert_call to UT
2022-03-01 15:49:44 +08:00
Yuan Liu
2d3e91248c
[Feature]: Add sampler seed hook (#64)
* [Feature]: Add sampler seed hook

* [Fix]: Add call with to UT
2022-03-01 15:38:01 +08:00
Yifei Yang
1244e486ae
[Feature] Add Iter Timer Hook (#48)
* [Feature]: Add Part3 of Hooks

* [Feature]: Add Hook

* add iter timer hook

* update test

* [Fix]: Add docstring and type hint for base hook

* fix mypy

* improve doc coverage and merge main

Co-authored-by: seuyou <3463423099@qq.com>
2022-03-01 12:02:34 +08:00
Yining Li
42448425b3
[Feature] Add evaluator unittest (#46)
* add evaluator unittest

* update composed evaluator cfg

* add building function

* resolve comments

* resolve comments

* resolve comments

* fix evaluator doc
2022-03-01 12:00:19 +08:00
RangiLyu
c2c5664fad
Fix pt1.5 unit tests. (#65)
* Fix pt1.5 unit tests.

* move to mmengine.testing
2022-03-01 11:28:21 +08:00
Haian Huang(深度眸)
5170676a2f
fix mmdp unittest (#60) 2022-02-27 20:34:52 +08:00
Yuan Liu
bc759e5550
[Feature]: Add base Hook (#47)
* [Feature]: Add Part3 of Hooks

* [Feature]: Add Hook

* [Fix]: Add docstring and type hint for base hook

* [Fix]: Add test case to not the last iter, inner_iter, epoch

* [Fix]: Add missing type hint

* [Feature]: Add Args and Returns in docstring

* [Fix]: Add missing colon

* [Fix]: Add optional to docstring

* [Fix]: Fix docstring problem

* [Fix]:typo

* [Fix]: Fix lint

Co-authored-by: Your <you@example.com>
2022-02-26 14:51:09 +08:00
Haian Huang(深度眸)
492b2f2fa8
[Feature] Add MMDataParallel and MMDistributedDataParallel (#44)
* add mmddp

* update

* update code

* update unittest

* fix comment
2022-02-26 10:21:20 +08:00
Zaida Zhou
1e79b97444
Mock unimplemented modules and fix unit tests (#54)
* Mock unimplemented modules and fix unit tests

* add a comment
2022-02-25 15:24:27 +08:00
liukuikun
9437ebea67
[Feat]: Add abstract data structure (#29)
* [WIP] abstract-data-structure

* update docs

* update

* update BaseDataSample

* fix comment and coverage 100%

* update and add _set_field

* update

* split  into base_data_element and base_data_sample

* update

* update

* update

* fix typo
2022-02-22 21:45:32 +08:00
Mashiro
ada6660c65
[Feature] add base dataset (#32)
* basedataset first commit

* add base dataset

* add dataset

* add basedataset

* Fix test dataset

* Fix mypy and test

* Fix mypy and test

* remove unused code

* Update mmengine/dataset/base_dataset.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* Update mmengine/dataset/base_dataset.py

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>

* add more corner cases in unittest

* fix lint

* Fix as comment

* Fix lint

* update unitest

* Type hint Dick to dict

* rename max_refetch

* Fix as comment

* Fix typo

* Fix as comment

* BaseDataset is no more an abstrac Class, change UT and docs

* Fix as comment

* Fix as comment and refactor type error

* Add comment for full init

* Fix as comment and modify dataset_wrapper

* Fix as comment and modify dataset_wrapper

* Fix as comment

* Fix as comment

* Fix as comment

* Fix as comment

* Fix as comment

* Fix as comment

* Fix as comment

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
Co-authored-by: Tao Gong <gongtao950513@gmail.com>
2022-02-22 14:01:06 +08:00
Haian Huang(深度眸)
adb2aee8c2
[Unittest] Add visualizer unittest (#27)
* add visualizer unittest

* update

* fix comment

* fix commit

* fix comment

* fix comment
2022-02-21 20:55:11 +08:00