Skip to content

Commit f2f0868

Browse files
tomvdwThe TensorFlow Datasets Authors
authored andcommitted
Add a hook to be executed after download and prepare.
This can be used to execute custom logic after download_and_prepare, such as post-processing the data or generating additional files. PiperOrigin-RevId: 645042072
1 parent 50544fa commit f2f0868

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tensorflow_datasets/core/dataset_builder.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,17 @@ def download_and_prepare(
731731

732732
self._log_download_done()
733733

734+
# Execute post download and prepare hook if it exists.
735+
self._post_download_and_prepare_hook()
736+
737+
738+
def _post_download_and_prepare_hook(self) -> None:
739+
"""Hook to be executed after download and prepare.
740+
741+
Override this in custom dataset builders to execute custom logic after
742+
download and prepare.
743+
"""
744+
pass
734745

735746
def _update_dataset_info(self) -> None:
736747
"""Updates the `dataset_info.json` file in the dataset dir."""

0 commit comments

Comments
 (0)