-
Notifications
You must be signed in to change notification settings - Fork 7
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
[Refact] context rewrite #38
Conversation
Coverage reportThe coverage rate is The branch rate is
Diff Coverage details (click to unfold)mmtune/mm/tasks/mmdet.py
mmtune/mm/tasks/base.py
mmtune/utils/config.py
mmtune/mm/context/rewriters/builder.py
mmtune/mm/context/rewriters/register.py
mmtune/mm/hooks/reporter.py
mmtune/mm/context/rewriters/instantiate.py
mmtune/apis/tune.py
mmtune/mm/tasks/blackbox.py
mmtune/ray/spaces/builder.py
mmtune/mm/context/rewriters/path.py
mmtune/mm/tasks/builder.py
mmtune/utils/logger.py
mmtune/mm/tasks/mmcls.py
mmtune/utils/container.py
mmtune/ray/searchers/nevergrad.py
mmtune/mm/context/manager.py
mmtune/mm/context/rewriters/decouple.py
mmtune/mm/hooks/checkpoint.py
mmtune/mm/context/rewriters/base.py
mmtune/ray/stoppers/early_drop.py
mmtune/ray/spaces/base.py
mmtune/utils/init.py
mmtune/mm/tasks/sphere.py
mmtune/version.py
mmtune/mm/context/rewriters/dump.py
mmtune/mm/context/rewriters/patch.py
mmtune/mm/tasks/mmseg.py
mmtune/mm/context/rewriters/merge.py
mmtune/mm/context/rewriters/init.py
mmtune/mm/tasks/mmtrainbase.py
|
The test coverage increase will be carried out in another pull request. |
Co-authored-by: Hakjin Lee <nijkah@gmail.com>
Co-authored-by: Hakjin Lee <nijkah@gmail.com>
Co-authored-by: Hakjin Lee <nijkah@gmail.com>
0a76912
to
ac692b3
Compare
Co-authored-by: Hakjin Lee <nijkah@gmail.com>
Co-authored-by: Hakjin Lee <nijkah@gmail.com>
mmtune/mm/context/rewriters/patch.py
Outdated
@@ -15,10 +29,27 @@ def unwrap_regexp(value, regexp=WRAPPING_REGEXP): | |||
|
|||
|
|||
@REWRITERS.register_module() | |||
class BatchConfigPathcer: | |||
class BatchConfigPathcer(BaseRewriter): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its name and docstring can be improved. I cannot get it what it does until now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding an example may help.
mmtune/mm/context/rewriters/patch.py
Outdated
@@ -33,10 +64,28 @@ def __call__(self, context: dict): | |||
|
|||
|
|||
@REWRITERS.register_module() | |||
class SequeunceConfigPathcer: | |||
class SequeunceConfigPathcer(BaseRewriter): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as BatchConfigPatcher
,
it seems important to its main function is to interpret -
in the configuration file.
mmtune/mm/context/rewriters/path.py
Outdated
|
||
|
||
@REWRITERS.register_module() | ||
class PathJoinTrialId(BaseRewriter): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about AppendTrialIDtoPath
?
mmtune/mm/hooks/reporter.py
Outdated
from mmcv.runner.dist_utils import get_dist_info | ||
from mmcv.runner.hooks.logger import LoggerHook | ||
from torch import distributed as dist | ||
|
||
|
||
@HOOKS.register_module() | ||
class RayTuneLoggerHook(LoggerHook): | ||
"""Logger hook for Ray Tune.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Logger hook for Ray Tune.""" | |
"""MMCV Logger hook for Ray Tune.""" |
mmtune/mm/tasks/base.py
Outdated
|
||
|
||
@TASKS.register_module() | ||
class BaseTask(metaclass=ABCMeta): | ||
"""Wrap the apis of target task.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring seems inappropriate.
"""Base class to specify the target task."""
mmtune/mm/tasks/base.py
Outdated
|
||
def set_args(self, args: Sequence[str]) -> None: | ||
self.args = self.parse_args(args) | ||
"""Parse and Set the args. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Parse and Set the args. | |
"""Parse and set the args. |
mmtune/mm/tasks/base.py
Outdated
context_manager = ContextManager(**status) | ||
return context_manager(self.run)(*args, **kwargs) | ||
def context_aware_run(self, searched_cfg: Dict, **kwargs) -> Any: | ||
"""Gathers and refines the information received by users and Raytune to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Gathers and refines the information received by users and Raytune to | |
"""Gather and refine the information received by users and Ray.tune to |
mmtune/mm/tasks/base.py
Outdated
|
||
@abstractmethod | ||
def run(self, *args, **kwargs) -> None: | ||
def run(self, *, args: argparse.Namespace, **kwargs) -> None: | ||
"""The objective task. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description seems inappropriate.
Just Run the target task.
mmtune/mm/tasks/mmtrainbase.py
Outdated
searched_cfg, | ||
backend='nccl', | ||
**kwargs) -> None: | ||
"""Gathers and refines the information received by users and Raytune to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Gathers and refines the information received by users and Raytune to | |
"""Gather and refine the information received by users and Ray.tune to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Great to Me.
This is a PR forcing run to work with the context being changed by the context manager.
We plan to work on refactoring the context manager into a decorator type.