[Python] How to load TensorFlow a model into 2.19.0 if the model was saved in 2.4.1

Discussão em 'Python' iniciado por Stack, Abril 22, 2025.

  1. Stack

    Stack Membro Participativo

    I've been attempting to port over one of 2D Unet models that I trained on my school's cluster that supports 2.4.1 tensorflow over to my personal device which uses 2.19.0, and must use python 3.10 for support of langchain's agent orchestrator package.

    The method I have used to save the model is:

    model = tf.saved_model.load('./1ModelTrainingLooped/UnetSCCE/UnetModelSCCE7/')
    tf.saved_model.save(model, './modelArchive/UnetSCCEModel')


    but I have also tried using tf keras and keras stand alone.

    In VS code when attempting to load the model in 2.19.0 I get the following error:

    model = tf.saved_model.load('./modelArchive/UnetSCCE')
    line 529, in _load_nodes
    slot_variable = optimizer_object.add_slot(
    AttributeError: '_UserObject' object has no attribute 'add_slot'


    I understand there is support for loading the models across versions, but I'm not very experienced in preparing models for this scenario, and so I apologize if there's something fairly obvious that I'm missing.

    Continue reading...

Compartilhe esta Página