question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DeprecationWarning from `spacy_legacy`

See original GitHub issue

Hi there, I recently upgraded to spacy 3 and scispacy 0.4, but I am now getting a warning whenever I use the small scispacy model (I have not tried any other model).

I am getting a DeprecationWarning on a fresh install in python 3.8 with the latest version of scispacy and en_core_sci_sm.

Steps to reproduce:

pip install scispacy pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.4.0/en_core_sci_sm-0.4.0.tar.gz

import spacy
nlp = spacy.load("en_core_sci_sm")

import warnings
warnings.filterwarnings("error")
nlp("Hello World")

Any input to the nlp model triggers the same warning:

/opt/miniconda3/envs/clean/lib/python3.8/site-packages/spacy_legacy/layers/staticvectors_v1.py in forward(model, docs, is_train)
     43     )
     44     try:
---> 45         vectors_data = model.ops.gemm(model.ops.as_contig(V[rows]), W, trans2=True)
     46     except ValueError:
     47         raise RuntimeError(Errors.E896)

DeprecationWarning: Out of bound index found. 
This was previously ignored when the indexing result contained no elements. 
In the future the index error will be raised. 
This error occurs either due to an empty slice, or if an array has zero elements even before indexing.
(Use `warnings.simplefilter('error')` to turn this DeprecationWarning into an error and get more details on the invalid index.)

Any ideas as to how to resolve this without manually ignoring the warning?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10

github_iconTop GitHub Comments

1reaction
adrianeboydcommented, May 3, 2021

Hmm, this is one of those cases where I hesitate to describe a workaround, even though I think it’s technically possible (you’d have to replace MultiHashEmbed and StaticVectors with custom code).

But I really wouldn’t recommend it, especially for a widely distributed model, so my official answer is: no, I would retrain the model with the corrected config.

1reaction
adrianeboydcommented, Apr 30, 2021

Hi, it looks like en_core_sci_sm has include_static_vectors = true even though there are no vectors, which leads to this deprecation warning in numpy>=1.20.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Depricationwarning in simple test case · Issue #8046 - GitHub
This is a first time install of spaCy, CuPy, CUDA, etc. I think this is a packaging warning that may be unique to...
Read more >
spacy-legacy - PyPI
This package includes outdated registered functions for spaCy v3. x, for example model architectures, pipeline components and utilities.
Read more >
Spacy linking deprecation error - Rasa Community Forum
This is caused by model: external_data/spacy.word2vec.model in your pipeline. Same error, but not same cause. Do you need that model?
Read more >
Changes — textacy 0.11.0 documentation
The legacy function text_stats.readability_stats() still exists and behaves as before, but a deprecation warning is displayed. Added functions ...
Read more >
Legacy functions and architectures · spaCy API Documentation
The spacy-legacy package includes outdated registered functions and architectures. It is installed automatically as a dependency of spaCy, and provides ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found