Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: Unable to open file (unable to open file: name = 'eth_model_randseed_775.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0) #2

Open
gopinathankm opened this issue Dec 3, 2017 · 2 comments

Comments

@gopinathankm
Copy link

I tried play with notebook from Github. Why I am getting following error when I run following cell:

`# assuming the previous cell was completed, this cell loads in the different initializations
# and calculates the average mean absolute error (mae)
from keras.models import load_model
eth_preds = []
bt_preds = []
for rand_seed in range(775,800):
temp_model = load_model('eth_model_randseed
%d.h5'%rand_seed)
eth_preds.append(np.mean(abs(np.transpose(temp_model.predict(LSTM_test_inputs))-
(test_set['eth_Close'].values[window_len:]/test_set['eth_Close'].values[:-window_len]-1))))
temp_model = load_model('bt_model_randseed_%d.h5'%rand_seed)
bt_preds.append(np.mean(abs(np.transpose(temp_model.predict(LSTM_test_inputs))-
(test_set['bt_Close'].values[window_len:]/test_set['bt_Close'].values[:-window_len]-1))))_
Error

OSError Traceback (most recent call last)
in ()
7 bt_preds = []
8 for rand_seed in range(775,800):
----> 9 temp_model = load_model('eth_model_randseed_%d.h5'%rand_seed)
10 eth_preds.append(np.mean(abs(np.transpose(temp_model.predict(LSTM_test_inputs))-
11 (test_set['eth_Close'].values[window_len:]/test_set['eth_Close'].values[:-window_len]-1))))
~/anaconda3/lib/python3.6/site-packages/keras/models.py in load_model(filepath, custom_objects, compile)
231 return custom_objects[obj]
232 return obj
--> 233 with h5py.File(filepath, mode='r') as f:
234 # instantiate model
235 model_config = f.attrs.get('model_config')
~/anaconda3/lib/python3.6/site-packages/h5py/_hl/files.py in init(self, name, mode, driver, libver, userblock_size, swmr, **kwds)
267 with phil:
268 fapl = make_fapl(driver, libver, **kwds)
--> 269 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
270
271 if swmr_support:
~/anaconda3/lib/python3.6/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
97 if swmr and swmr_support:
98 flags |= h5f.ACC_SWMR_READ
---> 99 fid = h5f.open(name, flags, fapl=fapl)
100 elif mode == 'r+':
101 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/h5f.pyx in h5py.h5f.open()
OSError: Unable to open file (unable to open file: name = 'eth_model_randseed_775.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

@dashee87
Copy link
Owner

Hey,

The clue is in the comment at the start of the code, this cell will return errors if the previous cell (no. 35) is not run first. It takes some time to run, so that's why I commented it out. You'll need to uncomment it and write those files to your local directory. Then you should be able to open the files.

@gopinathankm
Copy link
Author

Hi David Sheehan
Many many thank for your assistance, you can close this issue.

With regards
Gopinathan K.M

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants