-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from xinghai-sun/refine_cloud
Bug fix and refine cloud training for DS2
- Loading branch information
Showing
7 changed files
with
123 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"""Set up paths for DS2""" | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
import os.path | ||
import sys | ||
|
||
|
||
def add_path(path): | ||
if path not in sys.path: | ||
sys.path.insert(0, path) | ||
|
||
|
||
this_dir = os.path.dirname(__file__) | ||
proj_path = os.path.join(this_dir, '..') | ||
add_path(proj_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,36 @@ | ||
DATA_PATH=$1 | ||
MODEL_PATH=$2 | ||
NUM_CPU=$3 | ||
NUM_GPU=$4 | ||
IS_LOCAL=$5 | ||
|
||
TRAIN_MANI=${DATA_PATH}/cloud.train.manifest | ||
DEV_MANI=${DATA_PATH}/cloud.test.manifest | ||
DEV_MANI=${DATA_PATH}/cloud.dev.manifest | ||
TRAIN_TAR=${DATA_PATH}/cloud.train.tar | ||
DEV_TAR=${DATA_PATH}/cloud.test.tar | ||
DEV_TAR=${DATA_PATH}/cloud.dev.tar | ||
VOCAB_PATH=${DATA_PATH}/vocab.txt | ||
MEAN_STD_FILE=${DATA_PATH}/mean_std.npz | ||
|
||
# split train data for each pcloud node | ||
python ./cloud/split_data.py \ | ||
--in_manifest_path=$TRAIN_MANI \ | ||
--data_tar_path=$TRAIN_TAR \ | ||
--out_manifest_path='./local.train.manifest' | ||
--in_manifest_path=${TRAIN_MANI} \ | ||
--data_tar_path=${TRAIN_TAR} \ | ||
--out_manifest_path='/local.train.manifest' | ||
|
||
# split dev data for each pcloud node | ||
python ./cloud/split_data.py \ | ||
--in_manifest_path=$DEV_MANI \ | ||
--data_tar_path=$DEV_TAR \ | ||
--out_manifest_path='./local.test.manifest' | ||
--in_manifest_path=${DEV_MANI} \ | ||
--data_tar_path=${DEV_TAR} \ | ||
--out_manifest_path='/local.dev.manifest' | ||
|
||
# run train | ||
python train.py \ | ||
--use_gpu=1 \ | ||
--mean_std_filepath=$MEAN_STD_FILE \ | ||
--train_manifest_path='./local.train.manifest' \ | ||
--dev_manifest_path='./local.test.manifest' \ | ||
--vocab_filepath=$VOCAB_PATH \ | ||
--trainer_count=${NUM_GPU} \ | ||
--num_threads_data=${NUM_CPU} \ | ||
--is_local=${IS_LOCAL} \ | ||
--mean_std_filepath=${MEAN_STD_FILE} \ | ||
--train_manifest_path='/local.train.manifest' \ | ||
--dev_manifest_path='/local.dev.manifest' \ | ||
--vocab_filepath=${VOCAB_PATH} \ | ||
--output_model_dir=${MODEL_PATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters