'模块'对象没有属性'feature_column' [英] 'module' object has no attribute 'feature_column'

查看:596
本文介绍了'模块'对象没有属性'feature_column'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行了Google的官方教程(链接这里)。它在本地运行良好,但我陷入了需要在Google Cloud Platform上训练网络的部分。我在终端上运行了以下代码:

  JOB_NAME = census_single_1 
OUTPUT_PATH = gs:// $ BUCKET_NAME / $ JOB_NAME
gcloud ml-engine作业提交培训$ JOB_NAME \
--job-dir $ OUTPUT_PATH \
--runtime-version 1.0 \
--module-name trainer.task \
- 软件包路径培训师/ \
--region $ REGION \
- \
--train-files $ TRAIN_DATA \
--eval-files $ EVAL_DATA \
--train-steps 1000 \
--verbosity DEBUG

我收到以下错误消息:

lockquote
Traceback(最近一次调用最后一次) :\\\
文件
\/usr/lib/python2.7/runpy.py\,第162行,位于_run_module_as_main\\\


\ main \,fname,loader,pkg_name)\\\
文件
\/usr/lib/python2.7/runpy.py\,第72行,位于_run_code\\\
exec代码
在run_globals\\\
文件
\/root/.lo cal / lib / python2.7 / site-packages / trainer / task.py \,第4行,
在\\\
导入模型中\ $ File
\/root/.local /lib/python2.7/site-packages/trainer/model.py\,行
40,位于\ n

tf.feature_column.categorical_column_with_vocabulary_list(\\\
AttributeError:
'module'object has no attribute'feature_column'\\\


// UPDATE



没关系。我想到了。事实证明, - runtime-version 参数控制着Cloud ML运行时版本( link )。在本教程中,它被指定为1.0,并且对应于Tensorflow v 1.0.1,它没有 tf.feature_column。* ,因为它只是在Tensorflow v 1.2中引入的.0在2017年6月16日



// 更新2



Google教程已被更新为使用 - 运行时版本1.2 而不是 - 运行时版本1.0 截至今天, 2017年6月29日。我不知道他们是否看到我的帖子,但在6月28日和6月29日之间发生了变化。该教程的未来用户不应该遇到我遇到的同样问题。

解决方案

这也可能发生于更新Google Cloud SDK,在这种情况下 pip install --upgrade tensorflow 应该完成这项工作。


I ran the official tutorial from Google (link here). It ran fine locally but I got stuck on the part where I need to train the network on the Google Cloud Platform. I ran the following code on my terminal:

JOB_NAME=census_single_1
OUTPUT_PATH=gs://$BUCKET_NAME/$JOB_NAME
gcloud ml-engine jobs submit training $JOB_NAME \
--job-dir $OUTPUT_PATH \
--runtime-version 1.0 \
--module-name trainer.task \
--package-path trainer/ \
--region $REGION \
-- \
--train-files $TRAIN_DATA \
--eval-files $EVAL_DATA \
--train-steps 1000 \
--verbosity DEBUG

And I got the following error message:

"Traceback (most recent call last):\n File \"/usr/lib/python2.7/runpy.py\", line 162, in _run_module_as_main\n
\"main\", fname, loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/root/.local/lib/python2.7/site-packages/trainer/task.py\", line 4, in \n import model\n File \"/root/.local/lib/python2.7/site-packages/trainer/model.py\", line 40, in \n
tf.feature_column.categorical_column_with_vocabulary_list(\nAttributeError: 'module' object has no attribute 'feature_column'\n"

// UPDATE

Never mind. I figured it out. It turns out the --runtime-version argument controls the Cloud ML Runtime Version (link). In the tutorial it was specified as 1.0, and that corresponds to Tensorflow v 1.0.1, which does not have tf.feature_column.* because it was just introduced in Tensorflow v 1.2.0 on June 16, 2017

// UPDATE 2

The Google tutorial has been updated to use --runtime-version 1.2 instead of --runtime-version 1.0 as of today, Jun 29, 2017. I don't know if they saw my post but this was changed between Jun 28 and Jun 29. Future users on that tutorial shouldn't experience the same issue I had.

解决方案

This could also happen from updating Google Cloud SDK, in which case pip install --upgrade tensorflow should do the job.

这篇关于'模块'对象没有属性'feature_column'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