!13815 fixed the code spell errors

From: @oacjiewen
Reviewed-by: @wuxuejian,@liangchenghui
Signed-off-by: @wuxuejian
pull/13815/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 547ca0fb15

@ -16,7 +16,7 @@
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "sh run_distribute_eval.sh DEVICE_NUM RANK_TABLE_FILE DATASET CKPT_PATH"
echo "for example: sh run_eval.sh [RANK_TABLE_FILE] /path/to/dataset /path/to/ckpt device_id"
echo "It is better to use absolute path."

@ -76,7 +76,7 @@ if __name__ == "__main__":
model = Model(network, loss_fn=loss, metrics={'top_1_accuracy', 'top_5_accuracy'})
else:
raise ValueError("Unsupport dataset.")
raise ValueError("Unsupported dataset.")
if ds_eval.get_dataset_size() == 0:
raise ValueError("Please check dataset size > 0 and batch_size <= dataset size")

@ -64,7 +64,7 @@ if __name__ == "__main__":
elif args.dataset_name == "imagenet":
cfg = alexnet_imagenet_cfg
else:
raise ValueError("Unsupport dataset.")
raise ValueError("Unsupported dataset.")
device_target = args.device_target
context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target)
@ -92,7 +92,7 @@ if __name__ == "__main__":
elif args.dataset_name == "imagenet":
ds_train = create_dataset_imagenet(args.data_path, cfg.batch_size)
else:
raise ValueError("Unsupport dataset.")
raise ValueError("Unsupported dataset.")
if ds_train.get_dataset_size() == 0:
raise ValueError("Please check dataset size > 0 and batch_size <= dataset size")
@ -124,7 +124,7 @@ if __name__ == "__main__":
loss_scale_manager = FixedLossScaleManager(cfg.loss_scale, drop_overflow_update=False)
else:
raise ValueError("Unsupport dataset.")
raise ValueError("Unsupported dataset.")
if device_target == "Ascend":
model = Model(network, loss_fn=loss, optimizer=opt, metrics=metrics, amp_level="O2", keep_batchnorm_fp32=False,

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""weight initilization"""
"""weight initialization"""
import math
import numpy as np

@ -35,21 +35,21 @@ using cv::Point;
namespace py = pybind11;
namespace pse_adaptor {
void get_kernals(const int *data, vector<int64> data_shape, vector<Mat> *kernals) {
void get_kernels(const int *data, vector<int64> data_shape, vector<Mat> *kernels) {
for (int i = 0; i < data_shape[0]; ++i) {
Mat kernal = Mat::zeros(data_shape[1], data_shape[2], CV_8UC1);
for (int x = 0; x < kernal.rows; ++x) {
for (int y = 0; y < kernal.cols; ++y) {
kernal.at<char>(x, y) = data[i * data_shape[1] * data_shape[2] + x * data_shape[2] + y];
Mat kernel = Mat::zeros(data_shape[1], data_shape[2], CV_8UC1);
for (int x = 0; x < kernel.rows; ++x) {
for (int y = 0; y < kernel.cols; ++y) {
kernel.at<char>(x, y) = data[i * data_shape[1] * data_shape[2] + x * data_shape[2] + y];
}
}
kernals->emplace_back(kernal);
kernels->emplace_back(kernel);
}
}
void growing_text_line(const vector<Mat> &kernals, vector<vector<int>> *text_line, float min_area) {
void growing_text_line(const vector<Mat> &kernels, vector<vector<int>> *text_line, float min_area) {
Mat label_mat;
int label_num = connectedComponents(kernals[kernals.size() - 1], label_mat, 4);
int label_num = connectedComponents(kernels[kernels.size() - 1], label_mat, 4);
vector<int> area(label_num + 1, 0);
for (int x = 0; x < label_mat.rows; ++x) {
for (int y = 0; y < label_mat.cols; ++y) {
@ -76,7 +76,7 @@ namespace pse_adaptor {
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
for (int kernal_id = kernals.size() - 2; kernal_id >= 0; --kernal_id) {
for (int kernal_id = kernels.size() - 2; kernal_id >= 0; --kernal_id) {
while (!queue.empty()) {
Point point = queue.front();
queue.pop();
@ -90,7 +90,7 @@ namespace pse_adaptor {
if (tmp_x < 0 || tmp_x >= static_cast<int>(text_line->size())) continue;
if (tmp_y < 0 || tmp_y >= static_cast<int>(text_line->at(1).size())) continue;
if (kernals[kernal_id].at<char>(tmp_x, tmp_y) == 0) continue;
if (kernels[kernal_id].at<char>(tmp_x, tmp_y) == 0) continue;
if (text_line->at(tmp_x)[tmp_y] > 0) continue;
Point point_tmp(tmp_x, tmp_y);
@ -110,10 +110,10 @@ namespace pse_adaptor {
vector<vector<int>> pse(py::array_t<int, py::array::c_style | py::array::forcecast> quad_n9, float min_area) {
auto buf = quad_n9.request();
auto data = static_cast<int *>(buf.ptr);
vector<Mat> kernals;
get_kernals(data, buf.shape, &kernals);
vector<Mat> kernels;
get_kernels(data, buf.shape, &kernels);
vector<vector<int>> text_line;
growing_text_line(kernals, &text_line, min_area);
growing_text_line(kernels, &text_line, min_area);
return text_line;
}

@ -15,7 +15,7 @@
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "sh run_distribute_train.sh DEVICE_NUM EPOCH_SIZE LR DATASET RANK_TABLE_FILE PRE_TRAINED PRE_TRAINED_EPOCH_SIZE"
echo "for example: sh run_distribute_train.sh 8 500 0.2 coco /data/hccl.json /opt/ssd-300.ckpt(optional) 200(optional)"
echo "It is better to use absolute path."
@ -33,7 +33,7 @@ BASE_PATH=$(cd "`dirname $0`" || exit; pwd)
cd $BASE_PATH/../ || exit
python train.py --only_create_dataset=True --dataset=$4
echo "After running the scipt, the network runs in the background. The log will be generated in LOGx/log.txt"
echo "After running the script, the network runs in the background. The log will be generated in LOGx/log.txt"
export RANK_SIZE=$1
EPOCH_SIZE=$2

@ -15,7 +15,7 @@
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "sh run_distribute_train_gpu.sh DEVICE_NUM EPOCH_SIZE LR DATASET PRE_TRAINED PRE_TRAINED_EPOCH_SIZE"
echo "for example: sh run_distribute_train_gpu.sh 8 500 0.2 coco /opt/ssd-300.ckpt(optional) 200(optional)"
echo "It is better to use absolute path."
@ -33,7 +33,7 @@ BASE_PATH=$(cd "`dirname $0`" || exit; pwd)
cd $BASE_PATH/../ || exit
python train.py --only_create_dataset=True --run_platform="GPU" --dataset=$4
echo "After running the scipt, the network runs in the background. The log will be generated in LOG/log.txt"
echo "After running the script, the network runs in the background. The log will be generated in LOG/log.txt"
export RANK_SIZE=$1
EPOCH_SIZE=$2

@ -57,7 +57,7 @@ cp ./*.py ./eval$3
cp -r ./src ./eval$3
cd ./eval$3 || exit
env > env.log
echo "start infering for device $DEVICE_ID"
echo "start inferring for device $DEVICE_ID"
python eval.py \
--dataset=$DATASET \
--checkpoint_path=$CHECKPOINT_PATH \

@ -57,7 +57,7 @@ cp ./*.py ./eval$3
cp -r ./src ./eval$3
cd ./eval$3 || exit
env > env.log
echo "start infering for device $DEVICE_ID"
echo "start inferring for device $DEVICE_ID"
python eval.py \
--dataset=$DATASET \
--checkpoint_path=$CHECKPOINT_PATH \

@ -15,7 +15,7 @@
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "bash run_distribute_pretrain.sh DEVICE_NUM EPOCH_SIZE DATA_DIR SCHEMA_DIR RANK_TABLE_FILE"
echo "for example: bash run_distribute_pretrain.sh 8 1 /path/zh-wiki/ /path/Schema.json /path/hccl.json"
echo "It is better to use absolute path."

@ -15,7 +15,7 @@
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script 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 "=============================================================================================================="

@ -585,7 +585,7 @@ class Model:
returned and passed to the network. Otherwise, a tuple (data, label) should
be returned, and the data and label are passed to the network and loss
function respectively.
callbacks (list): List of callback object. Callbacks which should be excuted while training. Default: None.
callbacks (list): List of callback object. Callbacks which should be executed while training. Default: None.
dataset_sink_mode (bool): Determines whether to pass the data through dataset channel. Default: True.
Configure pynative mode, the training process will be performed with
dataset not sink.
@ -704,7 +704,7 @@ class Model:
Args:
valid_dataset (Dataset): Dataset to evaluate the model.
callbacks (list): List of callback object. Callbacks which should be excuted
callbacks (list): List of callback object. Callbacks which should be executed
while training. Default: None.
dataset_sink_mode (bool): Determines whether to pass the data through dataset channel. Default: True.

@ -65,7 +65,7 @@ def make_directory(path: str):
"""Make directory."""
if path is None or not isinstance(path, str) or path.strip() == "":
logger.error("The path(%r) is invalid type.", path)
raise TypeError("Input path is invaild type")
raise TypeError("Input path is invalid type")
# convert the relative paths
path = os.path.realpath(path)

@ -25,9 +25,9 @@
# [FastText](#contents)
FastText is a fast text classification algorithm, which is simple and efficient. It was proposed by Armand
Joulin, Tomas Mikolov etc. in the artical "Bag of Tricks for Efficient Text Classification" in 2016. It is similar to
Joulin, Tomas Mikolov etc. in the article "Bag of Tricks for Efficient Text Classification" in 2016. It is similar to
CBOW in model architecture, where the middle word is replace by a label. FastText adopts ngram feature as addition feature
to get some information about words. It speeds up training and testing while maintaining high percision, and widly used
to get some information about words. It speeds up training and testing while maintaining high precision, and widly used
in various tasks of text classification.
[Paper](https://arxiv.org/pdf/1607.01759.pdf): "Bag of Tricks for Efficient Text Classification", 2016, A. Joulin, E. Grave, P. Bojanowski, and T. Mikolov

@ -14,7 +14,7 @@
# limitations under the License.
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "sh create_dataset.sh SOURCE_DATASET_PATH DATASET_NAME"
echo "for example: sh create_dataset.sh /home/workspace/ag_news_csv ag"
echo "DATASET_NAME including ag, dbpedia, and yelp_p"

@ -15,7 +15,7 @@
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "sh run_distributed_train.sh DATASET_PATH RANK_TABLE_PATH"
echo "for example: sh run_distributed_train.sh /home/workspace/ag /home/workspace/rank_table_file.json"
echo "It is better to use absolute path."

@ -14,7 +14,7 @@
# limitations under the License.
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "sh run_eval.sh DATASET_PATH DATASET_NAME MODEL_CKPT"
echo "for example: sh run_eval.sh /home/workspace/ag/test*.mindrecord ag device0/ckpt0/fasttext-5-118.ckpt"
echo "It is better to use absolute path."

@ -14,7 +14,7 @@
# limitations under the License.
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "sh run_standalone_train.sh DATASET_PATH"
echo "for example: sh run_standalone_train.sh /home/workspace/ag"
echo "It is better to use absolute path."

@ -62,7 +62,7 @@ class FastText(nn.Cell):
embeding = self.realdiv(embeding, src_token_length)
embeding = self.cast(embeding, mstype.float16)
classifer = self.fc(embeding)
classifer = self.cast(classifer, mstype.float32)
classifier = self.fc(embeding)
classifier = self.cast(classifier, mstype.float32)
return classifer
return classifier

@ -184,7 +184,7 @@ def train_paralle(input_file_path):
input_file_path: preprocessed dataset path
"""
set_parallel_env()
print("Starting traning on mutiple devices. |~ _ ~| |~ _ ~| |~ _ ~| |~ _ ~|")
print("Starting traning on multiple devices. |~ _ ~| |~ _ ~| |~ _ ~| |~ _ ~|")
preprocessed_data = load_dataset(dataset_path=input_file_path,
batch_size=config.batch_size,
epoch_count=config.epoch_count,

@ -15,7 +15,7 @@
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "bash script/pre_process.sh \"INPUT_GLOB\" DATASET_TYPE OUTPUT_FILE"
echo "for example: bash script/pre_process.sh \"dataset/*.output\" openwebtext ./output/openwebtext.mindrecord"
echo "=============================================================================================================="

@ -15,7 +15,7 @@
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "bash run_distributed_pretrain_ascend.sh DATA_DIR RANK_TABLE_FILE DEVICE_NUM"
echo "for example: bash run_distributed_pretrain_ascend.sh /path/dataset /path/hccl.json 8"
echo "It is better to use absolute path."

@ -15,7 +15,7 @@
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "bash scripts/run_evaluation.sh TASK_TYPE CKPT_PATH DATA_PATH METRICS"
echo "for example: bash scripts/run_evaluation.sh lambada /your/ckpt /your/data acc"
echo "=============================================================================================================="

@ -15,7 +15,7 @@
# ============================================================================
echo "=============================================================================================================="
echo "Please run the scipt as: "
echo "Please run the script as: "
echo "bash run_standalone_pretrain_ascend.sh DEVICE_ID EPOCH_SIZE DATA_DIR"
echo "for example: bash run_standalone_pretrain_ascend.sh 0 40 /path/zh-wiki/"
echo "=============================================================================================================="

@ -14,7 +14,7 @@
# ============================================================================
"""
Create dataset for training and evaluting
Create dataset for training and evaluating
"""
import os

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save