nitishsrivastava / deepnet

Implementation of some deep learning algorithms.
BSD 3-Clause "New" or "Revised" License
893 stars 438 forks source link

SparseCodeLayer has no attribute IsLayerType #67

Open owenvallis opened 9 years ago

owenvallis commented 9 years ago

I'm trying to run the examples from python 3 using the corvalius fork, but I keep getting an error. However, it doesn't seem like sparse_code_layer.py would have the IsLayerType method.

Traceback (most recent call last): File "../../../package/deepnet/trainer.py", line 59, in main() File "../../../package/deepnet/trainer.py", line 54, in main model.Train() File "/Users/owenvallis/Documents/kadenze/ml_research/deepnet/package/deepnet/neuralnet.py", line 606, in Train self.SetUpTrainer() File "/Users/owenvallis/Documents/kadenze/ml_research/deepnet/package/deepnet/neuralnet.py", line 569, in SetUpTrainer self.LoadModelOnGPU() File "/Users/owenvallis/Documents/kadenze/ml_research/deepnet/package/deepnet/dbm.py", line 300, in LoadModelOnGPU super(DBM, self).LoadModelOnGPU(batchsize=batchsize) File "/Users/owenvallis/Documents/kadenze/ml_research/deepnet/package/deepnet/neuralnet.py", line 88, in LoadModelOnGPU self.layer.append(CreateLayer(Layer, layer, self.t_op, tied_to=tied_to)) File "/Users/owenvallis/Documents/kadenze/ml_research/deepnet/package/deepnet/util.py", line 146, in CreateLayer if cls.IsLayerType(proto): AttributeError: type object 'SparseCodeLayer' has no attribute 'IsLayerType'

owenvallis commented 9 years ago

n/m, I had a path error to the mnist data. I had it pointing at the mnist.pbtxt that came with the deepnet repo, but had the rest of the mnist npy data in a different directory.

owenvallis commented 9 years ago

re opened this issue as the error keeps popping up intermittently. I'm running the code using python 3 (based off of the corvalius fork), and a macbook pro with an NVIDIA GeForce GT 750M 2048 MB.

chadawagner commented 9 years ago

I can confirm experiencing this issue as well. It seems like there should be an IsLayerType classmethod on the Layer base class, which would just return False. I added this and it seems to be working fine now, i.e. in deepnet/layer.py:

class Layer(Parameter):
    ...
    @classmethod
    def IsLayerType(cls, proto):
        return False
    ...