Error when train vector on terms.train-vectors, object has no attribute 'clear_vectors'

Hi,

I’ve been try to run terms.train-vectors and get error

prodigy terms.train-vectors tmp/model corpus/beritagar_ori.txt --spacy-model model_vector --size 300 --window 10 --n-iter 10 --n-workers 8
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/beritagar/Documents/Kantor/NER/.env/lib/python3.6/site-packages/prodigy/__main__.py", line 238, in <module>
    controller = recipe(*args, use_plac=True)
  File "cython_src/prodigy/core.pyx", line 130, in prodigy.core.recipe.recipe_decorator.recipe_proxy
  File "/home/beritagar/Documents/Kantor/NER/.env/lib/python3.6/site-packages/plac_core.py", line 328, in call
    cmd, result = parser.consume(arglist)
  File "/home/beritagar/Documents/Kantor/NER/.env/lib/python3.6/site-packages/plac_core.py", line 207, in consume
    return cmd, self.func(*(args + varargs + extraopts), **kwargs)
  File "/home/beritagar/Documents/Kantor/NER/.env/lib/python3.6/site-packages/prodigy/recipes/terms.py", line 73, in train_vectors
    nlp.vocab.clear_vectors(size)
AttributeError: 'spacy.vocab.Vocab' object has no attribute 'clear_vectors'

i’ve check on spaCy 2.0.3 clear_vectors change to prune_vectors
i try to change
from

nlp.vocab.clear_vectors(size)

to

nlp.vocab.prune_vectors(size)

terms.train-vectors runnning smoothly

please fix this issue, Thx

regards,
Kun

Thanks for the report and your analysis! :+1:
Looks like we forgot to add this fix when updating Prodigy to use spaCy v2.0. Very sorry about that – will definitely be fixed and included in the next release.

sorry, about my analysis still wrong.

nlp.vocab.prune_vectors(size) # wrong
nlp.vocab.reset_vectors(width=size) # right
1 Like