Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

Open
AbdulmohsenA opened this issue Mar 22, 2024 · 2 comments

Comments

@AbdulmohsenA
Copy link

!pip install top2vec[sentence_encoders]
!pip install tensorflow-probability

from top2vec import Top2Vec
import pandas as pd
import numpy as np

df = pd.read_csv("/content/drive/My Drive/_csvfile")
documents = df['summary'].to_list()
model = Top2Vec(documents)

i get the error:
AttributeError: module keras._tf_keras.keras has no attribute __internal__

Google Colab shows the error is in the from top2vec import Top2Vec line

@IsrarAwan
Copy link

IsrarAwan commented Mar 23, 2024

Install the packages in the following order:

!pip install -q tensorflow==2.15.1
!pip install -q tensorflow_hub==0.12.0
!pip install -q tensorflow_text==2.15.0
!pip install -q top2vec[sentence_transformers]

Keras 3 is incompatible with tensorflow-probability, which is why it's not working. Using the aforementioned versions, top2vec will work and you will not get the AttributeError.

PS. Make sure to delete runtime of Colab before running the cell containing the dependencies above.

@DLesmes
Copy link

DLesmes commented Nov 6, 2024

Install the packages in the following order:

!pip install -q tensorflow==2.15.1
!pip install -q tensorflow_hub==0.12.0
!pip install -q tensorflow_text==2.15.0
!pip install -q top2vec[sentence_transformers]

Keras 3 is incompatible with tensorflow-probability, which is why it's not working. Using the aforementioned versions, top2vec will work and you will not get the AttributeError.

PS. Make sure to delete runtime of Colab before running the cell containing the dependencies above.

✅ this works for my use case despite of this error pip message! 🐛

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow-text 2.15.0 requires tensorflow-hub>=0.13.0, but you have tensorflow-hub 0.12.0 which is incompatible.

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

No branches or pull requests

3 participants