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

File "pipes.pyx", line 1465, in spacy.pipeline.pipes.Sentencizer.from_nlp TypeError: type() takes 1 or 3 arguments #246

Open
hadifar opened this issue Jan 10, 2022 · 3 comments

Comments

@hadifar
Copy link

hadifar commented Jan 10, 2022

Running the re-ranking example throws the following exception:

Traceback (most recent call last):
  File "/project_scratch/t5_ranking.py", line 2, in <module>
    from pygaggle.rerank.transformer import MonoBERT
  File "/project_scratch/users/amir/projects/RAG/dialdoc-task/env/lib/python3.9/site-packages/pygaggle/rerank/transformer.py", line 13, in <module>
    from .similarity import SimilarityMatrixProvider
  File "/project_scratch/users/amir/projects/RAG/dialdoc-task/env/lib/python3.9/site-packages/pygaggle/rerank/similarity.py", line 5, in <module>
    from pygaggle.model.encode import SingleEncoderOutput
  File "/project_scratch/users/amir/projects/RAG/dialdoc-task/env/lib/python3.9/site-packages/pygaggle/model/__init__.py", line 6, in <module>
    from .encode import *
  File "/project_scratch/users/amir/projects/RAG/dialdoc-task/env/lib/python3.9/site-packages/pygaggle/model/encode.py", line 8, in <module>
    from .tokenize import BatchTokenizer
  File "/project_scratch/users/amir/projects/RAG/dialdoc-task/env/lib/python3.9/site-packages/pygaggle/model/tokenize.py", line 172, in <module>
    class SpacySenticizer:
  File "/project_scratch/users/amir/projects/RAG/dialdoc-task/env/lib/python3.9/site-packages/pygaggle/model/tokenize.py", line 174, in SpacySenticizer
    nlp.add_pipe(nlp.create_pipe('sentencizer'))
  File "/project_scratch/users/amir/projects/RAG/dialdoc-task/env/lib/python3.9/site-packages/spacy/language.py", line 302, in create_pipe
    return factory(self, **config)
  File "/project_scratch/users/amir/projects/RAG/dialdoc-task/env/lib/python3.9/site-packages/spacy/language.py", line 1045, in factory
    return obj.from_nlp(nlp, **cfg)
  File "pipes.pyx", line 1465, in spacy.pipeline.pipes.Sentencizer.from_nlp
TypeError: type() takes 1 or 3 arguments

Do you know what's the problem and how can I fix it?

spacy version: 2.2.4
tokenizers version: 0.10.3
transformers version: 4.15.0

Python 3.9.7

Thanks

@ronakice
Copy link
Member

Install from source? The spacy version is not 2.2.4 in the requirements file

@hadifar
Copy link
Author

hadifar commented Jan 12, 2022

Thanks for your quick reply.

I installed the library by running pip install -r requirements. The issue was due to my python version, the problem fixed when I switched to python 3.7 :)

@lintool
Copy link
Member

lintool commented Jan 12, 2022

Hi @hadifar - Can you try using Python 3.8 and see what happens? cf. castorini/pyserini#916

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

3 participants