#!/bin/bash set -x config=${1:-"./config.yaml"} unset http_proxy https_proxy function parse_yaml { local prefix=$2 local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034') sed -ne "s|^\($s\):|\1|" \ -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | awk -F$fs '{ indent = length($1)/2; vname[indent] = $2; for (i in vname) {if (i > indent) {delete vname[i]}} if (length($3) > 0) { vn=""; for (i=0; i $BASE/pserver.$i.log & echo $! >> job_id done sleep 3s for((j=0;j<${PADDLE_TRAINERS_NUM};j++)) do echo "start ps work: ${j}" TRAINING_ROLE="TRAINER" PADDLE_TRAINER_ID=${j} python ./train.py --conf $config TRAINING_ROLE="TRAINER" PADDLE_TRAINER_ID=${j} python ./infer.py --conf $config done } collective_local_train(){ echo `which python` python -m paddle.distributed.launch node_classification_train.py --conf $config python -m paddle.distributed.launch node_classification_infer.py --conf $config } eval $(parse_yaml $config) python ./preprocessing/dump_graph.py -i $train_data -g $graph_data -o $graph_work_path \ --encoding $encoding -l $max_seqlen --vocab_file $ernie_vocab_file --task $task if [[ $learner_type == "cpu" ]];then transpiler_local_train fi if [[ $learner_type == "gpu" ]];then collective_local_train fi