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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

on_test_end is not called in test #5442

Closed
kengz opened this issue Jan 9, 2021 · 10 comments
Closed

on_test_end is not called in test #5442

kengz opened this issue Jan 9, 2021 · 10 comments
Assignees
Labels
bug Something isn't working design Includes a design discussion help wanted Open to be worked on priority: 1 Medium priority task
Milestone

Comments

@kengz
Copy link
Contributor

kengz commented Jan 9, 2021

馃悰 Bug

I'm running a model with fit and test called. However I noticed that on_test_end is not called at the end of test.

Please reproduce using the BoringModel

https://colab.research.google.com/drive/1j5J8TXAIqoFCqc-3WnAPMox8amNsRDjE?usp=sharing

To Reproduce

Use following BoringModel and post here

See the code addition at the bottom of this cell, which prints when the method is hit.

Then check the output here. Notice how ##### hit on_test_end ##### is missing, whereas ##### hit on_train_end ##### is present and just fine.

Expected behavior

When running the trainer.test step, on_test_end should be called at the end of test.

Environment

See the shared Colab notebook. Below are pasted form the notebook:

* CUDA:
	- GPU:
		- Tesla T4
	- available:         True
	- version:           10.1
* Packages:
	- numpy:             1.19.4
	- pyTorch_debug:     True
	- pyTorch_version:   1.7.0+cu101
	- pytorch-lightning: 1.1.3
	- tqdm:              4.41.1
* System:
	- OS:                Linux
	- architecture:
		- 64bit
		- 
	- processor:         x86_64
	- python:            3.6.9
	- version:           #1 SMP Thu Jul 23 08:00:38 PDT 2020
@kengz kengz added bug Something isn't working help wanted Open to be worked on labels Jan 9, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2021

Hi! thanks for your contribution!, great first issue!

@rohitgr7
Copy link
Contributor

rohitgr7 commented Jan 9, 2021

can you update the notebook permissions?

@kengz
Copy link
Contributor Author

kengz commented Jan 9, 2021

done

@rohitgr7
Copy link
Contributor

rohitgr7 commented Jan 9, 2021

I just realised there is no on_validation_end/on_test_end hook in LightningModule. It's only present in callbacks.

@kengz
Copy link
Contributor Author

kengz commented Jan 9, 2021

What does that mean? How can we get it called at the end of test?

@rohitgr7
Copy link
Contributor

is there any reason to not include on_validation_end and on_test_end hooks in LightningModule? cc @PyTorchLightning/core-contributors

@Borda
Copy link
Member

Borda commented Jan 11, 2021

I do not think there is a reason, just missed it...

@Borda Borda added the design Includes a design discussion label Jan 11, 2021
@Borda Borda added this to the 1.1.x milestone Jan 11, 2021
@Borda Borda added the priority: 1 Medium priority task label Jan 11, 2021
@awaelchli
Copy link
Member

We should also consider a test for a full hooks life-cycle as done with the callbacks:
https://github.com/PyTorchLightning/pytorch-lightning/blob/87482935a3d03cab3ffff336c88e0ae977a2beee/tests/callbacks/test_callbacks.py#L22

@rohitgr7
Copy link
Contributor

it's there @awaelchli https://github.com/PyTorchLightning/pytorch-lightning/blob/master/tests/models/test_hooks.py
just need to be updated the way it's done in callbacks.

@rohitgr7
Copy link
Contributor

fixed in #5467

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working design Includes a design discussion help wanted Open to be worked on priority: 1 Medium priority task
Projects
None yet
Development

No branches or pull requests

4 participants