Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: The filepath provided must end in .keras (Keras model format). Received: filepath=Models/02_captcha_to_text/202403291006/model.h5 #48

Open
keosaly opened this issue Mar 29, 2024 · 3 comments

Comments

@keosaly
Copy link

keosaly commented Mar 29, 2024

Hello,
Can you help me to fix this?

ValueError: The filepath provided must end in .keras (Keras model format). Received: filepath=Models/02_captcha_to_text/202403291006/model.h5

@keosaly
Copy link
Author

keosaly commented Mar 29, 2024

my code:

Define callbacks

earlystopper = EarlyStopping(monitor="val_CER", patience=50, verbose=1, mode="min")
checkpoint = ModelCheckpoint(f"{configs.model_path}/model.h5", monitor="val_CER", verbose=1, save_best_only=True, mode="min")
trainLogger = TrainLogger(configs.model_path)
tb_callback = TensorBoard(f"{configs.model_path}/logs", update_freq=1)
reduceLROnPlat = ReduceLROnPlateau(monitor="val_CER", factor=0.9, min_delta=1e-10, patience=20, verbose=1, mode="min")
model2onnx = Model2onnx(f"{configs.model_path}/model.h5")

Train the model

model.fit(
train_data_provider,
validation_data=val_data_provider,
epochs=configs.train_epochs,
callbacks=[earlystopper, checkpoint, trainLogger, reduceLROnPlat, tb_callback, model2onnx],
workers=configs.train_workers
)

Save training and validation datasets as csv files

train_data_provider.to_csv(os.path.join(configs.model_path, "train.csv"))
val_data_provider.to_csv(os.path.join(configs.model_path, "val.csv"))

@mbahadirk
Copy link

did you find any solutions on that?
I'am still working on that

@pythonlessons
Copy link
Owner

It seems you try to use newest tensorflow version (different from tutorial). Recommend to downgrade tensorflow for compatibility. Otherwise you need to do changes manualy. For example change model.h5 to model.keras in all places. But you may face more serious incompatibilities further

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants