张量流 - 递归神经网络

时间:2017-01-25 03:16:16

标签: tensorflow recurrent-neural-network

我从google获取了文件reader.py和ptb_word_lm.py,并尝试将其作为python ptb_word_lm.py --data_path=/tmp/simple-examples/data/ --model small运行。请帮我解决这些错误。

错误:

Traceback (most recent call last):
  File "ptb_word_lm.py", line 321, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 43, in run
    sys.exit(main(sys.argv[:1] + flags_passthrough))
  File "ptb_word_lm.py", line 268, in main
    raw_data = reader.ptb_raw_data(FLAGS.data_path)
  File "/home/ymakkapa/TensorFlow/reader.py", line 51, in ptb_raw_data
    word_to_id = _build_vocab(train_path)
  File "/home/ymakkapa/TensorFlow/reader.py", line 17, in _build_vocab
    data = _read_words(filename)
  File "/home/ymakkapa/TensorFlow/reader.py", line 13, in _read_words
    return f.read().decode("utf-8").replace("\n", "<eos>").split()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 106, in read
    self._preread_check()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/lib/io/file_io.py", line 73, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py", line 469, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.NotFoundError: /tmp/simple-examples/data/ptb.train.txt

2 个答案:

答案 0 :(得分:0)

首先,您必须使用python代码

下载并提取同一目录中的数据

$ wget http://www.fit.vutbr.cz/~imikolov/rnnlm/simple-examples.tgz

$ tar xvf simple-examples.tgz

然后,您必须指定要运行的代码的数据目录路径。 您可以阅读提供示例命令以运行程序的文档

$ python ptb_word_lm.py --data_path=simple-examples/data/

答案 1 :(得分:0)

使用完整路径应该可以解决您的问题。 使用

python models/tutorials/rnn/ptb/ptb_word_lm.py --data_path=simple-examples/data/ --model=small