Skip to content
New issue

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

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

Already on GitHub? # to your account

Keras 3 support #315

Closed
jamesmyatt opened this issue Mar 18, 2024 · 6 comments
Closed

Keras 3 support #315

jamesmyatt opened this issue Mar 18, 2024 · 6 comments

Comments

@jamesmyatt
Copy link

Does SciKeras work with Keras 3, which was released recently? https://keras.io/keras_3/

Are there any changes that might need to be made to SciKeras? https://keras.io/guides/migrating_to_keras_3/

@Martin-Molinero
Copy link

Don't think it's working with keras 3, getting the following error with keras==3.0.5 scikeras==0.12.0 scikit-learn==1.4.1.post1 tensorflow==2.16.1

Expected: No Exception to be thrown
  But was:  <Python.Runtime.PythonException: Could not interpret metric identifier: loss
  File "/opt/miniconda3/lib/python3.11/site-packages/keras/src/metrics/__init__.py", line 204, in get
    raise ValueError(f"Could not interpret metric identifier: {identifier}")
  File "/opt/miniconda3/lib/python3.11/site-packages/scikeras/utils/__init__.py", line 111, in metric_name
    fn_or_cls = keras_metric_get(metric)
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/scikeras/wrappers.py", line 531, in _fit_keras_model
    key = metric_name(key)
          ^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.11/site-packages/scikeras/wrappers.py", line 536, in _fit_keras_model
    raise e
  File "/opt/miniconda3/lib/python3.11/site-packages/scikeras/wrappers.py", line 928, in _fit
    self._fit_keras_model(
  File "/opt/miniconda3/lib/python3.11/site-packages/scikeras/wrappers.py", line 760, in fit
    self._fit(
  File "/opt/miniconda3/lib/python3.11/site-packages/scikeras/wrappers.py", line 1491, in fit
    super().fit(X=X, y=y, sample_weight=sample_weight, **kwargs)

@adriangb
Copy link
Owner

It is not compatible right now but I think getting it compatible with Keras v3 (and doing cleanup along the way) would be a good milestone.

@jamesmyatt
Copy link
Author

That would be great. Keras 3 should increase interest in Keras again, so it would be a great help to have this.

@adriangb
Copy link
Owner

I started working on this: keras-team/keras#19352

@adriangb
Copy link
Owner

adriangb commented Apr 7, 2024

Could you please try #317 (pip install -U 'git+https://github.com/adriangb/scikeras.git@keras-3') and see if it fixes your problem? Thanks!

@adriangb
Copy link
Owner

This should be fixed now. Please let me know if this is still not fixed with SciKeras 0.13.0. Thanks!

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

No branches or pull requests

3 participants