From c992c04264644bcc6ad6c350fb2121398437adb1 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 13 Feb 2023 15:57:37 +0100 Subject: [PATCH] Manually run garbage collection after each iteration --- unimore_bda_6/__main__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/unimore_bda_6/__main__.py b/unimore_bda_6/__main__.py index 60c0ef9..849a245 100644 --- a/unimore_bda_6/__main__.py +++ b/unimore_bda_6/__main__.py @@ -1,5 +1,6 @@ import logging import pymongo.errors +import gc from .log import install_general_log_handlers install_general_log_handlers() @@ -59,6 +60,10 @@ def main(): HuggingBertTokenizer, ]: + log.debug("Running garbage collection...") + garbage_count = gc.collect() + log.debug("Collected %d pieces of garbage!", garbage_count) + slog = logging.getLogger(f"{__name__}.{sample_func.__name__}.{SentimentAnalyzer.__name__}.{Tokenizer.__name__}") slog.debug("Selected Tokenizer: %s", Tokenizer.__name__)