keras.models.load_model() 无法从 .keras 文件加载模型

问题描述 投票:0回答:1

您好,我正在尝试从 .keras zip 文件加载模型,但失败了。它给了我这个错误。我该如何修复它?

modelvggNew = keras.models.load_model('/kaggle/working/vgg15.keras')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[33], line 1
----> 1 keras.models.load_model('/kaggle/working/vgg15.keras')

File /usr/local/lib/python3.10/site-packages/keras/src/saving/saving_api.py:185, in load_model(filepath, custom_objects, compile, safe_mode)
    183     return legacy_h5_format.load_model_from_hdf5(filepath)
    184 elif str(filepath).endswith(".keras"):
--> 185     raise ValueError(
    186         f"File not found: filepath={filepath}. "
    187         "Please ensure the file is an accessible `.keras` "
    188         "zip file."
    189     )
    190 else:
    191     raise ValueError(
    192         f"File format not supported: filepath={filepath}. "
    193         "Keras 3 only supports V3 `.keras` files and "
   (...)
    202         "might have a different name)."
    203     )

ValueError: File not found: filepath=/kaggle/working/vgg15.keras. Please ensure the file is an accessible `.keras` zip file.

即使文件路径存在,也无法加载

python tensorflow keras
1个回答
0
投票

我也遇到了同样的问题,我在互联网上查找,但什么也没找到......你解决了这个问题吗?

© www.soinside.com 2019 - 2024. All rights reserved.