I want to use Benepar with a French model to do a semantic segmentation.
I followed the tutorial but I have always have this error
RuntimeError: Error(s) in loading state_dict for ChartParser:
Unexpected key(s) in state_dict: “pretrained_model.embeddings.position_ids”.
I tried to do the following:
import benepar
benepar.download('benepar_fr2')
import spacy
nlp = spacy.load('fr_core_news_sm')
parser = benepar.Parser("benepar_fr2")
def parse_sentence(text):
doc = nlp(text)
parsed_sents = [parser.parse(sent.text) for sent in doc.sents]
return parsed_sents
sentence = "Le chat mange une souris."
parsed_sentence = parse_sentence(sentence)
print(parsed_sentence)
2