webis-de/small-text

FileNotFoundError: [Errno 2] No such file or directory: '0-b0'

Closed this issue · 1 comments

Bug description

Training a model with model selection enabled may raise an error:

FileNotFoundError: [Errno 2] No such file or directory: '0-b0'

Full stacktrace below.

Steps to reproduce

Model selection needs to exit here for this error to occur.

Environment:

Python version: 3.8
small-text version: 1.1.0
small-text integrations (e.g., transformers): transformers
PyTorch version (if applicable): does not matter here
CUDA version (if applicable): does not matter here

Addition information

  <...>
  File "<venv_path>/lib/python3.8/site-packages/small_text/integrations/transformers/classifiers/classification.py", line 368, in fit
    return self._fit_main(sub_train, sub_valid, sub_train_weights, early_stopping,
  File "<venv_path>/lib/python3.8/site-packages/small_text/integrations/transformers/classifiers/classification.py", line 393, in _fit_main
    self._perform_model_selection(optimizer, model_selection)
  File "<venv_path>/lib/python3.8/site-packages/small_text/integrations/pytorch/classifiers/base.py", line 59, in _perform_model_selection
    self.model.load_state_dict(torch.load(model_selection_result.model_path))
  File "<venv_path>/lib/python3.8/site-packages/torch/serialization.py", line 579, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "<venv_path>/lib/python3.8/site-packages/torch/serialization.py", line 230, in _open_file_like
    return _open_file(name_or_buffer, mode)
  File "<venv_path>/lib/python3.8/site-packages/torch/serialization.py", line 211, in __init__
    super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: '0-b0'

Process finished with exit code 1

Until the v1.1.1 release, this can be circumvented by disabling model selection (or copying the fixed implementation from the main branch).