adriangb / scikeras

Scikit-Learn API wrapper for Keras.
https://www.adriangb.com/scikeras/
MIT License
239 stars 47 forks source link

Working Scikeras Classifer model now broken with scikeras 0.13. AttributeError: 'Sequential' object has no attribute 'compiled'. #323

Closed CAW9 closed 4 months ago

CAW9 commented 4 months ago

Hello. I have used scikeras in my project for a while now. I was interested in upgrading to python 3.12 and scikeras 0.13, but it appears that using scikeras 0.13 breaks my project with the following error:

estimator.fit(X_train, y_train, fit_params) File "scikeras/wrappers.py", line 1501, in fit super().fit(X=X, y=y, sample_weight=sample_weight, kwargs) File "scikeras/wrappers.py", line 770, in fit self._fit( File "scikeras/wrappers.py", line 928, in _fit self._ensure_compiled_model() File "scikeras/wrappers.py", line 439, in _ensure_compiledmodel if not self.model.compiled: ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Sequential' object has no attribute 'compiled'

Thank you for any help you can provide. I did check doumentation to see if there were any changes I need to make to my code to keep up to date with 0.13, but it does not appear that any have been documented.

adriangb commented 4 months ago

Would you mind providing a self contained reproducible example? Thanks!

CAW9 commented 4 months ago

Absolutely, I will work that up for you.

CAW9 commented 4 months ago

https://colab.research.google.com/drive/1-fujpU2gwur6PxTQPJvXxwG_jiDCEiLd?usp=sharing

It looks like scikeras 0.13 is not compatible with keras 2, and scikeras 0.12 is not compatible with keras 3. Is this the case?

adriangb commented 4 months ago

Yes. I can’t maintain compatibility with two major versions unfortunately.

CAW9 commented 4 months ago

Thank you!

CAW9 commented 4 months ago

No further question.

adriangb commented 4 months ago

I'm glad we figured it out and I'm sorry about not being able to support older major versions :(