webis-de / small-text

Active Learning for Text Classification in Python
https://small-text.readthedocs.io/
MIT License
562 stars 61 forks source link

TransformerBasedClassification: validations_per_epoch > 2 leaves the model in eval mode #40

Closed chschroeder closed 1 year ago

chschroeder commented 1 year ago

Bug description

When TransformerBasedClassification is initialized with validations_per_epoch greater 1, then the model is incorrectly in eval mode in _train_loop_process_batches() (starting with the second iteration).

Steps to reproduce

Set validations_per_epoch to 2 and observe the training loop using the debugger.

Expected behavior

--

Environment:

small-text version: 1.3.1 small-text integrations (e.g., transformers): transformers

Addition information

Fixing the functionality is a one liner, the test is most of the effort. Luckily, this setting is 1 by default, so unless you set this purpose, you are likely not affected by this bug.