ParikhKadam / bidaf-keras

Bidirectional Attention Flow for Machine Comprehension implemented in Keras 2
GNU General Public License v3.0
64 stars 21 forks source link

"OSError: Unable to open file" when running bidaf-keras predict from terminal #23

Open Zeesy opened 4 years ago

Zeesy commented 4 years ago

I'm getting error messages when I try to predict with using your bidaf-keras example method.

Ubuntu 18.4 python 3.6 tensorflow 1.13.1 bidaf-keras 1.1.0 Keras 2.2.4 h5py 2.10.0

This is a pretty-much out-of-the-box install of bidaf-keras. I manually put bidaf_10.h5 and bidaf_50.h5 inside a manually created bidaf-keras/bidaf/saved_items directory.

When I run python3 -m bidaf --model_name=bidaf_50.h5 --do_lowercase predict --passage "This is tree." --question "What is this?" --return_char_loc --return_confidence_score

I get the expected results.

When I run bidaf-keras --model_name=bidaf_50.h5 --do_lowercase predict --passage "This is tree." --question "What is this?" --return_char_loc --return_confidence_score

The program makes it to "Predict", but then I get this error message: OSError: Unable to open file (unable to open file: name = '/home/parallels/anaconda3/envs/myproject/lib/python3.6/site-packages/bidaf/saved_items/bidaf_50.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

Any advice on why/how this is happening would be much appreciated.

Thanks for your cool project!

ParikhKadam commented 4 years ago

I might be late. But as you can see, you have place the downloaded model in the wrong folder. It must be site-packages/bidaf/saved_items/bidaf_50.h5 (if installed via pip) and you have saved it in site-packages/bidaf-keras/bidaf/saved_items.

Also, sorry as I am not maintaining this project as of now. Out of time and resources. Though the code is available freely and is easy to understand, it will help people a lot.