hipster-philology / pandora

A Tagger-Lemmatizer for Natural Languages
MIT License
9 stars 4 forks source link

TypeError: to_categorical() got an unexpected keyword argument 'nb_classes' #12

Closed Jean-Baptiste-Camps closed 7 years ago

Jean-Baptiste-Camps commented 7 years ago

I have recently tried to use Pandora with Python 3 on Ubuntu 16.04, with a newer install of all packages. Doing this, I encountered an error, that might be related to a change in Keras (?): TypeError: to_categorical() got an unexpected keyword argument 'nb_classes' I will try to examine it more closely soon.

Traceback (most recent call last):
File "main.py", line 59, in <module>
  main(**vars(parser.parse_args()))
File "main.py", line 42, in main
  dev_data=dev_data
File "/home/jbcamps/02_lemmatisation/vanilla_pandora/pandora/pandora/tagger.py", line 242, in   setup_to_train
  morph=self.train_morph)
File "/home/jbcamps/02_lemmatisation/vanilla_pandora/pandora/pandora/preprocessing.py", line 490, in transform
  nb_classes=len(self.lemma_encoder.classes_))
TypeError: to_categorical() got an unexpected keyword argument 'nb_classes'
mikekestemont commented 7 years ago

Update your keras to the latest version (although this will introduce new bugs that I still have to sort out: it seems like bidirectional recurrent can't be saved properly due to a bug in keras). Convolutional layers still work.

Jean-Baptiste-Camps commented 7 years ago

Ok, rolling back from Keras==2.0.4 to Keras==1.2.0 and from tensorflow==1.1.0 to tensorflow==0.12.1 solved the issue for now.

Jean-Baptiste-Camps commented 7 years ago

I have tried updating keras to bleeding edge (via git+git install), but it did not seem to solve the issue. And it is using convolutionnal that I got this bug.

mikekestemont commented 7 years ago

Ah, I see: I pushed my latest changes to a new branch (pytorch) instead of master. sorry!

Prof. Dr. Mike Kestemont | www.mike-kestemont.org | Twitter: @Mike_Kestemont | mike.kestemont@uantwerp.be | mike.kestemont@gmail.com | University of Antwerp | City Campus, Prinsstraat 13, room D. 118 I B-2000 Antwerp, Belgium | tel. +32 (0)3 265.42.54

Check out our documentary on Digital Humanities and Hildegard of Bingen: watch it in HD on Vimeo: https://vimeo.com/70881172

On Thu, May 4, 2017 at 10:42 AM, Jean-Baptiste-Camps < notifications@github.com> wrote:

I have tried updating keras to bleeding edge (via git+git install), but it did not seem to solve the issue. And it is using convolutionnal that I got this bug.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/hipster-philology/pandora/issues/12#issuecomment-299127880, or mute the thread https://github.com/notifications/unsubscribe-auth/AELJL9h97ZJp0RUI-GOD84sgSqmR9k-aks5r2Y-LgaJpZM4NQB0G .