Skip to content

Keras 3.3.3 Unexpected error when loading the .h5 model #19967

Answered by abhaskumarsinha
jeffDebug asked this question in Q&A
Discussion options

You must be logged in to vote

Hello Jeff,

Ah, I understand your concerns. The choice of .h5 format for saving models is rather weird. Technically, .h5 format is supposed to ONLY save the model weights (which is likely some tensors, matrices, compressed using various techniques, sparsity, etc.). You can load an .h5 model ONLY if you have the architecture and the preset available! For example - The model architecture and exact presets define a number of layers and their specifications. If in that case, you have those specifications, then you need a function to define an empty model for you (Let's say - make_test_model()) to return the Keras Model with empty/random initialized weights and then load h5 over them.

In your …

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@jeffDebug
Comment options

@abhaskumarsinha
Comment options

@jeffDebug
Comment options

@abhaskumarsinha
Comment options

Answer selected by jeffDebug
@jeffDebug
Comment options

@abhaskumarsinha
Comment options

@jeffDebug
Comment options

@abhaskumarsinha
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants