gabrieleangeletti / Deep-Learning-TensorFlow

Ready to use implementations of various Deep Learning algorithms using TensorFlow.
http://blackecho.github.io
MIT License
965 stars 376 forks source link

Error while training DBN #43

Closed nish21 closed 7 years ago

nish21 commented 7 years ago

I'm trying to train a DBN with a custom dataset. However I get the following error message

Training layer 1...
Traceback (most recent call last):
  File "run_dbn.py", line 118, in <module>
    srbm.pretrain(trX, vlX)
  File "/home/nishanth/miniconda2/lib/python2.7/site-packages/yadlt-0.0.5-py2.7.egg/yadlt/models/boltzmann/dbn.py", line 124, in pretrain
    train_set=train_set, validation_set=validation_set)
  File "/home/nishanth/miniconda2/lib/python2.7/site-packages/yadlt-0.0.5-py2.7.egg/yadlt/core/model.py", line 57, in pretrain_procedure
    layer_graphs[l])
  File "/home/nishanth/miniconda2/lib/python2.7/site-packages/yadlt-0.0.5-py2.7.egg/yadlt/core/model.py", line 74, in _pretrain_layer_and_gen_feed
    validation_set, validation_set, graph=graph)
  File "/home/nishanth/miniconda2/lib/python2.7/site-packages/yadlt-0.0.5-py2.7.egg/yadlt/core/unsupervised_model.py", line 58, in fit
    self.build_model(train_X.shape[1])
  File "/home/nishanth/miniconda2/lib/python2.7/site-packages/yadlt-0.0.5-py2.7.egg/yadlt/models/boltzmann/rbm.py", line 153, in build_model
    self.cost = self.loss.compile(vprob, self.input_data, regterm=regterm)
  File "/home/nishanth/miniconda2/lib/python2.7/site-packages/yadlt-0.0.5-py2.7.egg/yadlt/core/trainers.py", line 135, in compile
    tf.summary.scalar(self.lfunc, cost)
AttributeError: 'module' object has no attribute 'summary'

Further information I installed tensorflow 0.8.0 through conda. I'm not sure if my installation of tensorflow is incorrect. The validate your installation section in their installation documentation works. I cloned the yadlt github repo. I'm executing the following command

python run_dbn.py  --dataset custom --verbose 1 --rbm_layers 512,256 --rbm_learning_rate 0.005 --rbm_num_epochs 15 --rbm_batch_size 25 --finetune_batch_size 25 --finetune_learning_rate 0.001 --finetune_num_epochs 10 --finetune_loss_func softmax_cross_entropy --finetune_dropout 0.7 --finetune_act_func relu

Not sure what's going wrong. Maybe you could help me? Thanks for your time.

gabrieleangeletti commented 7 years ago

Sorry, I should have updated the readme. The minimum requirement for tensorflow is 1.0 now.

nish21 commented 7 years ago

Let me check that and get back to you. Thank you

nish21 commented 7 years ago

Yes, I can confirm that it works now. Thank you for your time. I'll go ahead and close this issue.

nish21 commented 7 years ago

Sorry, looks like I have run into another problem. I now have

Start deep belief net finetuning...
Traceback (most recent call last):
  File "run_dbn.py", line 122, in <module>
    srbm.fit(trX, trY, vlX, vlY)
  File "/home/nishanth/miniconda2/lib/python2.7/site-packages/yadlt-0.0.6-py2.7.egg/yadlt/core/supervised_model.py", line 56, in fit
    raise Exception("Please convert the labels with one-hot encoding.")
Exception: Please convert the labels with one-hot encoding.

And my labels are numbers. They range from [1,5]. Edit:

Should I encode them as [1,0,0,0,0] [0,1,0,0,0] . . [0,0,0,0,1] ?

nish21 commented 7 years ago

Figured it out.