Giter VIP home page Giter VIP logo

Comments (7)

SuryanarayanaY avatar SuryanarayanaY commented on May 2, 2024 1

Hi @Dobiasd ,

There is an open issue in Keras repo # 18913 where Keras Team looking into same and expect a fix ASAP.

Thanks!

from tensorflow.

sushreebarsa avatar sushreebarsa commented on May 2, 2024

@Dobiasd Could you try to use model.save('model.h5', save_format='tf') to save the model in TensorFlow SavedModel format as the default model.save might not capture all model components. Please have a look at this gist and let us know if it helps?
Thank you!

from tensorflow.

Dobiasd avatar Dobiasd commented on May 2, 2024

I tried:

from tensorflow.keras.layers import Input, LSTM, Bidirectional
from tensorflow.keras.models import Model, load_model

inputs = [Input(shape=(17, 4))]
layer = Bidirectional(LSTM(units=4), merge_mode='concat')(inputs[0])
outputs = [layer]
model = Model(inputs=inputs, outputs=outputs)

model.save('model.h5', save_format='tf')
load_model('model.h5')

model.save('model.h5', save_format='tf') raises a ValueError:

  File "h5py/h5d.pyx", line 137, in h5py.h5d.create
ValueError: Unable to synchronously create dataset (name already exists)

However, the model.h5 is written to the disk nonetheless.

But loading it (load_model('model.h5')) fails:

  File "h5py/h5o.pyx", line 189, in h5py.h5o.open
KeyError: "Unable to synchronously open object (object 'input_layer' doesn't exist)"

from tensorflow.

sushreebarsa avatar sushreebarsa commented on May 2, 2024

@Dobiasd Thank you for the response here.
@SuryanarayanaY I was able to replicate the issue reported here.
Thank you!

from tensorflow.

JuanVargas avatar JuanVargas commented on May 2, 2024

I am having the same issue. This and other issues have resulted in frustrating experiences when moving from previous versions of tf into tf 2.15 and TF 2.16, including 2.16.1.

from tensorflow.

JelleKuiper avatar JelleKuiper commented on May 2, 2024

Having same issue with tensorflow==2.16.1 and keras==3.2.1
Is downgrading really the only fix right now?

from tensorflow.

SuryanarayanaY avatar SuryanarayanaY commented on May 2, 2024

Hi @Dobiasd ,

Please note that Keras3 supports saving the model in .keras format only as It is now supporting multiple backends like Torch and Jax also.With .keras format this has been working fine in nightly and attached gist for reference.

If you want to save the model in tf format you might need to use model.export("saved_model") instead of model.save().

Please refer the migration guide here.

from tensorflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.