[Question] Can't load a model after training
See original GitHub issueHi! Long time didn’t see 😃
I faced some issue:
I used custom model for classification task and trained it, saved weights as h5. And now I can’t to load it to test.
Try this:
model.load_weights("model_weights.h5")
and gets:
AttributeError: 'LSTM_Dropout_Dense_Model' object has no attribute 'load_weights'
class LSTM_Dropout_Dense_Model(BaseClassificationModel):
is based on BaseClassificationModel
I found in other issues here to use something like loaded_model.model.load_weights(''')
but I get
AttributeError: 'LSTM_Dropout_Dense_Model' object has no attribute 'model'
What can I do?
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Keras load_model not working after training - Stack Overflow
To load the model weights, create the model programmatically just as in step 1 but do not use the model.compile function.
Read more >Custom GPT2 Model won't load after training - Intermediate
The Problem. I was able to train my customly build model but I am not able to load it with the from_pretrained() function....
Read more >How to Save and Load Your Keras Deep Learning Model
In this post, you will discover how to save your Keras models to files and load them up again to make predictions. After...
Read more >Saving and loading models for inference in PyTorch
There are two approaches for saving and loading models for inference in PyTorch. The first is saving and loading the state_dict , and...
Read more >Save and load models in Tensorflow - GeeksforGeeks
The development of the model can be saved both before and after ... We can not load the weights of a model(having 2...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve never done it before, but a bit more experience and I’ll try! I try sometimes to accumulate my exp in small texts in my telegram blog, but it’s really rare and only for me and 2-3 people doing ± same tasks. Creating longreads very challenging for me! Never done it in english especially but I’ll try, in September, right after entry exams in the phd program because you develop really convenient, useful project – and it deserves to be more popular
Got it. You need to build a model first to get the tf_model object, try this,