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

Delete mem cache handler after training is done #2535

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/otx/algorithms/classification/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
from otx.api.utils.dataset_utils import add_saliency_maps_to_dataset_item
from otx.api.utils.labels_utils import get_empty_label
from otx.cli.utils.multi_gpu import is_multigpu_child_process
from otx.core.data.caching.mem_cache_handler import MemCacheHandlerSingleton

logger = get_logger()
RECIPE_TRAIN_TYPE = {
Expand Down Expand Up @@ -215,6 +216,8 @@ def train(

results = self._train_model(dataset)

MemCacheHandlerSingleton.delete()

# Check for stop signal when training has stopped. If should_stop is true, training was cancelled and no new
if self._should_stop:
logger.info("Training cancelled.")
Expand Down
3 changes: 3 additions & 0 deletions src/otx/algorithms/detection/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
from otx.api.usecases.tasks.interfaces.export_interface import ExportType
from otx.api.utils.dataset_utils import add_saliency_maps_to_dataset_item
from otx.cli.utils.multi_gpu import is_multigpu_child_process
from otx.core.data.caching.mem_cache_handler import MemCacheHandlerSingleton

logger = get_logger()

Expand Down Expand Up @@ -231,6 +232,8 @@ def train(
val_dataset.purpose = DatasetPurpose.INFERENCE
val_preds, val_map = self._infer_model(val_dataset, InferenceParameters(is_evaluation=True))

MemCacheHandlerSingleton.delete()

preds_val_dataset = val_dataset.with_empty_annotations()
if self._hyperparams.postprocessing.result_based_confidence_threshold:
confidence_threshold = 0.0 # Use all predictions to compute best threshold
Expand Down
3 changes: 3 additions & 0 deletions src/otx/algorithms/segmentation/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
create_hard_prediction_from_soft_prediction,
)
from otx.cli.utils.multi_gpu import is_multigpu_child_process
from otx.core.data.caching.mem_cache_handler import MemCacheHandlerSingleton

logger = get_logger()
RECIPE_TRAIN_TYPE = {
Expand Down Expand Up @@ -171,6 +172,8 @@ def train(

results = self._train_model(dataset)

MemCacheHandlerSingleton.delete()

# Check for stop signal when training has stopped. If should_stop is true, training was cancelled and no new
if self._should_stop:
logger.info("Training cancelled.")
Expand Down