Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mindnlp/transformers/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ def wrapper(
pretrained_model_name_or_path,
**kwargs,
):
device_map = kwargs.pop("device_map", None)
sharded_metadata = kwargs.pop("sharded_metadata", None)
device_map = kwargs.get("device_map", None)
sharded_metadata = kwargs.get("sharded_metadata", None)

# if device_map is not None and not initialize distribute module, raise Error.
if device_map is not None:
Expand Down
2 changes: 1 addition & 1 deletion mindtorch/nn/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ def scaled_dot_product_attention(query, key, value, attn_mask=None, dropout_p=0.

attn_weight = query @ key.transpose(-2, -1) * scale_factor
attn_weight += attn_bias
attn_weight = softmax(attn_weight, dim=-1, dtype=mindtorch.float32).to(query.dtype)
attn_weight = softmax(attn_weight, dim=-1)
attn_weight = dropout(attn_weight, dropout_p, training=True)
return attn_weight @ value

Expand Down
Loading