diff --git a/model_zoo/official/nlp/bert/run_ner.py b/model_zoo/official/nlp/bert/run_ner.py index a2ebdc5b3e..19746a69d9 100644 --- a/model_zoo/official/nlp/bert/run_ner.py +++ b/model_zoo/official/nlp/bert/run_ner.py @@ -230,7 +230,7 @@ def run_ner(): ds.get_dataset_size(), epoch_num, "ner") if args_opt.do_eval.lower() == "true": - ds = create_ner_dataset(batch_size=bert_net_cfg.batch_size, repeat_count=1, + ds = create_ner_dataset(batch_size=optimizer_cfg.batch_size, repeat_count=1, assessment_method=assessment_method, data_file_path=args_opt.eval_data_file_path, schema_file_path=args_opt.schema_file_path, do_shuffle=(args_opt.eval_data_shuffle.lower() == "true")) diff --git a/model_zoo/official/nlp/bert/scripts/run_distributed_pretrain_ascend.sh b/model_zoo/official/nlp/bert/scripts/run_distributed_pretrain_ascend.sh index 0843b01c9d..40b214ab06 100644 --- a/model_zoo/official/nlp/bert/scripts/run_distributed_pretrain_ascend.sh +++ b/model_zoo/official/nlp/bert/scripts/run_distributed_pretrain_ascend.sh @@ -16,8 +16,8 @@ echo "==============================================================================================================" echo "Please run the scipt as: " -echo "bash run_distributed_pretrain.sh DATA_DIR RANK_TABLE_FILE" -echo "for example: bash run_distributed_pretrain.sh /path/dataset /path/hccl.json" +echo "bash run_distributed_pretrain_ascend.sh DATA_DIR RANK_TABLE_FILE" +echo "for example: bash run_distributed_pretrain_ascend.sh /path/dataset /path/hccl.json" echo "It is better to use absolute path." echo "For hyper parameter, please note that you should customize the scripts: '{CUR_DIR}/scripts/ascend_distributed_launcher/hyper_parameter_config.ini' " diff --git a/model_zoo/official/nlp/bert/scripts/run_standalone_pretrain_ascend.sh b/model_zoo/official/nlp/bert/scripts/run_standalone_pretrain_ascend.sh index ae07a1bda9..1cbfababfd 100644 --- a/model_zoo/official/nlp/bert/scripts/run_standalone_pretrain_ascend.sh +++ b/model_zoo/official/nlp/bert/scripts/run_standalone_pretrain_ascend.sh @@ -16,8 +16,8 @@ echo "==============================================================================================================" echo "Please run the scipt as: " -echo "bash run_standalone_pretrain.sh DEVICE_ID EPOCH_SIZE DATA_DIR SCHEMA_DIR" -echo "for example: bash run_standalone_pretrain.sh 0 40 /path/zh-wiki/ /path/Schema.json" +echo "bash run_standalone_pretrain_ascend.sh DEVICE_ID EPOCH_SIZE DATA_DIR SCHEMA_DIR" +echo "for example: bash run_standalone_pretrain_ascend.sh 0 40 /path/zh-wiki/ /path/Schema.json" echo "==============================================================================================================" DEVICE_ID=$1 diff --git a/model_zoo/official/nlp/bert/src/bert_model.py b/model_zoo/official/nlp/bert/src/bert_model.py index ea973030a7..9115045620 100644 --- a/model_zoo/official/nlp/bert/src/bert_model.py +++ b/model_zoo/official/nlp/bert/src/bert_model.py @@ -542,7 +542,7 @@ class BertAttention(nn.Cell): attention_probs_r = self.reshape( attention_probs_t, (self.from_seq_length, - self.batch_num, + -1, self.to_seq_length)) # value_position_scores is [F, B * N, H] value_position_scores = self.matmul(attention_probs_r, @@ -550,7 +550,7 @@ class BertAttention(nn.Cell): # value_position_scores_r is [F, B, N, H] value_position_scores_r = self.reshape(value_position_scores, (self.from_seq_length, - self.batch_size, + -1, self.num_attention_heads, self.size_per_head)) # value_position_scores_r_t is [B, N, F, H]