huggingface / neuralcoref

✨Fast Coreference Resolution in spaCy with Neural Networks
https://huggingface.co/coref/
MIT License
2.85k stars 477 forks source link

displacy fails if neuralcoref in the pipeline #274

Closed simonm3 closed 4 years ago

simonm3 commented 4 years ago

Error is cannot serialize cluster object. Full trace below:

doc = nlp('Jane has a dog. She loves him.')
displacy.render(doc)

TypeError Traceback (most recent call last)

in 1 doc = nlp('Jane has a dog. She loves him.') ----> 2 displacy.render(doc) ~\Anaconda3\Lib\site-packages\spacy\displacy\__init__.py in render(docs, style, page, minify, jupyter, options, manual) 49 renderer, converter = factories[style] 50 renderer = renderer(options=options) ---> 51 parsed = [converter(doc, options) for doc in docs] if not manual else docs 52 _html["parsed"] = renderer.render(parsed, page=page, minify=minify).strip() 53 html = _html["parsed"] ~\Anaconda3\Lib\site-packages\spacy\displacy\__init__.py in (.0) 49 renderer, converter = factories[style] 50 renderer = renderer(options=options) ---> 51 parsed = [converter(doc, options) for doc in docs] if not manual else docs 52 _html["parsed"] = renderer.render(parsed, page=page, minify=minify).strip() 53 html = _html["parsed"] ~\Anaconda3\Lib\site-packages\spacy\displacy\__init__.py in parse_deps(orig_doc, options) 116 RETURNS (dict): Generated dependency parse keyed by words and arcs. 117 """ --> 118 doc = Doc(orig_doc.vocab).from_bytes(orig_doc.to_bytes()) 119 if not doc.is_parsed: 120 user_warning(Warnings.W005) doc.pyx in spacy.tokens.doc.Doc.to_bytes() ~\Anaconda3\Lib\site-packages\spacy\util.py in to_bytes(getters, exclude) 580 # Split to support file names like meta.json 581 if key.split(".")[0] not in exclude: --> 582 serialized[key] = getter() 583 return srsly.msgpack_dumps(serialized) 584 doc.pyx in spacy.tokens.doc.Doc.to_bytes.lambda8() ~\Anaconda3\Lib\site-packages\srsly\_msgpack_api.py in msgpack_dumps(data) 14 RETURNS (bytes): The serialized bytes. 15 """ ---> 16 return msgpack.dumps(data, use_bin_type=True) 17 18 ~\Anaconda3\Lib\site-packages\srsly\msgpack\__init__.py in packb(o, **kwargs) 38 Pack an object and return the packed bytes. 39 """ ---> 40 return Packer(**kwargs).pack(o) 41 42 _packer.pyx in srsly.msgpack._packer.Packer.pack() _packer.pyx in srsly.msgpack._packer.Packer.pack() _packer.pyx in srsly.msgpack._packer.Packer.pack() _packer.pyx in srsly.msgpack._packer.Packer._pack() _packer.pyx in srsly.msgpack._packer.Packer._pack() _packer.pyx in srsly.msgpack._packer.Packer._pack() TypeError: can not serialize 'Cluster' object
simonm3 commented 4 years ago

duplicate