IBM / zshot

Zero and Few shot named entity & relationships recognition
https://ibm.github.io/zshot
MIT License
350 stars 20 forks source link

[Bug] flair POS mentions extractor not working #72

Closed marmg closed 9 months ago

marmg commented 1 year ago

Summary

With torch>=2.0 there is an existing bug in flair that makes flair POS mentions extractor fail: https://github.com/flairNLP/flair/issues/3187

Describe the bug The POS models for SequenceTagger in the Huggingface Hub are not updated for torch>=2.0

E       AttributeError: 'dict' object has no attribute 'embedding_length'

To Reproduce

import spacy

from zshot import PipelineConfig
from zshot.mentions_extractor import MentionsExtractorFlair
from zshot.mentions_extractor.mentions_extractor_flair import ExtractorType

nlp = spacy.blank("en")

config_zshot = PipelineConfig(mentions_extractor=MentionsExtractorFlair(ExtractorType.POS))
nlp.add_pipe("zshot", config=config_zshot, last=True)
assert "zshot" in nlp.pipe_names
doc = nlp("Test example text")

Expected behavior It should work without errors.