GithubHelp home page GithubHelp logo

Comments (21)

Praveenabiginfo avatar Praveenabiginfo commented on July 22, 2024 1

Why this error??

import spacy
spacy.load('en_coref_sm')
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/spacy/init.py", line 19, in load
return util.load_model(name, **overrides)
File "/usr/local/lib/python2.7/dist-packages/spacy/util.py", line 115, in load_model
return load_model_from_package(name, **overrides)
File "/usr/local/lib/python2.7/dist-packages/spacy/util.py", line 138, in load_model_from_package
return cls.load(**overrides)
File "/usr/local/lib/python2.7/dist-packages/en_coref_sm/init.py", line 15, in load
coref = NeuralCoref(nlp.vocab)
File "neuralcoref.pyx", line 529, in en_coref_sm.neuralcoref.neuralcoref.NeuralCoref.init
File "doc.pyx", line 100, in spacy.tokens.doc.Doc.set_extension
AssertionError

from neuralcoref.

Praveenabiginfo avatar Praveenabiginfo commented on July 22, 2024 1

Hi,

The issue is not related to Ubuntu it seems. I was using Python2.7 version before. I tried with Python 3.4. Now it is working fine. Is there any options to make it run on Python2.7 itself??

from neuralcoref.

thomwolf avatar thomwolf commented on July 22, 2024

hi @Praveenabiginfo, can you give me some information on your setup. Are you under windows, linux or mac and which version of python / environment manager you are using ?

from neuralcoref.

Praveenabiginfo avatar Praveenabiginfo commented on July 22, 2024

from neuralcoref.

theSage21 avatar theSage21 commented on July 22, 2024

Under neuralcoref 3.0 is from neuralcoref import Coref still working? I was reading your traceback and from there it appears that you're importing it using that statement.
@Praveenabiginfo does

import spacy
nlp = spacy.load('en_coref_sm')

solve your problem/work as expected?

from neuralcoref.

Praveenabiginfo avatar Praveenabiginfo commented on July 22, 2024

from neuralcoref.

thomwolf avatar thomwolf commented on July 22, 2024

I am uploading updated versions of the models (en_coref_sm is up, the others are still currently uploading) which should work with the original readme instructions (fixed the install scripts).

from neuralcoref.

Praveenabiginfo avatar Praveenabiginfo commented on July 22, 2024

from neuralcoref.

Praveenabiginfo avatar Praveenabiginfo commented on July 22, 2024

from neuralcoref.

thomwolf avatar thomwolf commented on July 22, 2024

Hi @Praveenabiginfo, I released a set of updated models just this morning. Can you try them instead of the old ones? I tested them on Python 2.7 and 3.6. See my last post in issue #47 for details.

from neuralcoref.

Praveenabiginfo avatar Praveenabiginfo commented on July 22, 2024

from neuralcoref.

thomwolf avatar thomwolf commented on July 22, 2024

Try to download them again please (I updated them several times this morning)

from neuralcoref.

Praveenabiginfo avatar Praveenabiginfo commented on July 22, 2024

from neuralcoref.

thomwolf avatar thomwolf commented on July 22, 2024

Ok I see, thanks for trying. I have to update the instal script for Ubuntu indeed.
I need to first setup an Ubuntu machine to test it.
I will come back to you when I managed to fix that.

from neuralcoref.

Praveenabiginfo avatar Praveenabiginfo commented on July 22, 2024

Today I again tried in a different machine which doesn't even have the spacy.
I installed spacy and then installed spacy model "sm" and then installed this new model of coref "sm" and installed Cython and did that steps from github specified in the document. All went well. But when I tried to load the new coref model again I got the same error.. Below is that error.

