word-rnn-tensorflow icon indicating copy to clipboard operation
word-rnn-tensorflow copied to clipboard

Error when trying to train.

Open probablyrei opened this issue 7 years ago • 5 comments

When I open train.py I get a traceback error that says:

Traceback (most recent call last): File "C:\Users\User\Desktop\word-rnn-tensorflow-master\train.py", line 134, in main() File "C:\Users\User\Desktop\word-rnn-tensorflow-master\train.py", line 54, in main train(args) File "C:\Users\User\Desktop\word-rnn-tensorflow-master\train.py", line 57, in train data_loader = TextLoader(args.data_dir, args.batch_size, args.seq_length, args.input_encoding) File "C:\Users\User\Desktop\word-rnn-tensorflow-master\utils.py", line 23, in init self.preprocess(input_file, vocab_file, tensor_file, encoding) File "C:\Users\User\Desktop\word-rnn-tensorflow-master\utils.py", line 65, in preprocess with codecs.open(input_file, "r", encoding=encoding) as f: File "C:\Users\User\AppData\Local\Programs\Python\Python35\lib\codecs.py", line 895, in open file = builtins.open(filename, mode, buffering) FileNotFoundError: [Errno 2] No such file or directory: 'data/tinyshakespeare\input.txt'

I don't know why it says "No such file or directory: 'data/tinyshakespeare\input.txt'" because it is definitely there..help?

probablyrei avatar Jul 23 '18 03:07 probablyrei

I received this error at first as well. I had to ensure that I was in the same directory as the 'data' folder.

Enviy avatar Oct 02 '18 17:10 Enviy

I received this error at first as well. I had to ensure that I was in the same directory as the 'data' folder.

Can you please elaborate on what you mean by that?

probablyrei avatar Oct 20 '18 03:10 probablyrei

Looks like filesystem directory structure naming issue. Forward and backward slashes.

"data/tinyshakespeare\input.txt"

On Sat., 20 Oct. 2018, 13:22 probablyrei, [email protected] wrote:

I received this error at first as well. I had to ensure that I was in the same directory as the 'data' folder.

Can you please elaborate on what you mean by that?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hunkim/word-rnn-tensorflow/issues/81#issuecomment-431544440, or mute the thread https://github.com/notifications/unsubscribe-auth/AF86NHgyiOvUd_sh9RGH987Bmvwx5D_Aks5umpbqgaJpZM4VaTow .

normanheckscher avatar Oct 20 '18 03:10 normanheckscher

That's a good point about the backslash. At first I thought it was escaping a space character but there shouldn't be a space there so it's odd.

So earlier I mentioned ensuring you were in the 'data' directory. What I meant is that when I encountered a similar issue, it worked when I navigated to the project directory which had the 'data' directory in it. The script has default args which look for the input file in that directory.

Enviy avatar Oct 20 '18 03:10 Enviy

The problem is the formation of the default value for --data_dir https://github.com/hunkim/word-rnn-tensorflow/blob/master/train.py#L15

You can change this line locally to default=os.join('data','tinyshakespeare') or pass thus parameter when you can it python train --data_dir data\\tinyshakespeare

micooke avatar Apr 02 '19 08:04 micooke