SamLynnEvans / Transformer

Transformer seq2seq model, program that can build a language translator from parallel corpus
Apache License 2.0
1.35k stars 350 forks source link

error: file not found #9

Open Scum1254 opened 5 years ago

Scum1254 commented 5 years ago

how do i run this on my local pc? it always shows me that error: file not found. even the files are in that folder. i tried all slash versions [/, \, //, \, ]nothing worked to find that folder or .txt file

srajan-jha commented 5 years ago

Use pwd in linux or cd in windows to get current working directory and then try ls in Linux or dir in Windows to get the files and folders in that current working directory. (Upload the snap of the terminal so I can get more info about the same.)

its-Anshul commented 5 years ago

Screenshot (26)

srajan-jha commented 5 years ago

@its-Anshul what you've mentioned above seems to work just fine in my case. terminal

Do this! (trying ls)

terminal

PS you do't need to mention the whole path of the english.txt file, writing -src_data data/english.text would be enough if there exists the english.txt file.

its-Anshul commented 5 years ago

@srajan-jha Actually issue was with the data. While reading the file it encountered the error and as written in code in Process.py : try: opt.src_data = open(opt.src_data).read().strip().split('\n') except: print("error: '" + opt.src_data + "' file not found") quit()

it is printing file not found.

So fixed it by changing except as follows :

except Exception as e: print("error: '" + str(e)) quit()

And hence found the real error.

Thanks for helping

SCNUJackyChen commented 5 years ago

@its-Anshul Right. In my case, the real mistake is UnicodeDecodeError. I fixed it by adding encoding='utf-8': opt.src_data = open(opt.src_data,encoding='utf-8').read().strip().split('\n')