spacy.load上的MemoryError(' en')

时间:2017-08-16 18:36:33

标签: python-2.7 nlp spacy

我是 NLP spaCy 的新手。在this site,我正在尝试学习spaCy。我完成了模型的安装(en_core_web_en)。我在此目录中设置了spaCy:' / home / uapncpc / myProjects / project02 / spaCy /'。

在这个目录中,我创建了test.py文件,内容如下:

import spacy
nlp = spacy.load('en')
doc = nlp(u'This is a sentence.')

当我运行此代码时,我收到以下错误:

Traceback (most recent call last):
  File "/home/uapncpc/myProjects/project02/spaCy/test.py", line 2, in <module>
    nlp = spacy.load('en')
  File "/home/uapncpc/myProjects/project02/spaCy/spacy/__init__.py", line 42, in load
    return cls(**overrides)
  File "/home/uapncpc/myProjects/project02/spaCy/spacy/en/__init__.py", line 34, in __init__
    Language.__init__(self, **overrides)
  File "/home/uapncpc/myProjects/project02/spaCy/spacy/language.py", line 279, in __init__
    if 'parser' not in overrides \
  File "/home/uapncpc/myProjects/project02/spaCy/spacy/language.py", line 100, in create_parser
    return DependencyParser.load(nlp.path / 'deps', nlp.vocab, **cfg)
  File "spacy/syntax/parser.pyx", line 158, in spacy.syntax.parser.Parser.load (spacy/syntax/parser.cpp:7659)
    self.model.load(str(path / 'model'))
  File "thinc/linear/avgtron.pyx", line 104, in thinc.linear.avgtron.AveragedPerceptron.load (thinc/linear/avgtron.cpp:3514)
  File "preshed/maps.pyx", line 34, in preshed.maps.PreshMap.__init__ (preshed/maps.cpp:1193)
  File "preshed/maps.pyx", line 109, in preshed.maps.map_init (preshed/maps.cpp:3058)
  File "cymem/cymem.pyx", line 42, in cymem.cymem.Pool.alloc (cymem/cymem.cpp:1091)
MemoryError: Error assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytesError assigning 33554432 bytes

我正在使用:

  1. 操作系统:Ubuntu 14.04(64位)
  2. 使用的Python版本: Python 2.7.6
  3. 已安装spaCy:我已跟随this page
  4. 中的从源代码编译部分
  5. 内存:内存 - 2 GB
  6. 磁盘内存:总容量-27.3 GB,可用空间-11.6 GB
  7. 现在我需要帮助

    1. 如何克服此错误?
    2. 我应该在哪个目录中为我的项目编码?
    3. 提前致谢

0 个答案:

没有答案