UserWarning: No training configuration found in save file: the model was *not* compiled. Compile it manually












1















After a training procedure, I wanted to check the accuracy by loading the created model.h5 and executing an evaluation procedure. However, I am getting a following warning:




/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py:269:
UserWarning: No training configuration found in save file: the model
was not compiled. Compile it manually. warnings.warn('No training
configuration found in save file:




enter image description here



This dist-packages/keras/engine/saving.py file



so the problem in loading created model -> this line of code



train_model = load_model('model.h5')


Problem indicates that the model was not compiled, however, I did it.



optimizer = Adam(lr=lr, clipnorm=0.001)
train_model.compile(loss=dummy_loss, optimizer=optimizer)


I can't understand what I am doing wrong . . .
Please help me! SOS :-(










share|improve this question

























  • The warning doesn't prevent you from evaluating the model.

    – Matias Valdenegro
    Nov 14 '18 at 9:05











  • I have the same problem (used model.save(..., include_optimizer=True)) (tensorflow's keras implementation)

    – olejorgenb
    Jan 14 at 11:04


















1















After a training procedure, I wanted to check the accuracy by loading the created model.h5 and executing an evaluation procedure. However, I am getting a following warning:




/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py:269:
UserWarning: No training configuration found in save file: the model
was not compiled. Compile it manually. warnings.warn('No training
configuration found in save file:




enter image description here



This dist-packages/keras/engine/saving.py file



so the problem in loading created model -> this line of code



train_model = load_model('model.h5')


Problem indicates that the model was not compiled, however, I did it.



optimizer = Adam(lr=lr, clipnorm=0.001)
train_model.compile(loss=dummy_loss, optimizer=optimizer)


I can't understand what I am doing wrong . . .
Please help me! SOS :-(










share|improve this question

























  • The warning doesn't prevent you from evaluating the model.

    – Matias Valdenegro
    Nov 14 '18 at 9:05











  • I have the same problem (used model.save(..., include_optimizer=True)) (tensorflow's keras implementation)

    – olejorgenb
    Jan 14 at 11:04
















1












1








1








After a training procedure, I wanted to check the accuracy by loading the created model.h5 and executing an evaluation procedure. However, I am getting a following warning:




/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py:269:
UserWarning: No training configuration found in save file: the model
was not compiled. Compile it manually. warnings.warn('No training
configuration found in save file:




enter image description here



This dist-packages/keras/engine/saving.py file



so the problem in loading created model -> this line of code



train_model = load_model('model.h5')


Problem indicates that the model was not compiled, however, I did it.



optimizer = Adam(lr=lr, clipnorm=0.001)
train_model.compile(loss=dummy_loss, optimizer=optimizer)


I can't understand what I am doing wrong . . .
Please help me! SOS :-(










share|improve this question
















After a training procedure, I wanted to check the accuracy by loading the created model.h5 and executing an evaluation procedure. However, I am getting a following warning:




/usr/local/lib/python3.5/dist-packages/keras/engine/saving.py:269:
UserWarning: No training configuration found in save file: the model
was not compiled. Compile it manually. warnings.warn('No training
configuration found in save file:




enter image description here



This dist-packages/keras/engine/saving.py file



so the problem in loading created model -> this line of code



train_model = load_model('model.h5')


Problem indicates that the model was not compiled, however, I did it.



optimizer = Adam(lr=lr, clipnorm=0.001)
train_model.compile(loss=dummy_loss, optimizer=optimizer)


I can't understand what I am doing wrong . . .
Please help me! SOS :-(







python tensorflow keras






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 8:17









Aqueous Carlos

352314




352314










asked Nov 14 '18 at 8:09









Aziz SiyaevAziz Siyaev

162




162













  • The warning doesn't prevent you from evaluating the model.

    – Matias Valdenegro
    Nov 14 '18 at 9:05











  • I have the same problem (used model.save(..., include_optimizer=True)) (tensorflow's keras implementation)

    – olejorgenb
    Jan 14 at 11:04





















  • The warning doesn't prevent you from evaluating the model.

    – Matias Valdenegro
    Nov 14 '18 at 9:05











  • I have the same problem (used model.save(..., include_optimizer=True)) (tensorflow's keras implementation)

    – olejorgenb
    Jan 14 at 11:04



















The warning doesn't prevent you from evaluating the model.

– Matias Valdenegro
Nov 14 '18 at 9:05





The warning doesn't prevent you from evaluating the model.

– Matias Valdenegro
Nov 14 '18 at 9:05













I have the same problem (used model.save(..., include_optimizer=True)) (tensorflow's keras implementation)

– olejorgenb
Jan 14 at 11:04







I have the same problem (used model.save(..., include_optimizer=True)) (tensorflow's keras implementation)

– olejorgenb
Jan 14 at 11:04














1 Answer
1






active

oldest

votes


















0














Do you get this warning when saving the model?



WARNING:tensorflow:TensorFlow optimizers do not make it possible to access 
optimizer attributes or optimizer state after instantiation. As a result, we
cannot save the optimizer as part of the model save file.You will have to
compile your model again after loading it. Prefer using a Keras optimizer
instead (see keras.io/optimizers).


Seems tensorflow optimizers can't be preserved by keras :/






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295570%2fuserwarning-no-training-configuration-found-in-save-file-the-model-was-not-c%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Do you get this warning when saving the model?



    WARNING:tensorflow:TensorFlow optimizers do not make it possible to access 
    optimizer attributes or optimizer state after instantiation. As a result, we
    cannot save the optimizer as part of the model save file.You will have to
    compile your model again after loading it. Prefer using a Keras optimizer
    instead (see keras.io/optimizers).


    Seems tensorflow optimizers can't be preserved by keras :/






    share|improve this answer






























      0














      Do you get this warning when saving the model?



      WARNING:tensorflow:TensorFlow optimizers do not make it possible to access 
      optimizer attributes or optimizer state after instantiation. As a result, we
      cannot save the optimizer as part of the model save file.You will have to
      compile your model again after loading it. Prefer using a Keras optimizer
      instead (see keras.io/optimizers).


      Seems tensorflow optimizers can't be preserved by keras :/






      share|improve this answer




























        0












        0








        0







        Do you get this warning when saving the model?



        WARNING:tensorflow:TensorFlow optimizers do not make it possible to access 
        optimizer attributes or optimizer state after instantiation. As a result, we
        cannot save the optimizer as part of the model save file.You will have to
        compile your model again after loading it. Prefer using a Keras optimizer
        instead (see keras.io/optimizers).


        Seems tensorflow optimizers can't be preserved by keras :/






        share|improve this answer















        Do you get this warning when saving the model?



        WARNING:tensorflow:TensorFlow optimizers do not make it possible to access 
        optimizer attributes or optimizer state after instantiation. As a result, we
        cannot save the optimizer as part of the model save file.You will have to
        compile your model again after loading it. Prefer using a Keras optimizer
        instead (see keras.io/optimizers).


        Seems tensorflow optimizers can't be preserved by keras :/







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 14 at 12:08

























        answered Jan 14 at 11:21









        olejorgenbolejorgenb

        539613




        539613






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53295570%2fuserwarning-no-training-configuration-found-in-save-file-the-model-was-not-c%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            List item for chat from Array inside array React Native

            Thiostrepton

            Caerphilly