Comments (3)
This sample code that only sources the single coref
component wouldn't work correctly for spacy v3.6, either. It wouldn't raise an error, but the coref output would be gibberish because it doesn't have its own separate transformer
component in the pipeline.
This particular error message can definitely be improved, though.
If you want to combine them, see this thread for how to either replace the listeners or run the two pipelines separately on the same doc: #12302 (comment)
from spacy.
Thanks for reporting this issue! We'll look into it.
In the meantime, you should be able to reinstall the latest version of spaCy after installing the experimental co-ref component: python -m pip install spacy -U
. The dependency resolver error can be ignored in this case. Alternatively, you can manually edit the wheel to update the version pin.
from spacy.
Hi, I updated the version pin of the package and created a new wheel. When I run the following:
import spacy
nlp = spacy.load("en_core_web_trf")
nlp_coref = spacy.load("en_coreference_web_trf")
nlp.add_pipe("coref", source=nlp_coref)
sentences = nlp("my name is theodor and my wife's name is sandra")
I get:
/redacted/venv/lib/python3.10/site-packages/spacy_transformers/layers/hf_shim.py:137: UserWarning: Error loading saved torch state_dict with strict=True, likely due to differences between 'transformers' versions. Attempting to load with strict=False as a fallback...
If you see errors or degraded performance, download a newer compatible model or retrain your custom model with the current 'transformers' and 'spacy-transformers' versions. For more details and available updates, run: python -m spacy validate
warnings.warn(warn_msg)
Traceback (most recent call last):
File "/redacted/run.py", line 6, in <module>
sentences = nlp("my name is theodor and my wife's name is sandra")
File "/redacted/venv/lib/python3.10/site-packages/spacy/language.py", line 1054, in __call__
error_handler(name, proc, [doc], e)
File "/redacted/venv/lib/python3.10/site-packages/spacy/util.py", line 1704, in raise_error
raise e
File "/redacted/venv/lib/python3.10/site-packages/spacy/language.py", line 1049, in __call__
doc = proc(doc, **component_cfg.get(name, {})) # type: ignore[call-arg]
File "spacy/pipeline/trainable_pipe.pyx", line 56, in spacy.pipeline.trainable_pipe.TrainablePipe.__call__
File "/redacted/venv/lib/python3.10/site-packages/spacy/util.py", line 1704, in raise_error
raise e
File "spacy/pipeline/trainable_pipe.pyx", line 52, in spacy.pipeline.trainable_pipe.TrainablePipe.__call__
File "/redacted/venv/lib/python3.10/site-packages/spacy_experimental/coref/coref_component.py", line 153, in predict
scores, idxs = self.model.predict([doc])
File "/redacted/venv/lib/python3.10/site-packages/thinc/model.py", line 334, in predict
return self._func(self, X, is_train=False)[0]
File "/redacted/venv/lib/python3.10/site-packages/thinc/layers/chain.py", line 54, in forward
Y, inc_layer_grad = layer(X, is_train=is_train)
File "/redacted/venv/lib/python3.10/site-packages/thinc/model.py", line 310, in __call__
return self._func(self, X, is_train=is_train)
File "/redacted/venv/lib/python3.10/site-packages/thinc/layers/chain.py", line 54, in forward
Y, inc_layer_grad = layer(X, is_train=is_train)
File "/redacted/venv/lib/python3.10/site-packages/thinc/model.py", line 310, in __call__
return self._func(self, X, is_train=is_train)
File "/redacted/venv/lib/python3.10/site-packages/spacy_transformers/layers/trfs2arrays.py", line 40, in forward
if "last_hidden_state" in trf_data.model_output:
AttributeError: 'DocTransformerOutput' object has no attribute 'model_output'
This suggests that there are incompatibilities between the packages. However, simply running text through the nlp_coref
object works, so this is likely an issue with the extensions rather than the model.
from spacy.
Related Issues (20)
- Spacy defines Noun as a root for a sentence HOT 1
- CUDA Runtime Error during Spacy Transformers NER Model Training HOT 2
- Spacy-LLM code sample produces no output HOT 14
- Working with the new `._.trf_data` object (3.7+) HOT 7
- spacy.load error decorative function HOT 1
- The en_core_web_trf model results in zero output HOT 2
- No such command 'fill-curated-transformer' HOT 4
- MemoryError: Unable to allocate 29.7 GiB for an array with shape (86399, 4, 4, 2880, 2) and data type float32 HOT 2
- Issue when calling spacy info HOT 3
- Spcay recoginize similar words into different entities
- Publish `requirements.txt` or `environment.yml` for installing latest versions of spacy and other dependencies HOT 1
- Downloading model error: ModuleNotFoundError: No module named 'spacy.symbols' HOT 1
- README.md Link Suggestions HOT 1
- English models' Accuracy Evaluation values HOT 1
- Spacy high memory consumption issue HOT 1
- Spacy dependency requirements are not met for pydantic versions ^2 HOT 1
- bus error upon existing the program after using spacy on mac M1 HOT 7
- DocBin.to_bytes fails with a "ValueError: bytes object is too large" Spacy v 3.7.2
- max_length of nlp pipline for e.g. japanese HOT 4
- Doc Report HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spacy.