import spacy
spacy.load('en_coref_sm')
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/spacy/init.py", line 15, in load
return util.load_model(name, **overrides)
File "/usr/local/lib/python2.7/dist-packages/spacy/util.py", line 114, in load_model
return load_model_from_package(name, **overrides)
File "/usr/local/lib/python2.7/dist-packages/spacy/util.py", line 134, in load_model_from_package
cls = importlib.import_module(name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/usr/local/lib/python2.7/dist-packages/en_coref_sm/init.py", line 6, in
from en_coref_sm.neuralcoref import NeuralCoref
File "/usr/local/lib/python2.7/dist-packages/en_coref_sm/neuralcoref/init.py", line 1, in
from .neuralcoref import NeuralCoref
File "neuralcoref.pyx", line 101, in init en_coref_sm.neuralcoref.neuralcoref
TypeError: must be char, not unicode

from neuralcoref.

thomwolf avatar thomwolf commented on July 22, 2024

Well it is working on my mac (OS Sierra) on Python 2.7 so I am a bit puzzled.
Can you try installing a full clean version with

pip install --upgrade --force-reinstall --no-cache-dir MODEL_URL

from neuralcoref.

Praveenabiginfo avatar Praveenabiginfo commented on July 22, 2024

from neuralcoref.

Praveenabiginfo avatar Praveenabiginfo commented on July 22, 2024

from neuralcoref.

gonz avatar gonz commented on July 22, 2024

I'm also having this issue, I'm using python 2.7.6 on a Ubuntu 14.04.

This is the full traceback:

In [1]: import spacy; spacy.load('en_coref_sm')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-bd9aa5b27231> in <module>()
----> 1 import spacy; spacy.load('en_coref_sm')

/home/ubuntu/.virtualenvs/apex/local/lib/python2.7/site-packages/spacy/__init__.pyc in load(name, **overrides)
     13     if depr_path not in (True, False, None):
     14         deprecation_warning(Warnings.W001.format(path=depr_path))
---> 15     return util.load_model(name, **overrides)
     16
     17

/home/ubuntu/.virtualenvs/apex/local/lib/python2.7/site-packages/spacy/util.pyc in load_model(name, **overrides)
    112             return load_model_from_link(name, **overrides)
    113         if is_package(name):  # installed as package
--> 114             return load_model_from_package(name, **overrides)
    115         if Path(name).exists():  # path to model data directory
    116             return load_model_from_path(Path(name), **overrides)

/home/ubuntu/.virtualenvs/apex/local/lib/python2.7/site-packages/spacy/util.pyc in load_model_from_package(name, **overrides)
    132 def load_model_from_package(name, **overrides):
    133     """Load a model from an installed package."""
--> 134     cls = importlib.import_module(name)
    135     return cls.load(**overrides)
    136

/usr/lib/python2.7/importlib/__init__.pyc in import_module(name, package)
     35             level += 1
     36         name = _resolve_name(name[level:], package, level)
---> 37     __import__(name)
     38     return sys.modules[name]

/home/ubuntu/.virtualenvs/apex/local/lib/python2.7/site-packages/en_coref_sm/__init__.py in <module>()
      4 from pathlib import Path
      5 from spacy.util import load_model_from_init_py, get_model_meta
----> 6 from en_coref_sm.neuralcoref import NeuralCoref
      7
      8 __version__ = get_model_meta(Path(__file__).parent)['version']

/home/ubuntu/.virtualenvs/apex/local/lib/python2.7/site-packages/en_coref_sm/neuralcoref/__init__.py in <module>()
----> 1 from .neuralcoref import NeuralCoref

neuralcoref.pyx in init en_coref_sm.neuralcoref.neuralcoref()

TypeError: must be char, not unicode

Initially I hit the AssertionError @Praveenabiginfo mentioned on Jun 27th, I fixed that by upgrading spacy from 2.0.7 to 2.0.12. Now I'm stuck with this TypeError when loading the model from spacy.

from neuralcoref.

thomwolf avatar thomwolf commented on July 22, 2024

This should be fixed in the latest release (4.0).

from neuralcoref.

saurabhhssaurabh avatar saurabhhssaurabh commented on July 22, 2024

Facing same iussue:
neuralcoref 4.0
spacy 2.1.0

/data/saurabh/neuralcoref/neuralcoref/init.py in ()
12 warnings.filterwarnings("ignore", message="spacy.strings.StringStore size changed")
13
---> 14 from .neuralcoref import NeuralCoref
15 from .file_utils import NEURALCOREF_MODEL_URL, NEURALCOREF_MODEL_PATH, NEURALCOREF_CACHE, cached_path
16

neuralcoref.pyx in init neuralcoref.neuralcoref()

TypeError: must be char, not unicode

from neuralcoref.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.