Closed clebemachado closed 3 months ago
@clebemachado, Could you please confirm whether you are trying to execute the code with the keras3.0 or tf-keras. Also I tried to execute the mentioned code and it was executed with a different error. Kindly find the gist of it here. Thank you!
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.
This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.
same problem:
load_model("/home/****/notebooks/model_from_points_2D/custom_model.keras")
Result in:
miniconda3/envs/yolo_env/lib/python3.10/site-packages/keras/src/saving/saving_api.py", line 193, in load_model
raise ValueError(
ValueError: File not found: filepath=/home/****/notebooks/model_from_points_2D/custom_model.keras. Please ensure the file is an accessible `.keras` zip file.
It was the keras version, I changed it to 3 and it worked.
Hi, I am having the same issue. I got a model saved to "myfile.keras" by the ModelCheckpoint callback using TF 2.16.1 and Keras 3.3.3 in Python 3.10.12. When trying to reload the model with
import keras
model=keras.saving.load_model("myfile.keras")
I also get the "File not found: ... Please ensure the file is an accessible .keras zip file." error message from the initial posting by clebemachado. The file is definitely there and looks integer as far as I can say. At the beginning it has a "keras_version" : "3.3.3" entry. Looking at the code around line 187 of saving_api.py (which is referenced in the error output), I could imagine that the problem is that the file is not in keras .zip format, but has a ".keras" file ending. However, assuming this is the case, how would I make ModelCheckpoint saving the model in .zip format then? And would there still be a way to access my already trained and saved model?
Note that the same code for saving and reloading the model worked absolutely fine on another machine with TF V2.15 and Keras V2.15 (yes, the reported versions are identical).
I am a bit desperate at the moment, as my already trained model seems lost and I also don´t know what to change for a re-run. Any help is very appreciated!
@clebemachado: Could you maybe explain what exactly you did here:
It was the keras version, I changed it to 3 and it worked.
Hi guys, how are you? I'm trying to load my trained model but I'm getting the following error:File not found: filepath=modelo\model_74.keras. Please ensure the file is an accessible
.keras
zip file.Keras Version: 3.0.5 Tensorflow Version: 2.16.1
Code I'm using to load the model
I tried other PATHS: path_model = './modelo/model_74.keras' or path_model = 'modelo//model_74.keras' or path_model = './/modelo//model_74.keras' or path_model = '//modelo//model_74.keras'