Closed thiagoburgo closed 7 years ago
When I want to modify the model, I encounter the same error. I use Windows 7 + Anaconda 3 and updated version of Keras, Theano, and keras-vis. @thiagoburgo Did you find any solution?
Same here :(
fixed
File "C:\Users\Francisco\Anaconda3\lib\site-packages\vis\utils\utils.py", line 123, in apply_modifications model.save(model_path) File "C:\Users\Francisco\Anaconda3\lib\site-packages\keras\engine\topology.py", line 2553, in save save_model(self, filepath, overwrite, include_optimizer) File "C:\Users\Francisco\Anaconda3\lib\site-packages\keras\models.py", line 102, in save_model with h5py.File(filepath, mode='w') as f: File "C:\Users\Francisco\Anaconda3\lib\site-packages\h5py_hl\files.py", line 271, in init fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr) File "C:\Users\Francisco\Anaconda3\lib\site-packages\h5py_hl\files.py", line 107, in make_fid fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl) File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (C:\Minonda\conda-bld\h5py_1490029446037\work\h5py_objects.c:2867) File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (C:\Minonda\conda-bld\h5py_1490029446037\work\h5py_objects.c:2825) File "h5py\h5f.pyx", line 98, in h5py.h5f.create (C:\Minonda\conda-bld\h5py_1490029446037\work\h5py\h5f.c:2307) OSError: Unable to create file (Unable to open file: name = '/tmp/rkp3rbmq.h5', errno = 2, error message = 'no such file or directory', flags = 13, o_flags = 302)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Francisco/Pruebas/codigos_test/keras_img.py", line 17, in
The same thing applies here:
Model loaded.
Traceback (most recent call last):
File "<ipython-input-2-c0509c104381>", line 1, in <module>
debugfile('C:/Users/engadmin/.spyder-py3/visualize_framework.py', wdir='C:/Users/engadmin/.spyder-py3')
File "c:\users\engadmin\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 733, in debugfile
debugger.run("runfile(%r, args=%r, wdir=%r)" % (filename, args, wdir))
File "C:\Users\engadmin\Anaconda3\lib\bdb.py", line 431, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "c:\users\engadmin\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
execfile(filename, namespace)
File "c:\users\engadmin\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "c:/users/engadmin/.spyder-py3/visualize_framework.py", line 47, in <module>
model = utils.apply_modifications(model)
File "c:\users\engadmin\anaconda3\lib\site-packages\vis\utils\utils.py", line 126, in apply_modifications
os.remove(model_path)
FileNotFoundError: [WinError 3] The system cannot find the path specified: '/tmp/ogx5lb2o.h5'
This is due to the line:
model_path = '/tmp/' + next(tempfile._get_candidate_names()) + '.h5'
in 'tensorflow_backend.py', as /tmp/ does not exist on Windows.
Easiest thing to do is create a 'tmp' folder in the current working directory and change '/tmp/' in the above line to './tmp/'
Also modify this line in File "lib\site-packages\vis\utils\utils.py", line 123
model_path = './tmp/' + next(tempfile._get_candidate_names()) + '.h5'
Rather than modifying the keras-vis
code itself, I simply added this line before applying any modifcations:
os.makedirs('/tmp/', exist_ok=True)
[x] Check that you are up-to-date with the master branch of keras-vis. You can update with: pip install git+git://github.com/raghakot/keras-vis.git --upgrade --no-deps
[x] If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
[-] If running on Theano, check that you are up-to-date with the master branch of Theano. You can update with: pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
[x] Provide a link to a GitHub Gist of a Python script that can reproduce your issue (or just copy the script here if it is short). https://github.com/thiagoburgo/keras-mnist-workshop/blob/master/keras-CNN-mnist-2.0.py#L113 https://github.com/thiagoburgo/keras-mnist-workshop/blob/master/keras_mnist_vis.py#L18
OS: Windows 10 + Anaconda3