forked from mindspore-Ecosystem/mindspore
clould
This commit is contained in:
parent
70152adcb3
commit
b4d70a3b21
|
@ -20,5 +20,5 @@ BASE_PATH=$(cd ./"`dirname $0`" || exit; pwd)
|
||||||
CONFIG_FILE="${BASE_PATH}/../default_config_gpu.yaml"
|
CONFIG_FILE="${BASE_PATH}/../default_config_gpu.yaml"
|
||||||
|
|
||||||
mpirun --allow-run-as-root -n 8 --output-filename log_output --merge-stderr-to-stdout \
|
mpirun --allow-run-as-root -n 8 --output-filename log_output --merge-stderr-to-stdout \
|
||||||
python ./train.py --config_path=$CONFIG_FILE --is_distributed --platform 'GPU' \
|
python ./train.py --config_path=$CONFIG_FILE --is_distributed=True --platform 'GPU' \
|
||||||
--dataset_path $DATA_DIR --ckpt_path=$CKPT_PATH > train.log 2>&1 &
|
--dataset_path $DATA_DIR --ckpt_path=$CKPT_PATH > train.log 2>&1 &
|
||||||
|
|
|
@ -35,7 +35,7 @@ global_step: 0
|
||||||
preprocess: 'false'
|
preprocess: 'false'
|
||||||
aclimdb_path: "/cache/data/aclImdb"
|
aclimdb_path: "/cache/data/aclImdb"
|
||||||
glove_path: "/cache/data"
|
glove_path: "/cache/data"
|
||||||
preprocess_path: "./preprocess"
|
preprocess_path: "/cache/train/preprocess"
|
||||||
ckpt_path: './ckpt_lstm/'
|
ckpt_path: './ckpt_lstm/'
|
||||||
pre_trained: '' # None
|
pre_trained: '' # None
|
||||||
device_num: 1
|
device_num: 1
|
||||||
|
@ -77,6 +77,5 @@ enable_graph_kernel: 'Accelerate by graph kernel, default is true.'
|
||||||
---
|
---
|
||||||
device_target: ['Ascend', 'GPU', 'CPU']
|
device_target: ['Ascend', 'GPU', 'CPU']
|
||||||
distribute: ['true', 'false']
|
distribute: ['true', 'false']
|
||||||
distribute: ['true', 'false']
|
|
||||||
enable_graph_kernel: ['true', 'false']
|
enable_graph_kernel: ['true', 'false']
|
||||||
file_format: ['AIR', 'ONNX', 'MINDIR']
|
file_format: ['AIR', 'ONNX', 'MINDIR']
|
|
@ -36,7 +36,7 @@ global_step: 0
|
||||||
preprocess: 'false'
|
preprocess: 'false'
|
||||||
aclimdb_path: "/cache/data/aclImdb"
|
aclimdb_path: "/cache/data/aclImdb"
|
||||||
glove_path: "/cache/data"
|
glove_path: "/cache/data"
|
||||||
preprocess_path: "./preprocess"
|
preprocess_path: "/cache/train/preprocess"
|
||||||
ckpt_path: './ckpt_lstm/'
|
ckpt_path: './ckpt_lstm/'
|
||||||
pre_trained: '' # None
|
pre_trained: '' # None
|
||||||
device_num: 8
|
device_num: 8
|
||||||
|
@ -79,6 +79,5 @@ enable_graph_kernel: 'Accelerate by graph kernel, default is true.'
|
||||||
---
|
---
|
||||||
device_target: ['Ascend', 'GPU', 'CPU']
|
device_target: ['Ascend', 'GPU', 'CPU']
|
||||||
distribute: ['true', 'false']
|
distribute: ['true', 'false']
|
||||||
distribute: ['true', 'false']
|
|
||||||
enable_graph_kernel: ['true', 'false']
|
enable_graph_kernel: ['true', 'false']
|
||||||
file_format: ['AIR', 'ONNX', 'MINDIR']
|
file_format: ['AIR', 'ONNX', 'MINDIR']
|
||||||
|
|
|
@ -30,7 +30,7 @@ keep_checkpoint_max: 10
|
||||||
preprocess: 'false'
|
preprocess: 'false'
|
||||||
aclimdb_path: "/cache/data/aclImdb"
|
aclimdb_path: "/cache/data/aclImdb"
|
||||||
glove_path: "/cache/data"
|
glove_path: "/cache/data"
|
||||||
preprocess_path: "./preprocess"
|
preprocess_path: "/cache/train/preprocess"
|
||||||
ckpt_path: './ckpt_lstm/'
|
ckpt_path: './ckpt_lstm/'
|
||||||
pre_trained: '' # None
|
pre_trained: '' # None
|
||||||
device_num: 1
|
device_num: 1
|
||||||
|
@ -72,6 +72,5 @@ enable_graph_kernel: 'Accelerate by graph kernel, default is true.'
|
||||||
---
|
---
|
||||||
device_target: ['Ascend', 'GPU', 'CPU']
|
device_target: ['Ascend', 'GPU', 'CPU']
|
||||||
distribute: ['true', 'false']
|
distribute: ['true', 'false']
|
||||||
distribute: ['true', 'false']
|
|
||||||
enable_graph_kernel: ['true', 'false']
|
enable_graph_kernel: ['true', 'false']
|
||||||
file_format: ['AIR', 'MINDIR']
|
file_format: ['AIR', 'MINDIR']
|
||||||
|
|
|
@ -33,7 +33,6 @@ def modelarts_process():
|
||||||
def eval_lstm():
|
def eval_lstm():
|
||||||
""" eval lstm """
|
""" eval lstm """
|
||||||
print('\neval.py config: \n', config)
|
print('\neval.py config: \n', config)
|
||||||
config.preprocess_path = os.path.join(config.glove_path, config.preprocess_path)
|
|
||||||
|
|
||||||
context.set_context(
|
context.set_context(
|
||||||
mode=context.GRAPH_MODE,
|
mode=context.GRAPH_MODE,
|
||||||
|
|
|
@ -33,7 +33,6 @@ def modelarts_process():
|
||||||
@moxing_wrapper(pre_process=modelarts_process)
|
@moxing_wrapper(pre_process=modelarts_process)
|
||||||
def export_lstm():
|
def export_lstm():
|
||||||
""" export lstm """
|
""" export lstm """
|
||||||
config.preprocess_path = os.path.join(config.glove_path, config.preprocess_path)
|
|
||||||
context.set_context(
|
context.set_context(
|
||||||
mode=context.GRAPH_MODE,
|
mode=context.GRAPH_MODE,
|
||||||
save_graphs=False,
|
save_graphs=False,
|
||||||
|
|
|
@ -23,7 +23,6 @@ from src.model_utils.config import config
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
config.preprocess_path = os.path.join(config.glove_path, config.preprocess_path)
|
|
||||||
dataset = lstm_create_dataset(config.preprocess_path, config.batch_size, training=False)
|
dataset = lstm_create_dataset(config.preprocess_path, config.batch_size, training=False)
|
||||||
img_path = os.path.join(config.result_path, "00_data")
|
img_path = os.path.join(config.result_path, "00_data")
|
||||||
os.makedirs(img_path)
|
os.makedirs(img_path)
|
||||||
|
|
|
@ -48,6 +48,6 @@ do
|
||||||
--distribute=true \
|
--distribute=true \
|
||||||
--device_num=$RANK_SIZE \
|
--device_num=$RANK_SIZE \
|
||||||
--device_id=$i --rank_id=$i \
|
--device_id=$i --rank_id=$i \
|
||||||
--preprocess=false \
|
--preprocess=true \
|
||||||
--preprocess_path=./preprocess > log.txt 2>&1 &
|
--preprocess_path=./preprocess > log.txt 2>&1 &
|
||||||
done
|
done
|
||||||
|
|
|
@ -39,6 +39,6 @@ CONFIG_FILE="${BASE_PATH}/../../config_ascend.yaml"
|
||||||
python ../../eval.py \
|
python ../../eval.py \
|
||||||
--config_path=$CONFIG_FILE \
|
--config_path=$CONFIG_FILE \
|
||||||
--device_target="Ascend" \
|
--device_target="Ascend" \
|
||||||
--preprocess=false \
|
--preprocess=true \
|
||||||
--glove_path=$PREPROCESS_DIR \
|
--glove_path=$PREPROCESS_DIR \
|
||||||
--ckpt_file=$CKPT_FILE > log.txt 2>&1 &
|
--ckpt_file=$CKPT_FILE > log.txt 2>&1 &
|
||||||
|
|
|
@ -37,6 +37,6 @@ python ../eval.py \
|
||||||
--device_target="CPU" \
|
--device_target="CPU" \
|
||||||
--aclimdb_path=$ACLIMDB_DIR \
|
--aclimdb_path=$ACLIMDB_DIR \
|
||||||
--glove_path=$GLOVE_DIR \
|
--glove_path=$GLOVE_DIR \
|
||||||
--preprocess=false \
|
--preprocess=true \
|
||||||
--preprocess_path=./preprocess \
|
--preprocess_path=./preprocess \
|
||||||
--ckpt_file=$CKPT_FILE > log.txt 2>&1 &
|
--ckpt_file=$CKPT_FILE > log.txt 2>&1 &
|
||||||
|
|
|
@ -40,6 +40,6 @@ python ../eval.py \
|
||||||
--device_target="GPU" \
|
--device_target="GPU" \
|
||||||
--aclimdb_path=$ACLIMDB_DIR \
|
--aclimdb_path=$ACLIMDB_DIR \
|
||||||
--glove_path=$GLOVE_DIR \
|
--glove_path=$GLOVE_DIR \
|
||||||
--preprocess=false \
|
--preprocess=true \
|
||||||
--preprocess_path=./preprocess \
|
--preprocess_path=./preprocess \
|
||||||
--ckpt_file=$CKPT_FILE > log.txt 2>&1 &
|
--ckpt_file=$CKPT_FILE > log.txt 2>&1 &
|
||||||
|
|
|
@ -40,5 +40,5 @@ python ../../train.py \
|
||||||
--device_target="Ascend" \
|
--device_target="Ascend" \
|
||||||
--aclimdb_path=$ACLIMDB_DIR \
|
--aclimdb_path=$ACLIMDB_DIR \
|
||||||
--glove_path=$GLOVE_DIR \
|
--glove_path=$GLOVE_DIR \
|
||||||
--preprocess=false \
|
--preprocess=true \
|
||||||
--preprocess_path=./preprocess > log.txt 2>&1 &
|
--preprocess_path=./preprocess > log.txt 2>&1 &
|
||||||
|
|
|
@ -36,5 +36,5 @@ python ../train.py \
|
||||||
--device_target="CPU" \
|
--device_target="CPU" \
|
||||||
--aclimdb_path=$ACLIMDB_DIR \
|
--aclimdb_path=$ACLIMDB_DIR \
|
||||||
--glove_path=$GLOVE_DIR \
|
--glove_path=$GLOVE_DIR \
|
||||||
--preprocess=false \
|
--preprocess=true \
|
||||||
--preprocess_path=./preprocess > log.txt 2>&1 &
|
--preprocess_path=./preprocess > log.txt 2>&1 &
|
||||||
|
|
|
@ -39,5 +39,5 @@ python ../train.py \
|
||||||
--device_target="GPU" \
|
--device_target="GPU" \
|
||||||
--aclimdb_path=$ACLIMDB_DIR \
|
--aclimdb_path=$ACLIMDB_DIR \
|
||||||
--glove_path=$GLOVE_DIR \
|
--glove_path=$GLOVE_DIR \
|
||||||
--preprocess=false \
|
--preprocess=true \
|
||||||
--preprocess_path=./preprocess > log.txt 2>&1 &
|
--preprocess_path=./preprocess > log.txt 2>&1 &
|
||||||
|
|
|
@ -39,7 +39,6 @@ def modelarts_pre_process():
|
||||||
def train_lstm():
|
def train_lstm():
|
||||||
""" train lstm """
|
""" train lstm """
|
||||||
print('\ntrain.py config: \n', config)
|
print('\ntrain.py config: \n', config)
|
||||||
config.preprocess_path = os.path.join(config.glove_path, config.preprocess_path)
|
|
||||||
|
|
||||||
_enable_graph_kernel = config.enable_graph_kernel == "true" and config.device_target == "GPU"
|
_enable_graph_kernel = config.enable_graph_kernel == "true" and config.device_target == "GPU"
|
||||||
context.set_context(
|
context.set_context(
|
||||||
|
@ -60,6 +59,9 @@ def train_lstm():
|
||||||
device_num=device_num)
|
device_num=device_num)
|
||||||
|
|
||||||
if config.preprocess == "true":
|
if config.preprocess == "true":
|
||||||
|
import shutil
|
||||||
|
if os.path.exists(config.preprocess_path):
|
||||||
|
shutil.rmtree(config.preprocess_path)
|
||||||
print("============== Starting Data Pre-processing ==============")
|
print("============== Starting Data Pre-processing ==============")
|
||||||
convert_to_mindrecord(config.embed_size, config.aclimdb_path, config.preprocess_path, config.glove_path)
|
convert_to_mindrecord(config.embed_size, config.aclimdb_path, config.preprocess_path, config.glove_path)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue