Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spaCy 3.1, 3.2 models not supported #41

Closed
BramVanroy opened this issue Jan 13, 2022 · 3 comments
Closed

spaCy 3.1, 3.2 models not supported #41

BramVanroy opened this issue Jan 13, 2022 · 3 comments

Comments

@BramVanroy
Copy link

I have tried to use this library with spaCy 3.1 and 3.2 models. The setup config says spacy>=3.1.0,<3.2.0 is supported, yet I get the ModelNotSupported error for both en_core_web_lg version 3.1.0 and en_core_web_trf version 3.1.0 models (both are installed). Coreferee en is also installed.

import coreferee
import spacy

nlp = spacy.load("en_core_web_lg")
nlp.add_pipe("coreferee")

Info about spaCy

  • spaCy version: 3.1.4
  • Platform: Windows-10-10.0.19041-SP0
  • Python version: 3.8.8
  • Pipelines: en_core_web_lg (3.1.0), en_core_web_trf (3.1.0)

Error trace

---------------------------------------------------------------------------
ModelNotSupportedError                    Traceback (most recent call last)
Input In [2], in <module>
      3 import spacy
      5 nlp = spacy.load("en_core_web_lg")
----> 6 nlp.add_pipe("coreferee")

File ~\.virtualenvs\lecontra-qSg6Vfcc\lib\site-packages\spacy\language.py:787, in Language.add_pipe(self, factory_name, name, before, after, first, last, source, config, raw_config, validate)
    779     if not self.has_factory(factory_name):
    780         err = Errors.E002.format(
    781             name=factory_name,
    782             opts=", ".join(self.factory_names),
   (...)
    785             lang_code=self.lang,
    786         )
--> 787     pipe_component = self.create_pipe(
    788         factory_name,
    789         name=name,
    790         config=config,
    791         raw_config=raw_config,
    792         validate=validate,
    793     )
    794 pipe_index = self._get_pipe_index(before, after, first, last)
    795 self._pipe_meta[name] = self.get_factory_meta(factory_name)

File ~\.virtualenvs\lecontra-qSg6Vfcc\lib\site-packages\spacy\language.py:670, in Language.create_pipe(self, factory_name, name, config, raw_config, validate)
    667 cfg = {factory_name: config}
    668 # We're calling the internal _fill here to avoid constructing the
    669 # registered functions twice
--> 670 resolved = registry.resolve(cfg, validate=validate)
    671 filled = registry.fill({"cfg": cfg[factory_name]}, validate=validate)["cfg"]
    672 filled = Config(filled)

File ~\.virtualenvs\lecontra-qSg6Vfcc\lib\site-packages\thinc\config.py:729, in registry.resolve(cls, config, schema, overrides, validate)
    720 @classmethod
    721 def resolve(
    722     cls,
   (...)
    727     validate: bool = True,
    728 ) -> Dict[str, Any]:
--> 729     resolved, _ = cls._make(
    730         config, schema=schema, overrides=overrides, validate=validate, resolve=True
    731     )
    732     return resolved

File ~\.virtualenvs\lecontra-qSg6Vfcc\lib\site-packages\thinc\config.py:778, in registry._make(cls, config, schema, overrides, resolve, validate)
    776 if not is_interpolated:
    777     config = Config(orig_config).interpolate()
--> 778 filled, _, resolved = cls._fill(
    779     config, schema, validate=validate, overrides=overrides, resolve=resolve
    780 )
    781 filled = Config(filled, section_order=section_order)
    782 # Check that overrides didn't include invalid properties not in config

File ~\.virtualenvs\lecontra-qSg6Vfcc\lib\site-packages\thinc\config.py:850, in registry._fill(cls, config, schema, validate, resolve, parent, overrides)
    847     getter = cls.get(reg_name, func_name)
    848     # We don't want to try/except this and raise our own error
    849     # here, because we want the traceback if the function fails.
--> 850     getter_result = getter(*args, **kwargs)
    851 else:
    852     # We're not resolving and calling the function, so replace
    853     # the getter_result with a Promise class
    854     getter_result = Promise(
    855         registry=reg_name, name=func_name, args=args, kwargs=kwargs
    856     )

File ~\.virtualenvs\lecontra-qSg6Vfcc\lib\site-packages\coreferee\manager.py:103, in CorefereeBroker.__init__(self, nlp, name)
    101 self.nlp = nlp
    102 self.pid = os.getpid()
--> 103 self.annotator = CorefereeManager().get_annotator(nlp)

File ~\.virtualenvs\lecontra-qSg6Vfcc\lib\site-packages\coreferee\manager.py:95, in CorefereeManager.get_annotator(nlp)
     93         keras_ensemble = keras.models.load_model(absolute_keras_model_filename)
     94         return Annotator(nlp, vectors_nlp, feature_table, keras_ensemble)
---> 95 raise ModelNotSupportedError(''.join((nlp.meta['lang'], '_', nlp.meta['name'],
     96     ' version ', nlp.meta['version'])))

ModelNotSupportedError: en_core_web_lg version 3.1.0
@slavaGanzin
Copy link

slavaGanzin commented Jan 31, 2022

@BramVanroy Hi

pip install --upgrade --ignore-installed  spacy==3.1.4   
python -m spacy download en_core_web_md  
python3 -m coreferee install en

worked for me, try yourself

@twielfaert
Copy link

The latest version (1.1.2) of coreferee requires Python >= 3.9 and at first glance, this seems to work fine with the spacy 3.1 models.

@richardpaulhudson
Copy link
Collaborator

Closing as no further answer received. The upcoming version Coreferee will support spaCy versions 3.1, 3.2 and 3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants