简体   繁体   English

教程 tf-nightly 不工作

[英]Tutorial tf-nightly not woring

I am pretty new to tensorflow and right now I'm following the tutorials on their website to learn more about it.我对 tensorflow 很陌生,现在我正在关注他们网站上的教程以了解更多信息。 While going through the text classification one, whenever I get to step that wants me to do:在进行文本分类一时,每当我想要我做的时候:

**batch_size = 32
seed = 42
raw_train_ds = tf.keras.preprocessing.text_dataset_from_directory(
    'aclImdb/train', 
    batch_size=batch_size, 
    validation_split=0.2, 
    subset='training', 
    seed=seed)**

I get an error saying AttributeError: module 'tensorflow.keras.preprocessing' has no attribute 'text_dataset_from_directory'.我收到一条错误消息,提示 AttributeError:模块 'tensorflow.keras.preprocessing' 没有属性 'text_dataset_from_directory'。 I looked online and it seems that the problem is that tf-nightly isn't installed.我在网上看了看,问题似乎是 tf-nightly 没有安装。 But I already installed tf-nightly on my anaconda prompt.但是我已经在我的 anaconda 提示符下安装了 tf-nightly。 Is there another issue I'm missing?我还有另一个问题吗?

Thank you谢谢

I suspect that the package named keras-preprocessing is missing in Anaconda in your Machine.我怀疑您的机器中的Anaconda中缺少名为keras-preprocessing的 package。

You could install it by running the below command in the cell of Jupyter Notebook ,您可以通过在Jupyter Notebook的单元格中运行以下命令来安装它,

!pip install keras_preprocessing

As I could successfully execute the code in my Jupyter Notebook , I will share the packages which I have, that may be useful to you in executing Tensorflow Code.由于我可以成功执行Jupyter Notebook中的代码,我将分享我拥有的包,这可能对您执行Tensorflow代码有用。

Please find the screenshots below:请在下面找到屏幕截图:

在此处输入图像描述

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM