Code Monkey home page Code Monkey logo

Comments (16)

fchollet avatar fchollet commented on July 19, 2024 16

Use the nightly build:

pip install tf-nightly

from keras-io.

jyan83 avatar jyan83 commented on July 19, 2024 4

Following the problem. I also installed tf-nightly, but still showing

AttributeError: module 'tensorflow_core.keras.preprocessing' has no attribute 'timeseries_dataset_from_array'

from keras-io.

viswanath27 avatar viswanath27 commented on July 19, 2024 2

Hi Team,
I am also having same issue, while running the example in tensorflow tutorials "Basic text classification" under "ML basics with Keras".

Traceback (most recent call last):
File "main.py", line 77, in
text_classification()
File "main.py", line 71, in text_classification
load_dataset(train_dir)
File "main.py", line 29, in load_dataset
raw_train_ds = tf.keras.preprocessing.text_dataset_from_directory(
AttributeError: module 'tensorflow.keras.preprocessing' has no attribute 'text_dataset_from_directory'

tensorflow version = 2.2.0
Python version = 3.6.9

I tried installing tf-nightly also. But it did not solve the issue.
Any more pointers to fix this issue.

from keras-io.

guayabas avatar guayabas commented on July 19, 2024 2

try tensorflow 2.3.0, that one contains text_dataset_from_directory ... at least on Windows
image

from keras-io.

LabyrinthineLeo avatar LabyrinthineLeo commented on July 19, 2024 1

I have solved this problem by pip install tf-nightly. If you did it but it ditn't take effect, you should restart your IDE or Jupyter notebook. I hope this comment is helpful for you!

from keras-io.

ankahira avatar ankahira commented on July 19, 2024

If you facing this problem now, upgrade to tensorflow 2.3.x. Also note that tf-nightly breaks your horovod.

from keras-io.

GF-Huang avatar GF-Huang commented on July 19, 2024

Same issue, tf-2.3.1

from keras-io.

Yami-Bitshark avatar Yami-Bitshark commented on July 19, 2024

FOR PEOPLE USING DOCKER TF FOR WSL2 and dont want to update their image:

  1. Go to https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/keras/preprocessing
  2. Download datasets_utils.py and text_dataset.py
  3. make them as a module and call them within your project.

Note: text_datasets.py calls functions from datasets_utils.py. So you have to update the text_datasets.py file (Line 23) and make it import the datasets_utils.py properly.

from keras-io.

Lawrence-Krukrubo avatar Lawrence-Krukrubo commented on July 19, 2024

Use the nightly build:

pip install tf-nightly

After installing the nightly build in Kaggle, it still fails with no module found! Yet it works out of the box in Colab, why do we have all these inconsistencies? And how exactly can I use the image-dataset-from-directory function in Kaggle?

Has anyone successfully tried this in Kaggle?

Please I need to know urgently.

from keras-io.

remahini avatar remahini commented on July 19, 2024

Use the nightly build:

pip install tf-nightly

Thanks, but this didn't work for me.
I solved the problem with upgrading the TensorFlow, you may go with:
pip install --upgrade tensorflow

from keras-io.

sudobum avatar sudobum commented on July 19, 2024

pip install tf-nightly

RESTART
worked for me.

from keras-io.

Dinesh-Mali avatar Dinesh-Mali commented on July 19, 2024

I have created environment via "conda create workspace"

There I installed all necessary packages via conda, where tensorflow2.0.0 installed.

while importing

from Tensorflow.keras.layers import TextVectorization giving me import error that can not import TextVectorization and I'm getting the following error:
AttributeError: module 'tensorflow.keras.preprocessing' has no attribute 'image_dataset_from_directory'

when trying to solve: https://github.com/keras-team/keras-io/blob/master/examples/vision/image_classification_from_scratch.py

my TensorFlow version: 2.0.0
python version: 3.7.12

I tried pip3 install tf-nightly: got error zsh: illegal hardware instruction and module "tensorflow not found".

please help.

from keras-io.

hackaprende avatar hackaprende commented on July 19, 2024

Try with
keras.preprocessing.image_dataset.image_dataset_from_directory(

from keras-io.

prsatyal avatar prsatyal commented on July 19, 2024

Try using

tf.keras.applications.vgg16.preprocess_input(X, Dtype)
tf.keras.applications.resnet50.preprocess_input(x, data_format=None)

from keras-io.

benbezzina4 avatar benbezzina4 commented on July 19, 2024

make sure you are importing keras from tensorflow

import tensorflow as tf
from tensorflow import keras

from keras-io.

UDshadow avatar UDshadow commented on July 19, 2024

make sure you are importing keras from tensorflow

import tensorflow as tf from tensorflow import keras

This answer works for me.
my version is:
tf.version = '2.12.0'
keras.version = '2.12.0'

from keras-io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.