Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'DrawModel' object has no attribute 'apply' #17

Closed
stas-sl opened this issue Jun 25, 2015 · 4 comments
Closed

AttributeError: 'DrawModel' object has no attribute 'apply' #17

stas-sl opened this issue Jun 25, 2015 · 4 comments

Comments

@stas-sl
Copy link

stas-sl commented Jun 25, 2015

Hi, do you have ideas why this can happen?

Running experiment bmnist-r2-w5-t64-enc256-dec256-z100-lr34
               dataset: bmnist
          subdirectory: 20150625-174801-bmnist
         learning rate: 0.0003
             attention: 2,5
          n_iterations: 64
     encoder dimension: 256
           z dimension: 100
     decoder dimension: 256
            batch size: 100
                epochs: 100

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/home/.../draw/train-draw.py in <module>()
    280     args = parser.parse_args()
    281 
--> 282     main(**vars(args))

/home/.../draw/train-draw.py in main(name, dataset, epochs, batch_size, learning_rate, attention, n_iter, enc_dim, dec_dim, z_dim, oldmodel)
    155 
    156     #x_recons = 1. + x
--> 157     x_recons, kl_terms = draw.reconstruct(x)
    158     #x_recons, _, _, _, _ = draw.silly(x, n_steps=10, batch_size=100)
    159     #x_recons = x_recons[-1,:,:]

/usr/local/lib/python2.7/dist-packages/blocks/bricks/base.pyc in __call__(self, *args, **kwargs)
    358 
    359     def __call__(self, *args, **kwargs):
--> 360         return self.application.apply(self, *args, **kwargs)
    361 
    362 

/usr/local/lib/python2.7/dist-packages/blocks/bricks/base.pyc in apply(self, bound_application, *args, **kwargs)
    300         self.call_stack.append(brick)
    301         try:
--> 302             outputs = self.application_function(brick, *args, **kwargs)
    303             outputs = pack(outputs)
    304         finally:

/home/.../draw/draw/draw.pyc in reconstruct(self, features)
    340 
    341         c, h_enc, c_enc, z, kl, h_dec, c_dec = \
--> 342             rvals = self.iterate(x=features, u=u)
    343 
    344         x_recons = T.nnet.sigmoid(c[-1,:,:])

/usr/local/lib/python2.7/dist-packages/blocks/bricks/base.pyc in __call__(self, *args, **kwargs)
    358 
    359     def __call__(self, *args, **kwargs):
--> 360         return self.application.apply(self, *args, **kwargs)
    361 
    362 

/usr/local/lib/python2.7/dist-packages/blocks/bricks/base.pyc in apply(self, bound_application, *args, **kwargs)
    300         self.call_stack.append(brick)
    301         try:
--> 302             outputs = self.application_function(brick, *args, **kwargs)
    303             outputs = pack(outputs)
    304         finally:

/usr/local/lib/python2.7/dist-packages/blocks/bricks/recurrent.pyc in recurrent_apply(brick, application, application_call, *args, **kwargs)
    179             # Ensure that all initial states are available.
    180             initial_states = brick.initial_states(batch_size, as_dict=True,
--> 181                                                   *args, **kwargs)
    182             for state_name in application.states:
    183                 dim = brick.get_dim(state_name)

/usr/local/lib/python2.7/dist-packages/blocks/bricks/base.pyc in __call__(self, *args, **kwargs)
    358 
    359     def __call__(self, *args, **kwargs):
--> 360         return self.application.apply(self, *args, **kwargs)
    361 
    362 

/usr/local/lib/python2.7/dist-packages/blocks/bricks/base.pyc in apply(self, bound_application, *args, **kwargs)
    300         self.call_stack.append(brick)
    301         try:
--> 302             outputs = self.application_function(brick, *args, **kwargs)
    303             outputs = pack(outputs)
    304         finally:

/usr/local/lib/python2.7/dist-packages/blocks/bricks/recurrent.pyc in initial_states(self, batch_size, *args, **kwargs)
     54         """
     55         result = []
---> 56         for state in self.apply.states:
     57             dim = self.get_dim(state)
     58             if dim == 0:

AttributeError: 'DrawModel' object has no attribute 'apply'
@jbornschein
Copy link
Owner

@dribnet found a specific version of blocks (dribnet@4509fb4) where this doesn't happen.

I'm not sure yet what change in blocks caused this.

@jbornschein
Copy link
Owner

Blocks changed the way the recurrent states are initilized; by default it will now choose zeros for all the states that are used in a SomeRecurrentBrick.apply(...) method.

Should be fixed now (c351c50).

@dribnet can you confirm?

@stas-sl
Copy link
Author

stas-sl commented Jun 25, 2015

Thanks for the quick fix! I can confirm that the error has gone for me.

@dribnet
Copy link
Contributor

dribnet commented Jun 26, 2015

Yes, confirmed that this fixes is the issue. I left a note in my README which documents the version of blocks draw is is known to against in case this happens again with the develop branch of blocks.

@dribnet dribnet mentioned this issue Jun 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants