Skip to content

hyperopt fails when run in parallel on macOS #924

@CaptSolo

Description

@CaptSolo

When annif hyperopt is run on macOS in parallel it fails with the following error message:

annif hyperopt nllsh-mllm-en --trials 2 --jobs 2 txt-validation-en

[...]

[W 2026-01-01 19:07:17,060] Trial 1 failed with parameters: {'min_samples_leaf': 29, 'max_leaf_nodes': 1402, 'max_samples': 0.7878340014898446} because of the following error: TypeError("'NoneType' object is not subscriptable").
Traceback (most recent call last):
  File "/Users/captsolo/Documents/Code/LNB_Annif_1.4/.venv/lib/python3.12/site-packages/optuna/study/_optimize.py", line 201, in _run_trial
    value_or_values = func(trial)
                      ^^^^^^^^^^^
  File "/Users/captsolo/Documents/Code/LNB_Annif_1.4/.venv/lib/python3.12/site-packages/annif/backend/hyperopt.py", line 67, in _objective_wrapper
    return cls.objective(trial, cls.args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/captsolo/Documents/Code/LNB_Annif_1.4/.venv/lib/python3.12/site-packages/annif/backend/mllm.py", line 59, in objective
    model.fit(args["train_x"], args["train_y"])
              ~~~~^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

Full error message:

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions