diff options
author | Alex Auvolat <alex@adnab.me> | 2016-03-29 12:27:35 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2016-03-29 12:27:35 +0200 |
commit | 30faf44a08edcc2075362c4633f6b1d291944cd3 (patch) | |
tree | bb4a53766d87fc3437999631eb08158a4a26e812 /model/hpc_lstm.py | |
parent | 62c05c06013e7204c1e7681a7e2ac7541f2acbcb (diff) | |
download | text-rnn-30faf44a08edcc2075362c4633f6b1d291944cd3.tar.gz text-rnn-30faf44a08edcc2075362c4633f6b1d291944cd3.zip |
This HPC stuff doesn't work very well.
Diffstat (limited to 'model/hpc_lstm.py')
-rw-r--r-- | model/hpc_lstm.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/model/hpc_lstm.py b/model/hpc_lstm.py index 395646c..d3c33a2 100644 --- a/model/hpc_lstm.py +++ b/model/hpc_lstm.py @@ -10,7 +10,7 @@ from blocks.initialization import IsotropicGaussian, Constant from blocks.filter import VariableFilter from blocks.roles import WEIGHT -from blocks.graph import ComputationGraph, apply_noise, apply_dropout +from blocks.graph import ComputationGraph, apply_noise class Model(): @@ -103,10 +103,20 @@ class Model(): # Initialize all bricks for brick in bricks: - brick.weights_init = IsotropicGaussian(0.1) - brick.biases_init = Constant(0.) + brick.weights_init = config.weights_init + brick.biases_init = config.biases_init brick.initialize() + # apply noise + cg = ComputationGraph([sgd_cost, cost, error_rate]+costs) + if config.weight_noise > 0: + noise_vars = VariableFilter(roles=[WEIGHT])(cg) + cg = apply_noise(cg, noise_vars, config.weight_noise) + sgd_cost = cg.outputs[0] + cost = cg.outputs[1] + error_rate = cg.outputs[2] + costs = cg.outputs[3:] + # put stuff into self that is usefull for training or extensions self.sgd_cost = sgd_cost |