1
Fork 0
mirror of https://github.com/Steffo99/unimore-bda-6.git synced 2024-11-25 01:04:19 +00:00

Manually run garbage collection after each iteration

This commit is contained in:
Steffo 2023-02-13 15:57:37 +01:00
parent e93a8ddaf7
commit c992c04264
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -1,5 +1,6 @@
import logging import logging
import pymongo.errors import pymongo.errors
import gc
from .log import install_general_log_handlers from .log import install_general_log_handlers
install_general_log_handlers() install_general_log_handlers()
@ -59,6 +60,10 @@ def main():
HuggingBertTokenizer, 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 = logging.getLogger(f"{__name__}.{sample_func.__name__}.{SentimentAnalyzer.__name__}.{Tokenizer.__name__}")
slog.debug("Selected Tokenizer: %s", Tokenizer.__name__) slog.debug("Selected Tokenizer: %s", Tokenizer.__name__)