提交 c8704585 编写于 作者: W wuzewu

Add run config in demo

上级 c5bf379a
......@@ -35,6 +35,7 @@ parser.add_argument("--checkpoint_dir", type=str, default=None, help="Directory
parser.add_argument("--max_seq_len", type=int, default=512, help="Number of words of the longest seqence.")
parser.add_argument("--batch_size", type=int, default=1, help="Total examples' number in batch for training.")
parser.add_argument("--use_gpu", type=ast.literal_eval, default=False, help="Whether use GPU for finetuning, input should be True or False")
parser.add_argument("--use_pyreader", type=bool, default=False, help="Whether use pyreader to feed data.")
args = parser.parse_args()
# yapf: enable.
......@@ -69,6 +70,8 @@ if __name__ == '__main__':
# Setup runing config for PaddleHub Finetune API
config = hub.RunConfig(
use_data_parallel=False,
use_pyreader=args.use_pyreader,
use_cuda=args.use_gpu,
batch_size=args.batch_size,
enable_memory_optim=False,
......
......@@ -7,4 +7,6 @@ python -u sequence_label.py \
--num_epoch 3 \
--checkpoint_dir $CKPT_DIR \
--max_seq_len 256 \
--learning_rate 5e-5
--learning_rate 5e-5 \
--use_pyreader True \
--use_data_parallel True
......@@ -30,6 +30,8 @@ parser.add_argument("--warmup_proportion", type=float, default=0.0, help="Warmup
parser.add_argument("--max_seq_len", type=int, default=512, help="Number of words of the longest seqence.")
parser.add_argument("--batch_size", type=int, default=32, help="Total examples' number in batch for training.")
parser.add_argument("--checkpoint_dir", type=str, default=None, help="Directory to model checkpoint")
parser.add_argument("--use_pyreader", type=bool, default=False, help="Whether use pyreader to feed data.")
parser.add_argument("--use_data_parallel", type=bool, default=False, help="Whether use data parallel.")
args = parser.parse_args()
# yapf: enable.
......@@ -67,6 +69,8 @@ if __name__ == '__main__':
# Setup runing config for PaddleHub Finetune API
config = hub.RunConfig(
use_data_parallel=args.use_data_parallel,
use_pyreader=args.use_pyreader,
use_cuda=args.use_gpu,
num_epoch=args.num_epoch,
batch_size=args.batch_size,
......
......@@ -34,6 +34,7 @@ parser.add_argument("--checkpoint_dir", type=str, default=None, help="Directory
parser.add_argument("--batch_size", type=int, default=1, help="Total examples' number in batch for training.")
parser.add_argument("--max_seq_len", type=int, default=512, help="Number of words of the longest seqence.")
parser.add_argument("--use_gpu", type=ast.literal_eval, default=False, help="Whether use GPU for finetuning, input should be True or False")
parser.add_argument("--use_pyreader", type=bool, default=False, help="Whether use pyreader to feed data.")
args = parser.parse_args()
# yapf: enable.
......@@ -68,6 +69,8 @@ if __name__ == '__main__':
# Setup runing config for PaddleHub Finetune API
config = hub.RunConfig(
use_data_parallel=False,
use_pyreader=args.use_pyreader,
use_cuda=args.use_gpu,
batch_size=args.batch_size,
enable_memory_optim=False,
......
export CUDA_VISIBLE_DEVICES=1
export CUDA_VISIBLE_DEVICES=0
# User can select chnsenticorp, nlpcc_dbqa, lcqmc for different task
DATASET="chnsenticorp"
......@@ -16,4 +16,6 @@ python -u text_classifier.py \
--learning_rate=5e-5 \
--weight_decay=0.01 \
--max_seq_len=128 \
--num_epoch=3
--num_epoch=3 \
--use_pyreader=True \
--use_data_parallel=True \
......@@ -32,6 +32,8 @@ parser.add_argument("--data_dir", type=str, default=None, help="Path to training
parser.add_argument("--checkpoint_dir", type=str, default=None, help="Directory to model checkpoint")
parser.add_argument("--max_seq_len", type=int, default=512, help="Number of words of the longest seqence.")
parser.add_argument("--batch_size", type=int, default=32, help="Total examples' number in batch for training.")
parser.add_argument("--use_pyreader", type=bool, default=False, help="Whether use pyreader to feed data.")
parser.add_argument("--use_data_parallel", type=bool, default=False, help="Whether use data parallel.")
args = parser.parse_args()
# yapf: enable.
......@@ -80,6 +82,8 @@ if __name__ == '__main__':
# Setup runing config for PaddleHub Finetune API
config = hub.RunConfig(
use_data_parallel=args.use_data_parallel,
use_pyreader=args.use_pyreader,
use_cuda=args.use_gpu,
num_epoch=args.num_epoch,
batch_size=args.batch_size,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册