Saya bisa menggunakan ~
alih-alih /home/username/
menunjuk ke jalur file ketika, misalnya, membuka ritsleting .zip
file.
Namun, hari ini ketika saya mengikuti cara yang sama untuk menjalankan contoh RNN di terminal, tensorflow.python.framework.errors_impl.NotFoundError
terlempar.
$ python ptb_word_lm.py --data_path=~/anaconda2/lib/python2.7/site-packages/tensorflow/models-master/tutorials/rnn/simple-examples/data/ --model=small
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally
Traceback (most recent call last):
File "ptb_word_lm.py", line 374, in <module>
tf.app.run()
File "/home/hok/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "ptb_word_lm.py", line 321, in main
raw_data = reader.ptb_raw_data(FLAGS.data_path)
File "/home/hok/anaconda2/lib/python2.7/site-packages/tensorflow/models-master/tutorials/rnn/ptb/reader.py", line 73, in ptb_raw_data
word_to_id = _build_vocab(train_path)
File "/home/hok/anaconda2/lib/python2.7/site-packages/tensorflow/models-master/tutorials/rnn/ptb/reader.py", line 34, in _build_vocab
data = _read_words(filename)
File "/home/hok/anaconda2/lib/python2.7/site-packages/tensorflow/models-master/tutorials/rnn/ptb/reader.py", line 30, in _read_words
return f.read().decode("utf-8").replace("\n", "<eos>").split()
File "/home/hok/anaconda2/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 106, in read
self._preread_check()
File "/home/hok/anaconda2/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 73, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "/home/hok/anaconda2/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/home/hok/anaconda2/lib/python2.7/site-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: ~/anaconda2/lib/python2.7/site-packages/tensorflow/models-master/tutorials/rnn/simple-examples/data/ptb.train.txt
Lalu saya ganti ~
dengan /home/username/
, dan itu berfungsi dengan baik.
Mengapa saya tidak bisa menggunakan ~
alih-alih /home/username/
menunjuk ke jalur file ketika menjalankan contoh RNN?
Bisakah Anda memberi tahu saya secara detail?
~
sebelum argumen dilewatkan ke python? Sama seperti shell akan memperluas backslash lolos di jalan, atau menghapus tanda kutip jika jalan itu dikutip.
$VARIABLES
, ~
hanya diperluas pada awal string.
exec
'd) harus tersedia secara luas di alat UNIX .