mindspore-ai / mindspore

MindSpore is a new open source deep learning training/inference framework that could be used for mobile, edge and cloud scenarios.
https://gitee.com/mindspore/mindspore
Apache License 2.0
4.3k stars 711 forks source link

'Dropout' object has no attribute 'dropout_gen_mask' #137

Closed mymusise closed 3 years ago

mymusise commented 3 years ago

Environment

Hardware Environment(Ascend/GPU/CPU):

Software Environment:

I got an error when running the prediction script of PanGu-Alpha

~/sources/PanGu-Alpha/pangu_alpha.py in __init__(self, config, scale, layer_idx)
    283         self.use_past = config.use_past
    284         self.dropout = nn.Dropout(1 - config.dropout_rate)
--> 285         self.dropout.dropout_gen_mask.shard(((config.dp, 1, 1),))
    286         self.dropout.dropout_do_mask.shard(((config.dp, 1, 1),))
    287         self.prob_dropout = nn.Dropout(1 - config.dropout_rate)

~/sources/PanGu-Alpha/env/lib/python3.7/site-packages/mindspore/nn/cell.py in __getattr__(self, name)
    264                 para_list = ParameterTuple(cast_list)
    265                 return para_list
--> 266         raise AttributeError("'{}' object has no attribute '{}'.".format(type(self).__name__, name))
    267 
    268     def __del__(self):

AttributeError: 'Dropout' object has no attribute 'dropout_gen_mask'.

Does Dropout.dropout_gen_mask has been remove in 1.2.0rc1 version?

cxl-ll commented 3 years ago

Mindpore Dropout does not have these two attributes on the front end.It is split into gen mask and do mask only when running on the backend.

mymusise commented 3 years ago

Got it, thank you, Guy.