OSError: Unable to open file (truncated file: eof = 1400832, sblock->base_addr = 0, stored_eof = 145

在运行tensorboard的时候出现这个问题,分析了一下是因为上一次下载的模型未成功,但是程序并没有将这个文件干掉,导致下一次运行的时候出错。

(1)我们查找一下模型下载的路径

[root@localhost ~]# find / -name "mobilenet_v2_weights_tf_dim_ordering_tf_kernels_1.0_224*"
/root/.keras/models/mobilenet_v2_weights_tf_dim_ordering_tf_kernels_1.0_224.h5

找打这个路径可以直接将这个文件删了

(2)如果有下载好的模型可以直接拷贝到上面的这个路径下,这样直接加载新模型,如果没有忽略这一步,,直接运行tensorflow程序即可。这里我是自己下好了模型进行覆盖。

[root@localhost FGSM]# python FGSM.py 
WARNING:tensorflow:From /opt/AI/AN/lib/python3.7/site-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
2019-12-13 13:06:39.022675: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2019-12-13 13:06:39.035967: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:983] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-12-13 13:06:39.036526: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: 
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.721
pciBusID: 0000:01:00.0
2019-12-13 13:06:39.036705: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2019-12-13 13:06:39.037478: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2019-12-13 13:06:39.038207: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0
2019-12-13 13:06:39.038358: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0
2019-12-13 13:06:39.039275: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0
2019-12-13 13:06:39.039981: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0
2019-12-13 13:06:39.042225: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2019-12-13 13:06:39.042298: I tensorflow/str

    有的时候,如果我们在程序里下载模型失败,一定要直接把之前未成功的模型干掉,不然程序还是对读取,但是程序里面调用的方法打不开该文件,就会出现上述错误。

你可能感兴趣的:(深度学习)