yzhao062 / pyod

A Python Library for Outlier and Anomaly Detection, Integrating Classical and Deep Learning Techniques
http://pyod.readthedocs.io
BSD 2-Clause "Simplified" License
8.27k stars 1.35k forks source link

Current implementation is not compatible with Keras 3 #554

Closed h3dema closed 2 months ago

h3dema commented 2 months ago

Starting with TensorFlow 2.16, doing pip install tensorflow will install Keras 3. Therefore, if you make the following installation on a fresh installed Ubuntu 22:

$ pip3 install -r <pyod>/requirements.txt
$ pip3 install tensorflow 
$ pip3 install pyod

where \<pyod> is the path to the downloaded repository

You ended up with an environment with

Then if you run:

$ cd <pyod>
$ python3 alad_example.py

... ValueError: A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces keras.layers and keras.operations)

The only workaround I find so far is to install using pip install tensorflow>=2.0,<2.16.

yzhao062 commented 2 months ago

right -- due to the complexity and higher overhead to support both tf and torch in PyOD -- we are dropping tf and replacing everything by torch. right now, maybe it is easier to stick with tf2.6