Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
chschroeder opened this issue Oct 7, 2022 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@chschroeder
Copy link
Contributor

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
@chschroeder chschroeder added the bug Something isn't working label Oct 7, 2022
chschroeder added a commit that referenced this issue Oct 8, 2022
Signed-off-by: Christopher Schröder <chschroeder@users.noreply.github.com>
@chschroeder
Copy link
Contributor Author

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

chschroeder added a commit that referenced this issue Oct 9, 2022
Signed-off-by: Christopher Schröder <chschroeder@users.noreply.github.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant