question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

saving & loading NeuralNet model

See original GitHub issue

hi matt & henning,

so i managed to use tagger.py from the examples directory with some easy patch (using train_sparse and predict_sparse directly), but i don’t know how to save and load the trained model. i’ve tried to re-initialised the tagger.model and set the weights but the final result is too random (i’m guessing re-init causing the model set to default/random).

In [2]: tagger, w, c = pickle.load(open('models/UD_Indonesian/model.bin'))

In [3]: tagger.model = NeuralNet([tagger.ex.input_length] + [tagger.hidden_width] * tagger.depth + [len(tagger.classes)], embed=(tagger.ex.tables, tagger.ex.slots), rho=tagger.L2, eta=tagger.learn_rate, update_step=tagger.solver)

In [4]: tagger.model.weights = w

thanks!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
honnibalcommented, Dec 31, 2016

Neural network is finally live 😃.

The new code is much simpler and better, and supports pickle — so serialisation is now no problem.

0reactions
honnibalcommented, Feb 24, 2016

I think youre clipping the value in that __set__ method — weight_t is double in recent versions, so be careful to use the typedef.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
Save and load models | TensorFlow Core
Model progress can be saved during and after training. This means a model can resume where it left off and avoid long training...
Read more >
Training, saving and loading Artificial Neural Networks in Keras
We demonstrate how to code a Artificial neural network model and train and save it in JSON or H5 format which can be...
Read more >
Saving and Loading Models - Deeplearning4j
Saving and loading of neural networks. ... Utility class suited to save/restore neural net models. writeModel. public static void writeModel(@NonNull Model ...
Read more >
Save and Load a Model with TensorFlow's Keras API
... the various ways of saving and loading a Sequential model using TensorFlow's Keras API. ... TensorFlow - Python Deep Learning Neural Network...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found