简体   繁体   中英

.error: look-behind requires fixed-width pattern (while loading spacy custom model)

I trained a custom model by this ( https://spacy.io/usage/training/#example-new-entity-type ) method specified in the spacy website. While loading the traine model , i got the error :

  File "tokenizer.pyx", line 450, in spacy.tokenizer.Tokenizer.from_disk
  File "tokenizer.pyx", line 498, in spacy.tokenizer.Tokenizer.from_bytes
  File "/home/ubuntu/764934/nlp_1/lib/python3.5/re.py", line 224, in compile
    return _compile(pattern, flags)
  File "/home/ubuntu/764934/nlp_1/lib/python3.5/re.py", line 293, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/home/ubuntu/764934/nlp_1/lib/python3.5/sre_compile.py", line 540, in compile
    code = _code(p, flags)
  File "/home/ubuntu/764934/nlp_1/lib/python3.5/sre_compile.py", line 525, in _code
    _compile(code, p.data, flags)
  File "/home/ubuntu/764934/nlp_1/lib/python3.5/sre_compile.py", line 185, in _compile
    _compile(code, av, flags)
  File "/home/ubuntu/764934/nlp_1/lib/python3.5/sre_compile.py", line 158, in _compile
    raise error("look-behind requires fixed-width pattern")

Anyone who got/solved this error could help me.

Check that you're loading the model with the same version of spacy that you used for training. Compare the first two numbers in the version to see if they're compatible (look in meta.json in the saved model): spacy v2.0 models can't be loaded by spacy v2.1, but a model trained with spacy v2.1.0 should still work with spacy v2.1.9.

Here's a similar issue: https://github.com/explosion/spaCy/issues/3564

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM