我安装了张量流,并成功通过MNIST演示。现在,我正在尝试运行seq2seq演示,但这对我不起作用。
我克隆了他们的github存储库的一个版本,并尝试从存储库根目录运行一些列出的命令。
$ bazel run -c opt ./tensorflow/models/rnn/translate/translate.py
ERROR: Bad target pattern './tensorflow/models/rnn/translate/translate.py': package names may contain only A-Z, a-z, 0-9, '/', '-' and '_'.
INFO: Elapsed time: 0.115s
ERROR: Build failed. Not running target.
在这里不足为奇,因为让bazel执行python脚本实际上没有任何意义。
在本教程的后面,
$ bazel run -c opt //tensorflow/models/rnn/translate:translate \
--data_dir ./data_dir --train_dir ./checkpoints_directory \
--en_vocab_size=40000 --fr_vocab_size=40000
Unrecognized option: --data_dir
如果我从上面的调用中删除了参数,它将在执行之前尝试(失败)构建整个张量流项目translate
。这不是我想要的,因为我已经使用pip成功安装了张量流。
我尝试运行的最后一件事,
$ python ./tensorflow/models/rnn/translate/translate.py
Traceback (most recent call last):
File "./tensorflow/models/rnn/translate/translate.py", line 28, in <module>
from tensorflow.models.rnn.translate import data_utils
ImportError: No module named translate
环境信息:OS X 10.11.1,Python 2.7.10(anaconda)
有两种方法可以运行脚本:
1)作为-bazel运行的一部分,用-分隔脚本参数
bazel run -c opt //tensorflow/models/rnn/translate:translate -- \
--data_dir ./data_dir --train_dir ./checkpoints_directory \
--en_vocab_size=40000 --fr_vocab_size=40000
2)构建,然后从运行./bazel-bin/
:
bazel build -c opt //tensorflow/models/rnn/translate:translate
./bazel-bin/tensorflow/models/rnn/translate/translate \
--data_dir ./data_dir --train_dir ./checkpoints_directory \
--en_vocab_size=40000 --fr_vocab_size=40000
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句