Comments (7)
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.
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.
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.
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.
Have you tried this? #24
from seq2seq.
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.
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)
- Setting Activations on layers HOT 3
- Error when importing
- after predict, it is not integers result, how to output integers?
- How to set the type of activation function of output inside the LSTM block of decoder? HOT 1
- About algorithm
- Cudnn based LSTM Layers?
- Setup error
- good framework HOT 1
- predict model
- add seq2seq layer to embedding layer with mask raise "Exception: Layers should have equal number of output tensors and output masks. Layer recurrent_sequential_1 has 3 output tensors and 4 output masks." HOT 4
- any way to visualize attention activation? HOT 3
- predicte wrong answer using seq2seq model(all test sample predicte same answer) HOT 2
- How to use seq2seq for simple sequences HOT 1
- Bad results of a simple translation task. Ask for help...:(
- error:name 'K' is not defined HOT 3
- IndexError: index 3 is out of bounds for axis 0 with size 3 HOT 1
- ImportError: cannot import name 'keras_test' from 'keras.utils.test_utils' HOT 1
- ValueError: An operation has `None` for gradient. HOT 2
- Images from readme file are not displayed
- cannot import name 'tensorflow_backend' from 'keras.backend'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seq2seq.