IBM / mi-prometheus

Enabling reproducible Machine Learning research
http://mi-prometheus.rtfd.io/
Apache License 2.0
42 stars 18 forks source link

'ThalnetModule' object has not attribute 'logger' #68

Open sesevgen opened 6 years ago

sesevgen commented 6 years ago

Describe the bug models/thalnet/thalnet_module.py is the source of the error, on line 131. Trying to log an error to logger causes this.

To Reproduce Steps to reproduce the behavior: Happened as I'm testing changes for #58 - I suspect just feeding in an incorrect sized data as described on the if statement on line 130 should trigger it.

Expected behavior Should properly log to logger.

Desktop (please complete the following information):

vmarois commented 6 years ago

So this happens because miprometheus.models.thalnet.ThalnetModule inherits from torch.nn.Module and not miprometheus.models.Model, which is the base Model class and defines the logger as a class attribute:

https://github.com/IBM/mi-prometheus/blob/2dfafe6087743e0de0f169971ab89d218f9a9cec/miprometheus/models/model.py#L116-L118

This is common to the way some models are implemented in mip, when they are constituted from several classes that inherit from torch.nn.Module (to access autograd), and only have their main class inheriting from Model.

Having them access a logger would then require to add the following lines in each file where there are defined:

https://github.com/IBM/mi-prometheus/blob/2dfafe6087743e0de0f169971ab89d218f9a9cec/miprometheus/models/encoder_solver/mas_cell.py#L25-L27

Perhaps there is a better way to do this? @tkornut Do you have an idea?