Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

keras.models.load_model() fails to load model from .keras file

Hello so i am trying to load model from .keras zip file but it fails to do so. it gives me this error. how can i fix it?

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.

Even tho filepath exists it fails to load

like image 380
NikoMolecule Avatar asked Oct 19 '25 23:10

NikoMolecule


1 Answers

For some reason, using tensorflow==2.14 works just fine. Any models that have been trained and saved on any succeeding version should be loaded using 2.14

like image 71
Roupen Minassian Avatar answered Oct 22 '25 13:10

Roupen Minassian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!