spaCy icon indicating copy to clipboard operation
spaCy copied to clipboard

Spacy 3.7.5 not working with python 3.12.4

Open Snawe opened this issue 1 year ago • 4 comments

How to reproduce the behaviour

  • Install spacy 3.7.5
  • Use Python 3.12.4
  • Run the example from the homepage
# pip install -U spacy
# python -m spacy download en_core_web_sm
import spacy

# Load English tokenizer, tagger, parser and NER
nlp = spacy.load("en_core_web_sm")

# Process whole documents
text = (
    "When Sebastian Thrun started working on self-driving cars at "
    "Google in 2007, few people outside of the company took him "
    "seriously. “I can tell you very senior CEOs of major American "
    "car companies would shake my hand and turn away because I wasn’t "
    "worth talking to,” said Thrun, in an interview with Recode earlier "
    "this week."
)
doc = nlp(text)

# Analyze syntax
print("Noun phrases:", [chunk.text for chunk in doc.noun_chunks])
print("Verbs:", [token.lemma_ for token in doc if token.pos_ == "VERB"])

# Find named entities, phrases and concepts
for entity in doc.ents:
    print(entity.text, entity.label_)

get the error:

ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
  File "/path/to/file.py", line 3, in <module>
    import spacy
TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'

The issue seems to be a pydantic issue and is already solved: https://github.com/pydantic/pydantic/issues/9609

Your Environment

  • Operating System: Ubuntu
  • Python Version Used: 3.12.4
  • spaCy Version Used: 3.7.5

Snawe avatar Jun 30 '24 18:06 Snawe

针对onnx模型转换的各种问题,推荐使用最新的pnnx工具转换到ncnn In view of various problems in onnx model conversion, it is recommended to use the latest pnnx tool to convert your model to ncnn

pip install pnnx
pnnx model.onnx inputshape=[1,3,224,224]

详细参考文档 Detailed reference documentation https://github.com/pnnx/pnnx https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx#how-to-use-pnnx

nihui avatar Aug 05 '24 09:08 nihui