AttributeError: module 'tensorflow.keras' has no attribute 'utils_dataset_from_directory'

I am running tensorflow-macos and tensorflow-metal on Big Sur.

I am getting this error: AttributeError: module 'tensorflow.keras' has no attribute 'utils_dataset_from_directory'

https://github.com/keras-team/keras-io/issues/12

Can I install tf_nightly? Or does it conflict with tensorflow-macos?

from tensorflow import keras
from tensorflow.python.framework.ops import disable_eager_execution
dataset = keras.utils_dataset_from_directory(
    "celeba_gan",
    label_mode=None,
    image_size=(64, 64),
    batch_size=32,
    smart_resize=True)

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/var/folders/3n/56fpv14n4wj0c1l1sb106pzw0000gn/T/ipykernel_41859/2519466253.py in <module>
      1 from tensorflow import keras
      2 from tensorflow.python.framework.ops import disable_eager_execution
----> 3 dataset = keras.utils_dataset_from_directory(
      4     "celeba_gan",
      5     label_mode=None,

AttributeError: module 'tensorflow.keras' has no attribute 'utils_dataset_from_directory'


You are correct, tf_nightly (this is TF master, => v2.7) will conflict with tensorflow-macos (this is based on v2.5). There are also major changes in keras with latest release which is part of core TF: https://github.com/tensorflow/tensorflow/releases/tag/v2.6.0-rc1

I tried running with tf-nightly and ran into similar issue.

AttributeError: module 'tensorflow.keras' has no attribute 'utils_dataset_from_directory'
 
 
Q