Browse Source

bugfix

tags/v1.0.0
yoonlee666 5 years ago
parent
commit
d90ac3c6d1
4 changed files with 7 additions and 7 deletions
  1. +1
    -1
      model_zoo/official/nlp/bert/run_ner.py
  2. +2
    -2
      model_zoo/official/nlp/bert/scripts/run_distributed_pretrain_ascend.sh
  3. +2
    -2
      model_zoo/official/nlp/bert/scripts/run_standalone_pretrain_ascend.sh
  4. +2
    -2
      model_zoo/official/nlp/bert/src/bert_model.py

+ 1
- 1
model_zoo/official/nlp/bert/run_ner.py View File

@@ -230,7 +230,7 @@ def run_ner():
ds.get_dataset_size(), epoch_num, "ner") ds.get_dataset_size(), epoch_num, "ner")


if args_opt.do_eval.lower() == "true": 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, assessment_method=assessment_method, data_file_path=args_opt.eval_data_file_path,
schema_file_path=args_opt.schema_file_path, schema_file_path=args_opt.schema_file_path,
do_shuffle=(args_opt.eval_data_shuffle.lower() == "true")) do_shuffle=(args_opt.eval_data_shuffle.lower() == "true"))


+ 2
- 2
model_zoo/official/nlp/bert/scripts/run_distributed_pretrain_ascend.sh View File

@@ -16,8 +16,8 @@


echo "==============================================================================================================" echo "=============================================================================================================="
echo "Please run the scipt as: " 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 "It is better to use absolute path."
echo "For hyper parameter, please note that you should customize the scripts: echo "For hyper parameter, please note that you should customize the scripts:
'{CUR_DIR}/scripts/ascend_distributed_launcher/hyper_parameter_config.ini' " '{CUR_DIR}/scripts/ascend_distributed_launcher/hyper_parameter_config.ini' "


+ 2
- 2
model_zoo/official/nlp/bert/scripts/run_standalone_pretrain_ascend.sh View File

@@ -16,8 +16,8 @@


echo "==============================================================================================================" echo "=============================================================================================================="
echo "Please run the scipt as: " 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 "==============================================================================================================" echo "=============================================================================================================="


DEVICE_ID=$1 DEVICE_ID=$1


+ 2
- 2
model_zoo/official/nlp/bert/src/bert_model.py View File

@@ -542,7 +542,7 @@ class BertAttention(nn.Cell):
attention_probs_r = self.reshape( attention_probs_r = self.reshape(
attention_probs_t, attention_probs_t,
(self.from_seq_length, (self.from_seq_length,
self.batch_num,
-1,
self.to_seq_length)) self.to_seq_length))
# value_position_scores is [F, B * N, H] # value_position_scores is [F, B * N, H]
value_position_scores = self.matmul(attention_probs_r, 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 is [F, B, N, H]
value_position_scores_r = self.reshape(value_position_scores, value_position_scores_r = self.reshape(value_position_scores,
(self.from_seq_length, (self.from_seq_length,
self.batch_size,
-1,
self.num_attention_heads, self.num_attention_heads,
self.size_per_head)) self.size_per_head))
# value_position_scores_r_t is [B, N, F, H] # value_position_scores_r_t is [B, N, F, H]


Loading…
Cancel
Save