Hvass-Labs / TensorFlow-Tutorials

TensorFlow Tutorials with YouTube Videos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: module 'download' has no attribute 'maybe_download_and_extract'

PeanutMonkey opened this issue · comments

Hi Hvass-Labs, thank you for making these tutorials - they're a really fantastic online resource! I've run into an issue though - when I run the following code as instructed in the script cifar10.py:

maybe_download_and_extract()

I end up with the error:

AttributeError: module 'download' has no attribute 'maybe_download_and_extract'

Is there a way around this? I am currently using TensorFlow version 1.4.0 and have installed the module download with pip install.

Thanks for the nice words!

It sounds like you haven't downloaded the whole github repository. Please see the Download-section on the front page. download.py is a file in this repo, not something to be installed with pip.

I'm assuming this fixes the problem so I 'm closing the issue.

there can be a problem here. It seems that imdb is taking on a definition from one of the imported libraries, rather than using the code provided in the repository by the author. I was able to work around this by copying imdb.py to imdb2.py and then working with imdb2. You could also execute imdb = imdb2 and then all of the attributes of imdb would work after that. Here is a snippet of code that might help:

!cp imdb.py imdb2.py

import imdb2
Change this if you want the files saved in another directory.

[ ] # imdb.data_dir = "data/IMDB/"
Automatically download and extract the files.

[ ] imdb2.maybe_download_and_extract()

Load the training- and test-sets.

[ ] imdb = imdb2
x_train_text, y_train = imdb.load_data(train=True)
x_test_text, y_test = imdb.load_data(train=False)