Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
lasagne save&restore params
# -*- coding: utf-8 -*-
import cPickle as pickle
import os
import lasagne
def read_model_data(model, filename):
filename = os.path.join('./', '%s.param.theano' % filename)
with open(filename, 'r') as f:
data = pickle.load(f)
lasagne.layers.set_all_param_values(model, data)
def write_model_data(model, filename):
"""Pickels the parameters within a Lasagne model."""
data = lasagne.layers.get_all_param_values(model)
filename = os.path.join('./', filename)
filename = '%s.%s' % (filename, PARAM_EXTENSION)
with open(filename, 'w') as f:
pickle.dump(data, f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.