#11 'Dropout' object has no attribute 'dropout_gen_mask'.

Closed
created 3 years ago by mymusise · 1 comments
mymusise commented 3 years ago
运行predict脚本的时候提示: ``` ~/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'. ``` MindSpore version: 1.2.0rc1
imyzx commented 3 years ago
Owner
``` class Output(nn.Cell): """ The output mapping module for each layer Args: config(PANGUALPHAConfig): the config of network scale: scale factor for initialization Inputs: x: output of the self-attention module Returns: output: Tensor, the output of this layer after mapping """ def __init__(self, config, scale=1.0): super(Output, self).__init__() input_size = config.embedding_size output_size = config.embedding_size * config.expand_ratio self.mapping = Mapping_output(config, input_size, output_size) self.projection = Mapping(config, output_size, input_size, scale) self.activation = nn.GELU() self.activation.gelu.shard(((config.dp, 1, config.mp),)) self.dropout = nn.Dropout(1 - config.dropout_rate) # self.dropout.dropout_gen_mask.shard(((config.dp, 1, 1),)) # self.dropout.dropout_do_mask.shard(((config.dp, 1, 1),)) def construct(self, x): hidden = self.activation(self.mapping(x)) output = self.projection(hidden) output = self.dropout(output) return output ``` 您好,推理时用不到dropout的,这两行您可以注释掉。
taoht closed this issue 3 years ago
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.