<jupyter_start><jupyter_text>Memory and resource deallocation test.This notebook uses the NER example code to test for resource leaks.  Please see the `ner.ipynb` for the actual NER notebook example.<jupyter_code>from harness import NotebookHarness
harness = NotebookHarness()
mng = harness()
# number of epochs to test with, which needs to be at least two to excercise it properly
mng.config('model_settings', epochs=2)
# if a memory leak test fails, set to False for that test
keep_going = True
from io import StringIO
facade = mng.create_facade('glove50')
# write to force more allocation to test deallocation, but don't clutter the notebook output
facade.write(writer=StringIO())
mng.run(False)
if keep_going:
    facade.embedding = 'glove_300_embedding'
    mng.run(False)
    mng.show_leaks()
if keep_going:
    facade = mng.create_facade('transformer-fixed')
    mng.run(False)
if keep_going:
    facade = mng.create_facade('transformer-trainable')
    mng.run(False)
    mng.show_leaks()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08585365853658537, 'fraction_numerical': 0.005853658536585366, 'mean_word_length': 5.180722891566265, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '536484', 'license': 'MIT', 'n_tokens_mistral': 346, 'n_tokens_neox': 336, 'n_words': 105, 'path': 'example/movie/notebook/resource-allocation-test.ipynb', 'repo_name': 'plandes/deepnlp', 'size': '1025'}