boudinfl/pke

pke.unsupervised.PositionRank() load_document max_length exectption

hafidmermouri opened this issue · 10 comments

Hello
I'm facing this issue on a production server Ubuntu 18
load() got an unexpected keyword argument 'max_length'
It's working just fine on my mac, here is the line causing the issue :
extractor.load_document(input = text, language = self.lang, normalization = 'lemmatization')
this is for English language. i've tried to pass a max_length = 10000000 params but didn't help.
Any idea how to fix it? Thanks

ygorg commented

Hi, this might have been fixed in this commit.
Please try installing the latest version of pke.

If it does not solve your problem please paste the output of python3 -m spacy validate, and a minimal reproducible code that triggers the error you face.

hi @ygorg, I've tried pip3 install -U git+https://github.com/boudinfl/pke.git but still get the error.
here is the result of validate :

✔ Loaded compatibility table

================= Installed pipeline packages (spaCy v3.1.3) =================
ℹ spaCy installation:
/home/hafid/.local/lib/python3.6/site-packages/spacy

NAME              SPACY            VERSION                            
fr_core_news_sm   >=3.1.0,<3.2.0   3.1.0   ✔
en_core_web_sm    >=3.1.0,<3.2.0   2.2.0   ✔

@ygorg spacy version is the same on my mac and it's working. the only difference I can see is the version of the en_core_web_sm which is 3.2.0 on my mac and 2.2.0 on my Ubuntu server

NAME              SPACY            VERSION                            
it_core_news_sm   >=3.1.0,<3.2.0   3.1.0   ✔
es_core_news_sm   >=3.1.0,<3.2.0   3.1.0   ✔
en_core_web_sm    >=3.1.0,<3.2.0   3.1.0   ✔
fr_core_news_sm   >=3.1.0,<3.2.0   3.1.0   ✔
de_core_news_sm   >=3.1.0,<3.2.0   3.1.0   ✔
```
thanks for the help
ygorg commented

Hi, since spacy v3 the max_length parameter was removed. So it should not be used (see here).

This parameter is here only for supporting spacy v2.

thanks @ygorg but I'm not using it actually. I got the error but don't know what's going on underground.
do you know how I can update en_core_web_sm to 3.2.0? or anything I could try to remove this error?

other thing that might have an impact: python version, I'm on 3.9 on my mac (works fine), and 3.6 on Ubuntu server (don't work) -> maybe related?

ygorg commented

Ah yes, to update the spacy model you can do python3 -m spacy download en_core_web_sm.

@ygorg I already did this but looks like the last version available for python 3.6 is the 2.2.0...

ygorg commented

On my ubuntu machine with pyhon3.6 i was able to install spacy version 3.1.3 (but I needed to remove all the installed models beforehand).
Alternatively you can reinstall the version 2 of spacy using pip install "spacy<3"

thanks @ygorg ! Updating python to 3.9 made it finally.

ygorg commented

Glad to hear ! Sorry for the inconvenience of the max_length parameter.