7

我已经使用 pip install 构建了 tensorflow v0.8.0,但是当我尝试任何 skflow 示例时,它们都失败了,因为

AttributeError: 'module' object has no attribute 'datasets'

这是由于这个

from tensorflow.contrib import learn

### Training data

# Downloads, unpacks and reads DBpedia dataset.
dbpedia = learn.datasets.load_dataset('dbpedia')
4

3 回答 3

5

有几个人遇到过这种情况。请安装最新版本,例如最近的夜间版本之一。

从命令行运行它

pip3 install --upgrade http://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_CONTAINER_TYPE=CPU,TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON3,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.8.0-cp34-cp34m-linux_x86_64.whl
于 2016-05-18T02:15:48.687 回答
3

我发现解决此问题的一种不那么烦人的方法是手动下载和加载数据。这很容易,这就是我的做法。

from tensorflow.contrib import learn

# Downloads, unpacks and reads DBpedia dataset.
## dbpedia = learn.datasets.load_dataset('dbpedia')
## BUT THAT ABOVE FUNCTION DOESN'T WORK SO....

## MANUALLY DOWNLOAD THE DATA FROM THIS LINK:  
##     https://googledrive.com/host/0Bz8a_Dbh9Qhbfll6bVpmNUtUcFdjYmF2SEpmZUZUcVNiMUw1TWN6RDV3a0JHT3kxLVhVR2M/dbpedia_csv.tar.gz


## MANUALLY UNPACK THE DATA BY DOUBLE CLICKING IT
##     make sure the paths are correct


## LOAD IT LIKE YOU WOULD A REGULAR CSV FILE.
train = pandas.read_csv('dbpedia_csv/train.csv', header=None)
X_train, y_train = train[2], train[0]
test = pandas.read_csv('dbpedia_csv/test.csv', header=None)
X_test, y_test = test[2], test[0]
于 2016-05-22T20:38:59.580 回答
0

嗨,我似乎有同样的问题,并将其追踪到 ~/skflow/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/datasets init .py 还没有 dbpedia 作为数据集它的github版本有它。我正在使用 0.8.0 版的张量流

于 2016-05-13T17:01:05.053 回答