Keras does not save weights

26 views
Skip to first unread message

giuseppe...@gmail.com

unread,
May 8, 2024, 4:08:25 PMMay 8
to Keras-users
I am using Tensorflow 2.15.1 and, if I use model.save_weights("./dir") and subsequently try to load the weights with model.load_weights("./dir"), the model does not return the expected results (using model.evaluate).  My model has a custom loss function and metric, but this should not be a problem, since I save the weights only. Any idea why I get this error?

Lance Norskog

unread,
May 11, 2024, 8:40:05 PMMay 11
to giuseppe...@gmail.com, Keras-users
Does the input or output of the model involve data stored in a dictionary? It is a well-known mistake to enumerate a dictionary, use the indexes as inputs to the model, then have Python enumerate the dictionary in a different order the next time.

On Wed, May 8, 2024 at 1:08 PM giuseppe...@gmail.com <giuseppe...@gmail.com> wrote:
I am using Tensorflow 2.15.1 and, if I use model.save_weights("./dir") and subsequently try to load the weights with model.load_weights("./dir"), the model does not return the expected results (using model.evaluate).  My model has a custom loss function and metric, but this should not be a problem, since I save the weights only. Any idea why I get this error?

--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keras-users/e03da548-ba38-4392-a646-d04071e72359n%40googlegroups.com.


--
Lance Norskog
lance....@gmail.com
Redwood City, CA
Reply all
Reply to author
Forward
0 new messages