Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with spacy 3.x #22

Open
ayeshah opened this issue Feb 10, 2021 · 7 comments
Open

Not compatible with spacy 3.x #22

ayeshah opened this issue Feb 10, 2021 · 7 comments

Comments

@ayeshah
Copy link

ayeshah commented Feb 10, 2021

When running the sample code I get the following error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-82-777c977a1d80> in <module>
      1 import doccano_transformer
      2 
----> 3 from doccano_transformer.datasets import NERDataset
      4 from doccano_transformer.utils import read_jsonl
      5 

~/miniconda3/envs/base/lib/python3.7/site-packages/doccano_transformer/datasets.py in <module>
      3 from typing import Any, Callable, Iterable, Iterator, List, Optional, TextIO
      4 
----> 5 from doccano_transformer.examples import Example, NERExample
      6 
      7 

~/miniconda3/envs/base/lib/python3.7/site-packages/doccano_transformer/examples.py in <module>
      2 from typing import Callable, Iterator, List, Optional
      3 
----> 4 from spacy.gold import biluo_tags_from_offsets
      5 
      6 from doccano_transformer import utils

ModuleNotFoundError: No module named 'spacy.gold'

Seems like this is removed from spacy v3.x: https://github.com/explosion/spaCy/releases

@agademic
Copy link

agademic commented Feb 19, 2021

Just change the line

from space.gold import biluo_tags_from_offsets

to

from spacy.training import offsets_to_biluo_tags

and the corresponding function call in the doccano_transformer.examples file and it should be fine.

[EDIT] It works only if you want to use the dataset.to_conll2003 method.

For dataset.to_spacyit still throws an error, since the token object (created in utils) doesn't seem to be spacy compatible.

@sonvx
Copy link

sonvx commented Mar 9, 2021

  • If you don't have other constraints, downgrade spacy should work:
pip install spacy==2.3.2

Or

conda install -c conda-forge spacy==2.3.2

@mirfan899
Copy link

Having the same issue.

@Matt-Payne
Copy link

How do you let a bug like this just sit? Unusable after spacy 3

@sonvx
Copy link

sonvx commented Jun 13, 2021

@mirfan899 @Matt-Payne you should clearly explain if my approach doesn't work: if you followed, what errors did you get? I clearly mentioned that there might be other constraints :).

@mirfan899
Copy link

What does the issue say? He is not asking for constraints you came up with. It clearly mentions that doccano-ransformer not compatible with spacy 3.

@abtExp
Copy link

abtExp commented Jul 8, 2021

I've written a script to convert the doccano output jsonl to bilou format json that can be directly converted and used for spacy training.
Check it out here : https://github.com/abtExp/doccano_to_bilou

My script doesn't rely on spacy, thus no compatibility issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants