Annif MLLM error

6 views
Skip to first unread message

Uldis Bojars

unread,
Nov 3, 2025, 9:15:52 AMNov 3
to Annif Users
Hi,

After installing Annif 1.4 and retraining the models, I am getting the following error when using MLLM-based models:

Nov 03 15:57:24 dc-annif gunicorn[2626]:   File "/srv/Annif/venv/lib/python3.12/site-packages/annif/backend/mllm.py", line 191, in _suggest
Nov 03 15:57:24 dc-annif gunicorn[2626]:     return prediction_to_result(prediction, params, self.project.subjects)
Nov 03 15:57:24 dc-annif gunicorn[2626]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 03 15:57:24 dc-annif gunicorn[2626]:   File "/srv/Annif/venv/lib/python3.12/site-packages/annif/backend/mllm.py", line 43, in prediction_to_result
Nov 03 15:57:24 dc-annif gunicorn[2626]:     vector[subject_id] = score
Nov 03 15:57:24 dc-annif gunicorn[2626]:     ~~~~~~^^^^^^^^^^^^
Nov 03 15:57:24 dc-annif gunicorn[2626]: IndexError: index 53111 is out of bounds for axis 0 with size 51964

Here is the full error stack trace:

The error appears both with the "suggest" command-line command and when using Annif's web interface.

Could you suggest how to fix it?
(Retrain the models again?)

Uldis

Osma Suominen

unread,
Nov 3, 2025, 10:12:58 AMNov 3
to annif...@googlegroups.com
Hi Uldis!

I suspect that your model and vocabulary are out of sync. The model
suggests a subject with id 53111, but your vocabulary only has 51964
subjects so an IndexError is raised.

Maybe try retraining the model? Or if you know you have loaded a
different (smaller) version of the vocabulary than the one you trained
with, you might be able to fix the problem by loading the larger vocabulary.

-Osma
> --
> You received this message because you are subscribed to the Google
> Groups "Annif Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to annif-users...@googlegroups.com <mailto:annif-
> users+un...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/annif-
> users/
> CAJjMrEMHdbp1hPHbrivCyp56KNrF0TfAsQ7RzEd5Hx_bO7FfLQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/annif-users/
> CAJjMrEMHdbp1hPHbrivCyp56KNrF0TfAsQ7RzEd5Hx_bO7FfLQ%40mail.gmail.com?
> utm_medium=email&utm_source=footer>.

--
Osma Suominen
D.Sc. (Tech), Information Systems Specialist
National Library of Finland
P.O. Box 15 (Unioninkatu 36)
00014 HELSINGIN YLIOPISTO
Tel. +358 50 3199529
osma.s...@helsinki.fi
http://www.nationallibrary.fi

Reply all
Reply to author
Forward
0 new messages