pythonpython-3.xtf.kerastop2vec

AttributeError: module 'keras._tf_keras.keras' has no attribute '__internal__'


Trying to install top2vec on colab ,and install everything that other people mentioned, but still get this error, have no idea how to solve,anybody knows? really appreciate! error screenshot

!pip install top2vec
!pip install top2vec[sentence_transformers]
!pip install top2vec[sentence_encoders]

from top2vec import Top2Vec
import pandas as pd

============================================================ AttributeError: module 'keras._tf_keras.keras' has no attribute 'internal'


Solution

  • This is a known issue:

    The recent release of Keras 3 breaks TensorFlow Probability at import.

    installation of tensorflow v2.15.0, tensorflow-probability v0.23.0, and keras v3 causes a

    AttributeError: module 'keras._tf_keras.keras' has no attribute '__internal__'
    

    Please see these posts:

    https://github.com/tensorflow/probability/issues/1774#issuecomment-1979642276

    First install tensorflow-probability version 0.24.0 then install tensorflow-keras


    https://huggingface.co/google/gemma-7b-it/discussions/71