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

[Feature] Add SegmindLoggerHook #1650

Merged
merged 17 commits into from
Mar 3, 2022
Merged

Conversation

saurbhc
Copy link
Contributor

@saurbhc saurbhc commented Jan 9, 2022

Motivation

I would like to use https://github.com/segmind/segmind as a Logger.

Modification

I added a new LoggerHook child to the HOOKS registry.

Use cases (Optional)

Logging training parameters with Segmind.

@CLAassistant
Copy link

CLAassistant commented Jan 9, 2022

CLA assistant check
All committers have signed the CLA.

@zhouzaida
Copy link
Collaborator

Hi @saurbhc , thanks for your contribution. We can refer to https://github.com/open-mmlab/mmcv/blob/master/tests/test_runner/test_hooks.py#L1212 to add a unit test.

- add SegmindLoggerHook import in:
  mmcv/runner/__init__.py
  mmcv/runner/hooks/__init__.py
  mmcv/runner/hooks/logger/__init__.py
@saurbhc
Copy link
Contributor Author

saurbhc commented Jan 10, 2022

@zhouzaida I have added a unit test.

- Add Docstring to SegmindLoggerHook
- Use get_loggable_tags(...)
@zhouzaida zhouzaida requested a review from teamwong111 January 11, 2022 14:21
- mmcv/runner/hooks/logger/segmind.py
  moved docs from __init__ to class ...
  update ImportError line-indentation
  remove unwanted method
- tests/test_runner/test_hooks.py
  update assert_called_with only on hook.segmind_mlflow_log
@saurbhc
Copy link
Contributor Author

saurbhc commented Jan 11, 2022

@zhouzaida
lint check is failing because of:

  • running pre-commit for the last commit on the file tests/test_runner/test_hooks.py is showing some "cyclic-
    dependency" by 'isort' and 'yapf'.

Here's the output of pre-commit:

$ pre-commit
flake8...................................................................Passed
seed isort known_third_party.............................................Passed
isort....................................................................Failed
- hook id: isort
- files were modified by this hook

Fixing tests/test_runner/test_hooks.py

yapf.....................................................................Failed
- hook id: yapf
- files were modified by this hook
Trim Trailing Whitespace.................................................Passed
Check Yaml...........................................(no files to check)Skipped
Fix End of Files.........................................................Passed
Fix requirements.txt.................................(no files to check)Skipped
Fix double quoted strings................................................Passed
Check for merge conflicts................................................Passed
Fix python encoding pragma...............................................Passed
Mixed line ending........................................................Passed
Markdownlint.........................................(no files to check)Skipped
codespell................................................................Passed
docformatter.............................................................Passed

To reproduce this, run pre-commit on this PR for the last commit.

@zhouzaida
Copy link
Collaborator

@zhouzaida lint check is failing because of:

  • running pre-commit for the last commit on the file tests/test_runner/test_hooks.py is showing some "cyclic-
    dependency" by 'isort' and 'yapf'.

Here's the output of pre-commit:

$ pre-commit
flake8...................................................................Passed
seed isort known_third_party.............................................Passed
isort....................................................................Failed
- hook id: isort
- files were modified by this hook

Fixing tests/test_runner/test_hooks.py

yapf.....................................................................Failed
- hook id: yapf
- files were modified by this hook
Trim Trailing Whitespace.................................................Passed
Check Yaml...........................................(no files to check)Skipped
Fix End of Files.........................................................Passed
Fix requirements.txt.................................(no files to check)Skipped
Fix double quoted strings................................................Passed
Check for merge conflicts................................................Passed
Fix python encoding pragma...............................................Passed
Mixed line ending........................................................Passed
Markdownlint.........................................(no files to check)Skipped
codespell................................................................Passed
docformatter.............................................................Passed

To reproduce this, run pre-commit on this PR for the last commit.

We can disable the yapf.

mmcv/runner/hooks/logger/segmind.py Outdated Show resolved Hide resolved
mmcv/runner/hooks/logger/segmind.py Outdated Show resolved Hide resolved
saurbhc and others added 3 commits January 13, 2022 16:11
disable yapf on test_hooks.py imports

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

Co-authored-by: Jiazhen Wang <47851024+teamwong111@users.noreply.github.com>
removed un-used statements
@saurbhc saurbhc requested a review from zhouzaida January 14, 2022 18:44
@saurbhc saurbhc requested a review from zhouzaida January 16, 2022 14:45
@zhouzaida zhouzaida requested a review from ZwwWayne January 17, 2022 08:05
Copy link
Contributor

@teamwong111 teamwong111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please successfully run a task with segmind and show it in the pr content? There are few segmind documents, and AWS is required for configuration, verification is troublesome for me.

mmcv/runner/hooks/logger/segmind.py Outdated Show resolved Hide resolved
@saurbhc
Copy link
Contributor Author

saurbhc commented Jan 19, 2022

@teamwong111 I have verified SegmindLoggerHook on Segmind Platform and it's working fine.

I am attaching these for your reference:

  1. Verifying with mmcv
    .ipynb link .ipynb file used in Segmind (added some debugging prints for verifying the logging)
    Segmind Metrics screenshot link
  2. Verifying with mmdetection
    .ipynb link .ipynb file used in Segmind
    Segmind Metrics screenshot link

@zhouzaida
Copy link
Collaborator

@teamwong111 I have verified SegmindLoggerHook on Segmind Platform and it's working fine.

I am attaching these for your reference:

  1. Verifying with mmcv
    .ipynb link .ipynb file used in Segmind (added some debugging prints for verifying the logging)
    Segmind Metrics screenshot link
  2. Verifying with mmdetection
    .ipynb link .ipynb file used in Segmind
    Segmind Metrics screenshot link

More arguments should also be passed.

Args:
interval (int): Logging interval (every k iterations). Default 10.
ignore_last (bool): Ignore the log of last iterations in each epoch
if less than `interval`. Default True.
reset_flag (bool): Whether to clear the output buffer after logging.
Default False.
by_epoch (bool): Whether EpochBasedRunner is used. Default True.

- more arguments passes to __init__ method
  - interval
  - ignore_last
  - reset_flag
  - by_epoch
@zhouzaida zhouzaida requested a review from HAOCHENYE January 23, 2022 15:04
@saurbhc
Copy link
Contributor Author

saurbhc commented Jan 28, 2022

Can someone please review this?

Copy link
Collaborator

@zhouzaida zhouzaida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@saurbhc
Copy link
Contributor Author

saurbhc commented Feb 2, 2022

Hey @zhouzaida, Can we merge this PR?

@zhouzaida
Copy link
Collaborator

zhouzaida commented Feb 3, 2022

Hey @zhouzaida, Can we merge this PR?

Definitely.
Please @ZwwWayne have a look.

Copy link
Collaborator

@HAOCHENYE HAOCHENYE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

saurbhc and others added 2 commits February 23, 2022 12:30
Co-authored-by: Mashiro <57566630+HAOCHENYE@users.noreply.github.com>
Co-authored-by: Mashiro <57566630+HAOCHENYE@users.noreply.github.com>
@ZwwWayne
Copy link
Collaborator

ZwwWayne commented Mar 1, 2022

Hi @saurbhc ,
It seems that the unit test fails. Could you fix them so that we can merge this PR?

@saurbhc saurbhc force-pushed the feat/segmind_hook branch from f63cffa to 3801f1b Compare March 1, 2022 11:55
@zhouzaida zhouzaida changed the title add SegmindLoggerHook [Feature] Add SegmindLoggerHook Mar 3, 2022
@zhouzaida zhouzaida merged commit 34f227e into open-mmlab:master Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants