lmjohns3 / theanets

Neural network toolkit for Python
http://theanets.rtfd.org
MIT License
328 stars 74 forks source link

UnsupervisedPretrainer broken #128

Closed droid666 closed 8 years ago

droid666 commented 8 years ago

I tried to run examples/mnist-deep-classifier.py, but it fails. UnsupervisedPretrainer.itertrain wants to copy the parameters back, but the check there for if not param.name.startswith('tied') does not work. No name starts with 'tied', and anyway the extra 'b' are not tied but extra.

Params is this: [hid1.w, hid1.b, hid2.w, hid2.b, hid3.w, hid3.b, hid4.b, hid5.b, out.b]

So it tries to copy back hid4.b, which does not exist on the original network.

Error:

Traceback (most recent call last):
  File "examples/mnist-deep-classifier.py", line 19, in <module>
    train_batches=100)
  File "theanets/theanets/graph.py", line 369, in train
    for monitors in self.itertrain(*args, **kwargs):
  File "theanets/theanets/graph.py", line 345, in itertrain
    for i, monitors in enumerate(algo.itertrain(train, valid, **kwargs)):
  File "theanets/theanets/trainer.py", line 337, in itertrain
    self.network.find(l, p).set_value(param.get_value())
  File "theanets/theanets/graph.py", line 484, in find
    raise KeyError(which)
KeyError: 'hid4'
lmjohns3 commented 8 years ago

Thanks for the report!