首页 > 解决方案 > 无法在 google colab 中加载文件

问题描述

我正在尝试在 google colab 中加载经过训练的网络,但出现以下错误。

<ipython-input-6-9d26dabb123d> in <module>()
----> 1 l3structure1_decoder = load_model("/content/gdrive/My Drive/DATA/TRAINED NETWORKS/ALL_MODELS/decoder_finalp1_structure_l3_vels_max7_min0.h5")

4 frames
/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
   140         if swmr and swmr_support:
   141             flags |= h5f.ACC_SWMR_READ
--> 142         fid = h5f.open(name, flags, fapl=fapl)
   143     elif mode == 'r+':
   144         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 (file read failed: time = Mon Feb 24 08:58:41 2020
, filename = '/content/gdrive/My Drive/DATA/TRAINED NETWORKS/ALL_MODELS/decoder_finalp1_structure_l3_vels_max7_min0.h5', file descriptor = 62, errno = 5, error message = 'Input/output error', buf = 0x7ffdde98baf0, total read size = 8, bytes this sub-read = 8, bytes actually read = 18446744073709551615, offset = 0) ```

标签: machine-learningdeep-learninggoogle-colaboratory

解决方案


我也遇到了类似的问题。

只需 os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE" 在阅读文件之前做,它就像魔术一样工作。

取自https://groups.google.com/forum/#!topic/h5py/0kgiMVGSTBE


推荐阅读