未验证 提交 f5e4e123 编写于 作者: P pkpk 提交者: GitHub

Merge pull request #71 from xyzhou-puck/master

update bert-leveldb
#!/bin/bash #!/bin/bash
BERT_BASE_PATH="./data/pretrained_models/uncased_L-12_H-768_A-12/" BERT_BASE_PATH="./bert_uncased_L-12_H-768_A-12/"
TASK_NAME='MNLI'
DATA_PATH="./data/glue_data/MNLI/" DATA_PATH="./data/glue_data/MNLI/"
CKPT_PATH="./data/saved_model/mnli_models" CKPT_PATH="./data/saved_model/mnli_models"
export CUDA_VISIBLE_DEVICES=1 export CUDA_VISIBLE_DEVICES=0
# start fine-tuning # start fine-tuning
python3.7 bert_classifier.py\ python3.7 bert_classifier.py\
...@@ -12,7 +11,6 @@ python3.7 bert_classifier.py\ ...@@ -12,7 +11,6 @@ python3.7 bert_classifier.py\
--do_train true \ --do_train true \
--do_test true \ --do_test true \
--batch_size 64 \ --batch_size 64 \
--init_pretraining_params ${BERT_BASE_PATH}/dygraph_params/ \
--data_dir ${DATA_PATH} \ --data_dir ${DATA_PATH} \
--vocab_path ${BERT_BASE_PATH}/vocab.txt \ --vocab_path ${BERT_BASE_PATH}/vocab.txt \
--checkpoints ${CKPT_PATH} \ --checkpoints ${CKPT_PATH} \
......
...@@ -159,7 +159,7 @@ def main(): ...@@ -159,7 +159,7 @@ def main():
labels, labels,
device=device) device=device)
cls_model.bert_layer.load("./bert_small", reset_optimizer=True) cls_model.bert_layer.load("./bert_uncased_L-12_H-768_A-12/bert", reset_optimizer=True)
# do train # do train
cls_model.fit(train_data=train_dataloader.dataloader, cls_model.fit(train_data=train_dataloader.dataloader,
......
0. python3.7 -m pip install leveldb
1. download data: wget https://paddle-hapi.bj.bcebos.com/data/bert_data.tar.gz
2. unzip data: tar -zvxf bert_data.tar.gz
3. download pretrained parameters: wget https://paddle-hapi.bj.bcebos.com/models/bert_uncased_L-12_H-768_A-12.tar.gz
4. unzip pretrained parameters: tar -zvxf bert_uncased_L-12_H-768_A-12.tar.gz
4. bash run_classifier_single_gpu.sh
#!/bin/bash #!/bin/bash
BERT_BASE_PATH="./data/pretrained_models/uncased_L-12_H-768_A-12/" BERT_BASE_PATH="./bert_uncased_L-12_H-768_A-12/"
TASK_NAME='MNLI'
DATA_PATH="./data/glue_data/MNLI/" DATA_PATH="./data/glue_data/MNLI/"
CKPT_PATH="./data/saved_model/mnli_models" CKPT_PATH="./data/saved_model/mnli_models"
# start fine-tuning # start fine-tuning
python3.7 -m paddle.distributed.launch --started_port 8899 --selected_gpus=1,2,3 bert_classifier.py\ python3.7 -m paddle.distributed.launch --started_port 8899 --selected_gpus=0,1,2,3 bert_classifier.py\
--use_cuda true \ --use_cuda true \
--do_train true \ --do_train true \
--do_test true \ --do_test true \
--batch_size 64 \ --batch_size 64 \
--init_pretraining_params ${BERT_BASE_PATH}/dygraph_params/ \
--data_dir ${DATA_PATH} \ --data_dir ${DATA_PATH} \
--vocab_path ${BERT_BASE_PATH}/vocab.txt \ --vocab_path ${BERT_BASE_PATH}/vocab.txt \
--checkpoints ${CKPT_PATH} \ --checkpoints ${CKPT_PATH} \
......
#!/bin/bash #!/bin/bash
BERT_BASE_PATH="./data/pretrained_models/uncased_L-12_H-768_A-12/" BERT_BASE_PATH="./bert_uncased_L-12_H-768_A-12/"
TASK_NAME='MNLI'
DATA_PATH="./data/glue_data/MNLI/" DATA_PATH="./data/glue_data/MNLI/"
CKPT_PATH="./data/saved_model/mnli_models" CKPT_PATH="./data/saved_model/mnli_models"
...@@ -12,7 +11,6 @@ python3.7 bert_classifier.py\ ...@@ -12,7 +11,6 @@ python3.7 bert_classifier.py\
--do_train true \ --do_train true \
--do_test true \ --do_test true \
--batch_size 64 \ --batch_size 64 \
--init_pretraining_params ${BERT_BASE_PATH}/dygraph_params/ \
--data_dir ${DATA_PATH} \ --data_dir ${DATA_PATH} \
--vocab_path ${BERT_BASE_PATH}/vocab.txt \ --vocab_path ${BERT_BASE_PATH}/vocab.txt \
--checkpoints ${CKPT_PATH} \ --checkpoints ${CKPT_PATH} \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册