-
Hi, I found that a new function teardown has been added in Does it clean up the data on the memory? If so, it is very useful when we are working with very large data sets. How do we use this function? def teardown(self, stage: Optional[str] = None):
"""Clean up after fit or test."""
pass Don't write anything? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
According to lightning docs: The teardown is just a handy function called at the end of fit, validate, test, or predict. It's up to you to decide what the function should be doing. It is called from every process across all the nodes. The |
Beta Was this translation helpful? Give feedback.
-
Get it. In general, what do we do with this function? I hardly see any examples of using this function. |
Beta Was this translation helpful? Give feedback.
-
def teardown(self, stage: Optional[str] = None): |
Beta Was this translation helpful? Give feedback.
According to lightning docs:
https://pytorch-lightning.readthedocs.io/en/latest/data/datamodule.html#teardown
The teardown is just a handy function called at the end of fit, validate, test, or predict.
It's up to you to decide what the function should be doing.
It is called from every process across all the nodes.
The
stage
arg informs us whether the current stage is "fit", "validate", etc.