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.

deprecation issue with add_pipe in spacy

See original GitHub issue

I just installed this library to play around and noticed a deprecation between spacy v2 and v3 where the add_pipe function has been altered.

I found the answer here: https://stackoverflow.com/questions/67906945/valueerror-nlp-add-pipe-now-takes-the-string-name-of-the-registered-component-f

Ive changed a file locally (splitter.py lines 8 and 9) from:

import os
import re

import spacy

os.environ['LANGUAGE_MODEL_SPACY'] = "en_core_web_md"
nlp = spacy.load(os.environ['LANGUAGE_MODEL_SPACY'])
sentencizer = nlp.create_pipe("sentencizer")
nlp.add_pipe(sentencizer)

to:

import os
import re

import spacy

os.environ['LANGUAGE_MODEL_SPACY'] = "en_core_web_md"
nlp = spacy.load(os.environ['LANGUAGE_MODEL_SPACY'])
#sentencizer = nlp.create_pipe("sentencizer") #<-- not needed
nlp.add_pipe("sentencizer") #<-- made into a string.

This worked for me since I have v3 of spacy but im not sure how to make this work regardless of any other users in the future with different versions of spacy. Ill leave the decision to you.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
almarengocommented, Feb 17, 2022

For sure @jonathan-rowley, thanks for getting back. Please, keep testing it and feel free to reach out if you have any comments/suggestions on how to improve it.

0reactions
jonathan-rowleycommented, Feb 17, 2022

Hi @jonathan-rowley,

Thank you for opening issue #15 and testing/commenting on sent2vec. I am a contributor of this repository and I was wondering if you have any interest in being a collaborator/tester of sent2vec as well. I’m currently working on improving its architecture and I could use some help, especially testing, with the new version.

Thanks!

@almarengo, Thanks for the offer. I am currently evaluating to see if sent2vec can solve some of my problems and I like it so far but still have some more to test. If I come across any issues that I can find then i will try and open an issue here with any possible resolutions i can come up with. for this time I guess that puts me in a testing role and if I find a good way to integrate with sent2vec I wouldnt mind adding to or improving down the road.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's New in v3.0 · spaCy Usage Documentation
Note that spaCy v3.0 now requires Python 3.6+. API changes. Pipeline package symlinks, the link command and shortcut names are now deprecated ......
Read more >
Unexpected behavior of nlp.has_pipe("sentencizer") #2693
I was able to recreate the issue on my computer. It looks like pipe_create is the only pipe method for which the alias...
Read more >
spaCy add_pipe() and analyze_pipes() error - python
It works on its website but not in my jupyternotebook. When I ran the following code: import spacy. nlp = spacy.blank("en") nlp.add_pipe("tagger ...
Read more >
Spacy linking deprecation error - Rasa Open Source
When I using the command “python -m spacy link en_core_web_md en”. I receive a deprecation error. So, I can't link spacy Rasa Version:...
Read more >
Changelog
Fix issue where the FlowRunView could fail to initialize when the ... Remove deprecated prefect agent local start flag --storage-labels ...
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