* Add read environment variable function in config
* Add UT
* enable int case, split predefined and environment
* Update py config
* Add new attributes env_variables in config
* Add examples in docstring
* Fix comments
* Add tutorials
* Add en tutorials
* Refactor config docs according to comments
* Fix comments
* Change function name
* [Feature] Add BaseInferencer (#773)
* Update BaseInferencer
* Fix ci
* Fix CI and rename iferencer to infer
* Fix CI
* Add renamed file
* Add test file
* Adjust interface sequence
* refine preprocess
* Update unit test
Update unit test
* Update unit test
* Fix unit test
* Fix as comment
* Minor refine
* Fix docstring and support load image from different backend
* Support load collate_fn from downstream repos, refine dispatch
* Minor refine
* Fix lint
* refine grammar
* Remove FileClient
* Refine docstring
* add rich
* Add list_models
* Add list_models
* Remove backend args
* Minor refine
* Fix typos in docs and type hints (#787)
* [Fix] Add _inputs_to_list (#795)
* Add preprocess inputs
* Add type hint
* update api/infer in index.rst
* rename preprocess_inputs to _inputs_to_list
* Fix doc format
* Update infer.py
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* [Fix] Fix alias type (#801)
* [Enhance] Support loading model config from checkpoint (#864)
* first commit
* [Enhance] Support build model from weight
* minor refine
* Fix type hint
* refine comments
* Update docstring
* refine as comment
* Add method
* Refine docstring
* Fix as comment
* refine comments
* Refine warning message
* Fix unit test and refine comments
* replace MODULE2PACKAGE to MODULE2PAKCAGE
* Fix typo and syntax error in docstring
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
* [Feature] Add ReduceOnPlateauParamScheduler and change ParamSchedulerHook
* [Feature] add ReduceOnPlateauLR and ReduceOnPlateauMomentum
* pre-commit check
* add a little docs
* change position
* fix the conflict between isort and yapf
* fix ParamSchedulerHook after_val_epoch execute without train_loop and param_schedulers built
* Apply suggestions from code review
Co-authored-by: Mashiro <57566630+HAOCHENYE@users.noreply.github.com>
* update ReduceOnPlateauParamScheduler, ReduceOnPlateauMomentum and ParamSchedulerHook
* fix get need_step_args attribute error in ParamSchedulerHook
* fix load_state_dict error for rule in ReduceOnPlateauParamScheduler
* add docs for ParamSchedulerHook and fix a few codes
* [Docs] add ReduceOnPlateauParamScheduler, ReduceOnPlateauMomentum and ReduceOnPlateauLR docs
* [Refactor] adjust the order of import
* [Fix] add init check for threshold in ReduceOnPlateauParamScheduler
* [Test] add test for ReduceOnPlateauParamScheduler, ReduceOnPlateauLR and ReduceOnPlateauMomentum
* [Fix] fix no attribute self.min_value
* [Fix] fix numerical problem in tests
* [Fix] fix error in tests
* [Fix] fix ignore first param in tests
* [Fix] fix bug in tests
* [Fix] fix bug in tests
* [Fix] fix bug in tests
* [Fix] increase coverage
* [Fix] fix count self._global_step bug and docs
* [Fix] fix tests
* [Fix] modified ParamSchedulerHook test
* Update mmengine/optim/scheduler/param_scheduler.py
Co-authored-by: Mashiro <57566630+HAOCHENYE@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Mashiro <57566630+HAOCHENYE@users.noreply.github.com>
* [Fix] modified something according to commented
* [Docs] add api for en and zh_cn
* [Fix] fix bug in test_param_scheduler_hook.py
* [Test] support more complicated test modes(less, greater, rel, abs) for ReduceOnPlateauParamScheduler
* [Docs] add docs for rule
* [Fix] fix pop from empty list bug in test
* [Fix] fix check param_schedulers is not built bug
* [Fix] fix step_args bug and without runner._train_loop bug
* [Fix] fix step_args bug and without runner._train_loop bug
* [Fix] fix scheduler type bug
* [Test] rename step_args to step_kwargs
* [Fix] remove redundancy check
* [Test] remove redundancy check
* Apply suggestions from code review
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* [Test] fix some defects
Co-authored-by: Mashiro <57566630+HAOCHENYE@users.noreply.github.com>
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* Separate init_cfgs to pretrained_cfg and other_cfgs
* Fix unit test
* update documentation
* Fix render of initialize.md
* Fix as comment
* rename initialize.md to weight_initialization.md
* add file
* fix ci
* rename weight_initialization.md to initialize.md
* Fix duplicated .md
* Add build_runner_with_tta and PrepareTTAHook
* rename hook file
* support build tta runner with runner type
* add unit test
* Add build_runner_with_tta to index.rst
* minor refine
* Add runner test cast
* Fix unit test
* fix unit test
* tmp save
* pop None if key does not exist
* Fix is_model_wrapper and force register class in test_runner
* [Fix] Fix is_model_wrapper
* destroy group after ut
* register module in testcase
* pass through unit test
* fix as comment
* remove breakpoint
* remove mmengine/testing/runner_test_cast.py
* minor refine
* minor refine
* minor refine
* set default data preprocessor for model
* minor refine
* minor refine
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* fix lint
* Fix unit test
* replace with in ImgDataPreprocessor
* Fix as comment
* add inference tutorial in advanced tutorial
* update index.rst
* add tta example
* refine tta tutorial
* Add english tutorial
* add note for build_runner_with_tta
* Fix as comment
* add examples
* remove chinese comment
* Update docs/en/advanced_tutorials/test_time_augmentation.md
Co-authored-by: RangiLyu <lyuchqi@gmail.com>
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
Co-authored-by: RangiLyu <lyuchqi@gmail.com>
* only test timer in linux
* Fix merge_stage_test.yml
* remove install ffmpeg
* test_ci
* test_ci
* Fix python -m pip install pip --upgrade to pip install
* don't test unittest with sleep 1 in windows
* debug with tmate
* increase timeout
* increase timeout
* skip test gloo
* skip test gloo
* fix synteax error
* skip test gloo in torch 1.13
* skip test gloo in torch 1.13
* skip testing setup_env in macOS
* skip test test_dist
* skip test setup
* restore triggered during push
* clean the code
* debug macos
* refine macOS CI
* test merge stage test
* trigger CI during push to main
* Fix as comment
* fix zero_optimizer error with param groups when pytorch < 1.12.0
* add docstring
* fix docstring
* add unittest
* change ut to use a valid paramwise_cfg
* modify ut
* fix as comments
* Add test of get_hooks_info()
* Change to use original Runner for get_hook_info() test
* Change to test after_train_iter hooks for get_hook_info()
* Complement the stages list
* Add logging hooks information in Runner.__init__()
* Rearrange the stages list
* Restore the stages to tuple type
* Clean the unnecessary changes
* Replace statement with TestCase's methods
* add test stages in method_stages_map
* change the hooks info into a f-string
* return list(trigger_stages) directly
* change keys of method_stages_map
* Fix previous changes to method_stages_map.keys
* Add runner test cast
* Fix unit test
* fix unit test
* pop None if key does not exist
* Fix is_model_wrapper and force register class in test_runner
* [Fix] Fix is_model_wrapper
* destroy group after ut
* register module in testcase
* fix as comment
* minor refine
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* fix lint
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* [Fix] fix CosineRestart eta_min
* add ut case
* Enhance unit test
Enhance unit test
* remove unused code
Co-authored-by: HAOCHENYE <21724054@zju.edu.cn>
* [Fix] Fix cound not handle string data
* Minor refine
* Refine type hint
Refine type hint
* fix as comment
* Minor refine
* Update mmengine/model/base_model/data_preprocessor.py
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* [Enhancement] Add a deprecated function
* Refine and add ut
* tmp save
* minor refine
* Fix unit test
* Fix unit test
* fix docstring
* Update utils.rst
* fix add_config func is not called bug
fix wandb add_config bug
add wandb log_code feature
* move log_code_name param to the last one
add log_code_name param to docstring
* add config only when there is a cfg
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* add unit test for log_code_name param of WandbVisBackend
* Update mmengine/visualization/vis_backend.py
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* use log_code_kwargs instead of only log_code_name
add PATH_FILTERS registry
* use log_code_kwargs instead of only log_code_name
add PATH_FILTERS registry
* fix add config unit test
* roll back to log_code_name version
Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
* [Enhance] add documents for , and support clip grad by value
* refine docstring
* fix as comment
* Fix as comment
* minor refine
* minor refine
* remove error comment for clip grad
* refine docstring
* First commit
* add BaseTestTimeAugModel
* Add unit test
* move loop logic to test_step
* fix ddp test
* rename model to module
* optim __init__
* Fix as comment
* Fix as comment
* make val_step should not be called
* make tta do not inherit base model
* Fix unit test
* Enhance docstring
* Fix as comment
* Fix as comment
* minor refine
* minor refine
* minor refine
* fix unit test
* minor refine
* minor refine
* minor refine
* minor refine
* minor refine
* minor refine
* fix unit test
* [Refactor] Refactor fileio but without breaking bc
* handle compatibility
* fix format
* modify io functions
* fix ut
* fix ut
* rename method names
* refine
* refine docstring
* fix ut in windows
* update ut
* minor fix
* ensure client is not None when closing it
* add more examples for list_dir_or_file interface
* refine docstring
* refine deprecated info
* fix ut
* add a description for lmdb docstring
* [Feature] Support convert BN to SyncBN by config
* make unit test compatible with cpu
* Fix as comment
* fix unit test
* change signature of convert_sync_batchnorm: rename sync_bn to implemention
* fix unit test
* fix unit test
* [CI] Update Github Action CI and CircleCI
* clear outdated commands in CI
* clear outdated commands in CI
* add '-r' when installing packages from txt
* update
* update circleci
* fix mismatch conflicts
* update
* install system dependencies
* update
* set env
* fix ut
* update cuda version on Windows
* update push action
* fix unit test install mmdet and mmcls
* raise error when mmdet is not installed
* rename check_and_install to install_package
* split test case
Co-authored-by: C1rN09 <zhaoqian@pjlab.org.cn>
* [Refactor]: modify interface of Visualizer.add_datasample (#365)
* [Refactor] Refactor data flow: refine `data_preprocessor`. (#359)
* refine data_preprocessor
* remove unused BATCH_DATA alias
* Fix type hints
* rename move_data to cast_data
* [Refactor] Refactor data flow: collate data in `collate_fn` of `DataLoader` (#323)
* acollate data in dataloader
* fix docstring
* refine comment
* fix as comment
* refactor default collate and psedo collate
* foramt test file
* fix docstring
* fix as comment
* rename elem to data_item
* minor fix
* fix as comment
* [Refactor] Refactor data flow: `data_batch` argument of `Evaluator.process is a `dict` (#360)
* refine evaluator and metric
* compatible with new default collate
* replace default collate with pseudo
* Handle data_batch in metric
* fix unit test
* fix unit test
* fix unit test
* minor refine
* make data_batch optional
make data_batch optional
* rename outputs to predictions
* fix ut
* rename predictions to outputs
* fix docstring
* fix docstring
* fix unit test
* make outputs and data_batch to kwargs
* fix unit test
* keep signature of metric
* fix ut
* rename pred_sample arguments to data_sample(Visualizer)
* fix loop and ut
* [refactor]: Refactor model dataflow (#398)
* [Refactor] Refactor data flow: refine `data_preprocessor`. (#359)
* refine data_preprocessor
* remove unused BATCH_DATA alias
* Fix type hints
* rename move_data to cast_data
* refactor model data flow
tmp_commt
tmp commit
* make val_cfg and test_cfg optional
* roll back runner
* pass test mmdet
* fix as comment
fix as comment
fix ci in DataPreprocessor
* fix ut
* fix ut
* fix rebase main
* [Fix]: Fix test val ddp (#462)
* [Fix] Fix docstring and type hint of data flow (#463)
* Fix docstring of data flow
* change signature of hook
* fix unit test
* resolve conflicts
* fix lint
* Rename data to structure
* adjust the way to import module
* adjust the way to import module
* rename Structure to Data Structures in docs api
* rename structure to structures
* support using some modules of mmengine without torch
* fix circleci config
* fix circleci config
* fix registry ut
* minor fix
* move init method from model/utils to model/weight_init.py
* move init method from model/utils to model/weight_init.py
* move sync_bn to model
* move functions depending on torch to dl_utils
* format import
* fix logging ut
* add weight init in model/__init__.py
* move get_config and get_model to mmengine/hub
* move log_processor.py to mmengine/runner
* fix ut
* Add TimeCounter in dl_utils/__init__.py
* Support log enviroment information when initiate runner
* Fix unit test
* fix as comment, save world_size
* log gpu num
* clear code and reformat log
* minor refine
* fix as comment
* minor refine
* clean the code
* clean the code
* remove save world_size in meta
* add build function for scheduler
* add unit test
add unit test
* handle convert_to_iter in build_scheduler_from_cfg
* restore deleted code
* format import
* fix lint
* BaseAveragedModel support load ckpt without module prefix
* refine docstring
* allow EMAHook does not load ckpt strictly
* add unit test for strict argument of EMAHook
* sync remote
* sync remote
* clean the code
* ema hook supports setting start iter
* fix unit test
* fix as comment
* fix as comment
* describe kwargs
* support save best based on multi metrics
* add unit test
* resolve bugs after rebasing
* revise docstring
* revise docstring
* fix as comment
* revise as comment
* fix build multiple scheduler
* add new unit test
* fix comment and error message
* fix comment and error message
* extract _parse_scheduler_cfg
* always call build_param_scheduler during train and resume. If there is only one optimizer, the defaut value for sheduler will be a list, otherwise there is multiple optimizer, the default value of sheduler will be a dict
* minor refine
* rename runner test exp name
* fix as comment
* minor refine
* fix ut
* only check parameter scheduler
* minor refine
* fix save scheduler state dict with optim wrapper
* remove for loop and inherit TestParameterScheduler
* remove for loop and inherit TestParameterScheduler
* minor refine
* [Enhance] Auto set the `end` of param schedulers.
* Add log output and unit test
* Update docstring
* Update unit tests of `CosineAnnealingParamScheduler`.
* first commit
* Support modify base config and add unit test
* remove import mmengine in config
* add unit test
* fix lint
* add unit test
* move RemoveAssignFromAST to config utils
* git add utils
* fix format issue in test file
* refine unit test
* refine unit test
* clean code
* fix as comment
* fix as comment
* add get_registry_by_scope method
* add unit test and docstring example
* rename get_registry_by_scope to switch_scope_and_registry
* move build function to registry/builder
* fix docstring
* rename builder->registry_builder, move build_from_cfg to registry_builder
rename builder->registry_builder, move build_from_cfg to registry_builder
* rename registry_builder to build_function
rename registry_builder to build_function
* fix docstring and type hint
* rename build_function to build_functions
* Fix ema hook and add unit test
* save state_dict of ema.module
save state_dict of ema.module
* replace warning.warn with MMLogger.warn
* fix as comment
* fix bug
* fix bug
* add autocast wrapper
* fix docstring
* fix docstring
* fix compare version
* fix unit test
* fix incompatible arguments
* fix as comment
* fix unit test
* rename auto_cast to autocast
* [Refactor]:Refactor `after_val_epoch` to make it output metric by epoch
* add an option for user to choose the way of outputing metric
* rename variable
* reformat docstring
* add type alias
* reformat code
* add test function
* add comment and test code
* add comment and test code
* [Feat] Support FSDP Training
* fix version comparison
* change param format and move `FSDP_WRAP_POLICY` to wrapper file
* add docstring and type hint,reformat code
* fix type hint
* fix typo, reformat code
* merge context
* update unit test
* add docstring
* fix bug in AmpOptimWrapper
* add docstring for backward
* add warning and docstring for accumuate gradient
* fix docstring
* fix docstring
* add params_group method
* fix as comment
* fix as comment
* make default_value of loss_scale to dynamic
* Fix docstring
* decouple should update and should no sync
* rename attribute in OptimWrapper
* fix docstring
* fix comment
* fix comment
* fix as comment
* fix as comment and add unit test
* fix build train_loop during test
* fix build train_loop during test
* fix build train_loop during test
* fix build train_loop during test
* Fix as comment
* fix BaseDataPreprocessor
* fix BaseDataPreprocessor
* change device type to torch.device
* change device type to torch.device
* fix cpu method of base model
* Allow ImgDataPreprocessor do not normalize
* remove unnecessary type ignore
* make mean and std optional
* refine docstring
* fix BaseDataPreprocessor
* fix BaseDataPreprocessor
* change device type to torch.device
* change device type to torch.device
* fix cpu method of base model
* add base model, ddp model and unit test
* add unit test
* fix unit test
* fix docstring
* fix cpu unit test
* refine base data preprocessor
* refine base data preprocessor
* refine interface of ddp module
* remove optimizer hook
* add forward
* fix as comment
* fix unit test
* fix as comment
* fix build optimizer wrapper
* rebase main and fix unit test
* stack_batch support stacking ndim tensor, add docstring for merge dict
* fix lint
* fix test loop
* make precision_context effective to data_preprocessor
* fix as comment
* fix as comment
* refine docstring
* change collate_data output typehints
* rename to_rgb to bgr_to_rgb and rgb_to_bgr
* support build basemodel with built DataPreprocessor
* fix as comment
* fix docstring