Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP i…
Browse files Browse the repository at this point in the history
…nto support-qat
  • Loading branch information
LiuChiachi committed Oct 17, 2022
2 parents 18fac4a + f43cfd0 commit fb219bc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
9 changes: 8 additions & 1 deletion model_zoo/ernie-layout/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Recent years have witnessed the rise and success of pre-training techniques in v
- Invoice VQA

<div align="center">
<img src=https://user-images.githubusercontent.com/40840292/195610223-f8e22405-1a5e-4a19-a7db-49bd13f2248d.png height=350 width=1000 hspace='10'/>
<img src=https://user-images.githubusercontent.com/40840292/195809253-985c4a7b-4675-4262-a4a6-fcccede9ff66.png height=350 width=1000 hspace='10'/>
</div>

- Poster VQA
Expand All @@ -74,6 +74,13 @@ Recent years have witnessed the rise and success of pre-training techniques in v
</div>


- Exam Paper VQA

<div align="center">
<img src=https://user-images.githubusercontent.com/40840292/195823294-d891d95a-2ef8-4519-be59-0fedb96c00de.png height=700 width=1000 hspace='10'/>
</div>


- English invoice VQA by multilingual(CH, EN, JP, Th, ES, RUS) prompt

<div align="center">
Expand Down
10 changes: 9 additions & 1 deletion model_zoo/ernie-layout/README_ch.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ERNIE-Layout以文心文本大模型ERNIE为底座,融合文本、图像、布
- 发票抽取问答

<div align="center">
<img src=https://user-images.githubusercontent.com/40840292/195610223-f8e22405-1a5e-4a19-a7db-49bd13f2248d.png height=350 width=1000 hspace='10'/>
<img src=https://user-images.githubusercontent.com/40840292/195809253-985c4a7b-4675-4262-a4a6-fcccede9ff66.png height=350 width=1000 hspace='10'/>
</div>

- 海报抽取问答
Expand All @@ -72,6 +72,14 @@ ERNIE-Layout以文心文本大模型ERNIE为底座,融合文本、图像、布
<img src=https://user-images.githubusercontent.com/40840292/195610692-8367f1c8-32c2-4b5d-9514-a149795cf609.png height=350 width=1000 hspace='10'/>
</div>


- 试卷抽取问答

<div align="center">
<img src=https://user-images.githubusercontent.com/40840292/195823294-d891d95a-2ef8-4519-be59-0fedb96c00de.png height=700 width=1000 hspace='10'/>
</div>


- 英文票据多语种(中、英、日、泰、西班牙、俄语)抽取问答

<div align="center">
Expand Down
7 changes: 3 additions & 4 deletions paddlenlp/transformers/ofa_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,9 @@ def compute_neuron_head_importance(model,
if "labels" in batch:
labels = batch.pop("labels")
# For token cls tasks
if "length" in batch:
batch.pop("length")
if "seq_len" in batch:
batch.pop("seq_len")
for key in ("length", "seq_len"):
if key in batch:
batch.pop(key)
elif "start_positions" in batch and "end_positions" in batch:
labels = (batch.pop("start_positions"), batch.pop("end_positions"))
else:
Expand Down
5 changes: 3 additions & 2 deletions tests/test_tipc/benchmark_train.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ FILENAME=$new_filename
MODE=$2
PARAMS=$3
REST_ARGS=$4
# bash test_tipc/benchmark_train.sh test_tipc/configs/transformer/base/train_infer_python.txt benchmark_train to_static
# bash test_tipc/benchmark_train.sh test_tipc/configs/transformer/base/train_infer_python.txt benchmark_train dynamicTostatic_bs64_fp32_DP_N1C1


to_static=""
# parse "to_static" options and modify trainer into "to_static_trainer"
if [ $REST_ARGS = "to_static" ] || [ $PARAMS = "to_static" ] ;then
if [[ $PARAMS =~ "dynamicTostatic" ]] ;then
to_static="d2sT_"
sed -i 's/trainer:norm_train/trainer:to_static_train/g' $FILENAME
# clear PARAM contents
Expand Down
4 changes: 3 additions & 1 deletion tests/test_tipc/test_train_inference_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ else
if [ ${#gpu} -ge 2 ];then
cat ${WORK_PATH}/log/workerlog.0 > ${_train_log}
fi
eval "cat ${_train_log}"
if [ ${#gpu} -le 2 ];then # train with cpu or single gpu
eval "cat ${_train_log}"
fi
status_check ${last_status} "${cmd}" "${status_log}" "${model_name}" "${_train_log}"

set_eval_pretrain=$(func_set_params "${pretrain_model_key}" "${save_log}/${train_model_name}")
Expand Down

0 comments on commit fb219bc

Please sign in to comment.