sense2vec icon indicating copy to clipboard operation
sense2vec copied to clipboard

import error

Open salihai opened this issue 2 years ago • 4 comments

How can i solve this problem 'ImportError: cannot import name 'component' from 'spacy' (/usr/local/lib/python3.10/dist-packages/spacy/init.py)' ??

salihai avatar Oct 17 '23 21:10 salihai

Hi! Can you provide more context on what it is you're trying to do? There is no component to be imported from spaCy. Perhaps share your code so I can better understand what's going on?

svlandeg avatar Oct 18 '23 07:10 svlandeg

Here is my code:

import numpy as np from sense2vec import Sense2Vec s2v = Sense2Vec().from_disk('s2v_old')

salihai avatar Oct 18 '23 12:10 salihai

Could it be that your s2v_old model was trained with spaCy v2, and you're now executing this with spaCy v3? spaCy v2 used to have an import for component in the language module.

Unfortunately v2 and v3 aren't compatible. For more background, have a look at our blog post: https://explosion.ai/blog/spacy-v3

With respect to sense2vec:

  • sense2vec 1.x is compatible with spacy 2.x
  • sense2vec 2.x is compatible with spacy 3.x

svlandeg avatar Oct 18 '23 12:10 svlandeg

i will check it, thank you

salihai avatar Oct 18 '23 12:10 salihai