Code Monkey home page Code Monkey logo

Comments (7)

naotokui avatar naotokui commented on August 23, 2024 4

pickle or dill doesn't work in my case.
but this works:

# saving
model  = Seq2Seq(input_shape... ....) 
model.fit(...)
model.save_weights('model.h5')

# loading
#### model = model_from_json()  # <---- doesn't work!!
model  = Seq2Seq(input_shape... ....)  # Instantiate a model object with the same configuration as above before loading weights
model.load_weights('model.h5')

from seq2seq.

CaseyKay avatar CaseyKay commented on August 23, 2024 4

For me, it raise 'ValueError: Unknown layer: _OptionalInputPlaceHolder' when I use model.save() and load_model(), and model_from_json() too, cPickle doen't work either, @naotokui 's way works, but is there a better solution now?

from seq2seq.

iamyuanchung avatar iamyuanchung commented on August 23, 2024

I have similar problem.
When I tried to load the trained Seq2seq model with model.load_weights(...), it raised a "Unrecognized model" error.
@galaxyh do you have the same error?

from seq2seq.

chm90 avatar chm90 commented on August 23, 2024

I'm using a SimpleSeq2seq and can successfully save models but doesn't seem to be able to load them. Loading the saved Simple model throws the exception "Invalid layer: SimpleSeq2seq". Anybody got any clues how this could be resolved?

from seq2seq.

iamyuanchung avatar iamyuanchung commented on August 23, 2024

Have you tried this? #24

from seq2seq.

nicoayroles avatar nicoayroles commented on August 23, 2024

As mentioned in #24 , I tried to pickle my model:
model = Seq2Seq()
model.compile(loss='categorical_crossentropy', optimizer='rmsprop')
with open(path, 'w') as f:
pkl.dump(model, f)

but I get the following error:
pickle.PicklingError: Can't pickle <function step at 0x7f56d52a10c8>: it's not found as recurrentshop.cells.step

How do you solve this?
Thanks

from seq2seq.

smodlich avatar smodlich commented on August 23, 2024

For me saving the model works when I use dill instead of cpickle.
import dill as pickle
model=...
pickle.dump(model,open("model.p","wb"),protocol=2)
with open("model.p","rb")as m:
model =pickle.load(m)

from seq2seq.

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.