Skip to content

Conversation

@Nic-Ma
Copy link
Contributor

@Nic-Ma Nic-Ma commented Feb 9, 2021

Description

This PR added the base class for TensorBoard handlers.
We want to extend more TensorBoard handlers soon.

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh --codeformat --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Feb 9, 2021

/black

monai-bot and others added 2 commits February 9, 2021 15:50
@wyli
Copy link
Contributor

wyli commented Feb 9, 2021

thanks, might need some writer.close() in the base class, we need concrete test cases to verify the multihandler use case

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Feb 9, 2021

thanks, might need some writer.close() in the base class, we need concrete test cases to verify the multihandler use case

Thanks @wyli for your review. what do you mean multihandler use case?

@wyli
Copy link
Contributor

wyli commented Feb 9, 2021

thanks, might need some writer.close() in the base class, we need concrete test cases to verify the multihandler use case

Thanks @wyli for your review. what do you mean multihandler use case?

I mean sharing the same summary_writer instance for multiple handlers. I guess we need some tests for that.. perhaps as a part of an integration test...

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Feb 9, 2021

thanks, might need some writer.close() in the base class, we need concrete test cases to verify the multihandler use case

Thanks @wyli for your review. what do you mean multihandler use case?

I mean sharing the same summary_writer instance for multiple handlers. I guess we need some tests for that.. perhaps as a part of an integration test...

OK, sure, I will add it.
And I think we don't have the writer.close() logic in the 2 existing TensorBoard handlers, where do you expect to add it?

Thanks.

@wyli
Copy link
Contributor

wyli commented Feb 9, 2021

OK, sure, I will add it.
And I think we don't have the writer.close() logic in the 2 existing TensorBoard handlers, where do you expect to add it?

Thanks.

I had an issue earlier that tensorboard server not being able to load if the event file writer is not closed properly, perhaps try to close at the last event during training

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Feb 9, 2021

Hi @wyli ,

For the tensorboardhandler attached to trainer, we can close writer when Events.COMPLETED triggered, but for the tensorboardhandler attached to validator, it completes many times for every validation during training, we should always keep the event file open until training completed.
So it's hard to detect the "last event" for validator.
Maybe we need to add the close() logic in the __del__() function of TensorBoardHandler?

Thanks.

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Feb 9, 2021

/black

monai-bot and others added 2 commits February 9, 2021 17:26
Signed-off-by: monai-bot <monai.miccai2019@gmail.com>
Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Feb 10, 2021

/black

@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Feb 10, 2021

Hi @wyli ,

I added the close() function referring to the TensorBoaderLogger in ignite: https://github.com/pytorch/ignite/blob/master/ignite/contrib/handlers/tensorboard_logger.py#L167
And also updated our unit tests.
Could you please help review it again?

Thanks.

Signed-off-by: Nic Ma <nma@nvidia.com>
@Nic-Ma
Copy link
Contributor Author

Nic-Ma commented Feb 10, 2021

/black

@Nic-Ma Nic-Ma merged commit af1ffd6 into Project-MONAI:master Feb 10, 2021
@Nic-Ma Nic-Ma deleted the add-baseclass-tensorboard branch July 2, 2021 23:37
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.

3 participants