Compare commits

..

5429 Commits

Author SHA1 Message Date
Liujie0926
3f87dac9b7 Delete .github/workflows/distribute-v100.yml 2026-05-23 10:54:28 +08:00
Liujie0926
be4f19628f Delete .github/workflows/distribute-a100.yml 2026-05-23 10:53:53 +08:00
xingmingyyj
587a5cdf97 fix load ema and model_meta path (#11203) 2025-12-17 17:19:22 +08:00
liufengwei0103
32b9a2e257 decouple sharding io and non zcc (#11201) 2025-12-16 19:12:37 +08:00
liufengwei0103
51f73a5104 disable only sharding opt in save stage (#11200) 2025-12-16 10:36:29 +08:00
baoqiwen
2ac85997c2 Fix loss for Align reduce precision with PyTorch 2.9.1. (#11199) 2025-12-15 15:45:57 +08:00
xingmingyyj
dcbdeaa819 change_save_meta_in_zcc_crossponding_to_paddle and fix flags (#11198)
* change_save_meta_in_zcc_crossponding_to_paddle

* delete

* fix

* change_save_meta_in_zcc_crossponding_to_paddle and fix args

* fix deadcode

---------

Co-authored-by: liufengwei02 <liufengwei02@baidu.com>
2025-12-13 17:03:13 +08:00
baoqiwen
7ab35ce94e Align reduce precision with PyTorch 2.9.1, disable precision checks. (#11195) 2025-12-12 17:16:21 +08:00
xingmingyyj
bc08aeec91 ban ckpt_converter test (#11194) 2025-12-12 14:15:15 +08:00
liufengwei0103
f8d0829e02 fix zcc error in eb5 (#11193) 2025-12-12 11:08:47 +08:00
xingmingyyj
b0276d735a 【FlexCheckpoint】adapter flex checkpoint (#11188)
* adapter flex checkpoint

* opt bf16 save

* fix multi moe_sharding_group load safetensors

* fix
2025-12-08 23:07:15 +08:00
liufengwei0103
fa007c8f85 cp add_fc_into_zcc to nlp (#11187) 2025-12-05 21:56:54 +08:00
xingmingyyj
c8f141476c add config memory_growth_threshold for save hf (#11183) 2025-11-28 19:37:10 +08:00
xingmingyyj
e4d28de5a8 【FlexCheckpoint】support save hf (#11180)
* support save hf

* fix
2025-11-26 23:28:16 +08:00
sneaxiy
53b85cbb34 fix EMA (#11177) 2025-11-18 12:10:34 +08:00
zhengshengning
9904cfc78e fix_int64_to_int (#11175) 2025-11-14 14:03:12 +08:00
sneaxiy
c07e0c8d3a Add Non ZCC EMA callback (#11173) 2025-11-13 10:12:55 +08:00
Wennie396
7c82a262f2 fix opt chunk offload (#11167) 2025-11-12 21:06:30 +08:00
Weiguo Zhu
61856820c3 fix model save for moe_sharding (#11162) 2025-11-12 18:50:34 +08:00
Zhuoqun Li
4eef1079f5 [Embedding] Expand training and shortgpt_prune code to support more model (#11168)
* final update

* expand training and shortgpt_prune code to support more model
2025-11-12 18:49:39 +08:00
zhengshengning
d38f3d696e big tensor: tokens_unzip_gather (#11172) 2025-11-12 11:18:15 +08:00
wanghuancoder
e68b135bfa fix eb5 big tensor bug (#11169)
* fix eb5 big tensor bug

* refine

* refine
2025-11-11 15:31:33 +08:00
Shing
6ac0402875 BugFix: qwen pp cannot send bool when using fuse loss (#11156)
* feat(model): add support for Qwen model in RL PipelineParallel

* feat(model): add support for QwenMoe model in RL PipelineParallel

* feat(model): add support for QwenMoe model in RL PipelineParallel

* BugFix: qwen model sequence parallel can not get batch size

* BugFix: qwen pp cannot send bool when using fuse loss
2025-11-07 20:39:41 +08:00
sneaxiy
6ede865d0f fix zcc ema GPU alloc bug (#11165) 2025-11-07 17:03:52 +08:00
Siyu Zhao
29f97bb461 TARE提交 (#11151)
Co-authored-by: zsy <zsy03260058@163.com>
2025-11-05 14:04:57 +08:00
a31413510
10014d8f0a Update run_finetune.py (#11159) 2025-11-03 21:51:38 +08:00
hsz06
e73341efa4 [codestyle] Modular convert tools (#11129)
* new file:   paddlenlp/transformers/convert/doc/README.md
	new file:   paddlenlp/transformers/convert/doc/llama_analysis.md
	new file:   paddlenlp/transformers/convert/doc/process.png
	new file:   paddlenlp/transformers/convert/doc/qwen2_analysis.md
	new file:   "paddlenlp/transformers/convert/doc/\351\241\271\347\233\256\346\212\245\345\221\212\357\274\232\351\243\236\346\241\250PaddleNLP-\345\211\215\346\262\277\346\250\241\345\236\213\346\250\241\345\235\227\345\214\226\350\256\276\350\256\241.md"
	new file:   paddlenlp/transformers/convert/main.py
	new file:   paddlenlp/transformers/convert/test_ability/test_base/test_modeling.py
	new file:   paddlenlp/transformers/convert/test_ability/test_paralle/compare_torch_with_paddle.py
	new file:   paddlenlp/transformers/convert/until/collect_import_modeling.py
	new file:   paddlenlp/transformers/convert/until/rename_identifiers.py
	new file:   paddlenlp/transformers/convert/until/rewrite_child_classes.py
	modified:   paddlenlp/transformers/qwen2/configuration.py
	new file:   paddlenlp/transformers/qwen2/modeling_qwen2.py
	new file:   paddlenlp/transformers/qwen2/modular_qwen2.py

* modified:   paddlenlp/transformers/qwen2/modeling_qwen2.py
	deleted:    paddlenlp/transformers/convert/doc/README.md
	deleted:    paddlenlp/transformers/convert/doc/llama_analysis.md
	deleted:    paddlenlp/transformers/convert/doc/process.png
	deleted:    paddlenlp/transformers/convert/doc/qwen2_analysis.md
	deleted:    "paddlenlp/transformers/convert/doc/\351\241\271\347\233\256\346\212\245\345\221\212\357\274\232\351\243\236\346\241\250PaddleNLP-\345\211\215\346\262\277\346\250\241\345\236\213\346\250\241\345\235\227\345\214\226\350\256\276\350\256\241.md"
	deleted:    paddlenlp/transformers/convert/main.py
	deleted:    paddlenlp/transformers/convert/test_ability/test_base/test_modeling.py
	deleted:    paddlenlp/transformers/convert/test_ability/test_paralle/compare_torch_with_paddle.py
	deleted:    paddlenlp/transformers/convert/until/collect_import_modeling.py
	deleted:    paddlenlp/transformers/convert/until/rename_identifiers.py
	deleted:    paddlenlp/transformers/convert/until/rewrite_child_classes.py
	deleted:    paddlenlp/transformers/qwen2/__init__.py
	deleted:    paddlenlp/transformers/qwen2/configuration.py
	deleted:    paddlenlp/transformers/qwen2/modeling.py
	deleted:    paddlenlp/transformers/qwen2/modeling_pp.py
	deleted:    paddlenlp/transformers/qwen2/modeling_qwen2.py
	deleted:    paddlenlp/transformers/qwen2/modular_qwen2.py
	deleted:    paddlenlp/transformers/qwen2/tokenizer.py
	deleted:    paddlenlp/transformers/qwen2/tokenizer_fast.py
	scripts/codestyle/convert/

* renamed:    paddlenlp/transformers/convert/doc/README.md -> scripts/codestyle/convert/doc/README.md
	renamed:    paddlenlp/transformers/convert/doc/llama_analysis.md -> scripts/codestyle/convert/doc/llama_analysis.md
	renamed:    paddlenlp/transformers/convert/doc/process.png -> scripts/codestyle/convert/doc/process.png
	renamed:    paddlenlp/transformers/convert/doc/qwen2_analysis.md -> scripts/codestyle/convert/doc/qwen2_analysis.md
	renamed:    "paddlenlp/transformers/convert/doc/\351\241\271\347\233\256\346\212\245\345\221\212\357\274\232\351\243\236\346\241\250PaddleNLP-\345\211\215\346\262\277\346\250\241\345\236\213\346\250\241\345\235\227\345\214\226\350\256\276\350\256\241.md" -> "scripts/codestyle/convert/doc/\351\241\271\347\233\256\346\212\245\345\221\212\357\274\232\351\243\236\346\241\250PaddleNLP-\345\211\215\346\262\277\346\250\241\345\236\213\346\250\241\345\235\227\345\214\226\350\256\276\350\256\241.md"
	renamed:    paddlenlp/transformers/convert/main.py -> scripts/codestyle/convert/main.py
	renamed:    paddlenlp/transformers/convert/test_ability/test_base/test_modeling.py -> scripts/codestyle/convert/test_ability/test_base/test_modeling.py
	renamed:    paddlenlp/transformers/convert/test_ability/test_paralle/compare_torch_with_paddle.py -> scripts/codestyle/convert/test_ability/test_paralle/compare_torch_with_paddle.py
	renamed:    paddlenlp/transformers/convert/until/collect_import_modeling.py -> scripts/codestyle/convert/until/collect_import_modeling.py
	renamed:    paddlenlp/transformers/convert/until/rename_identifiers.py -> scripts/codestyle/convert/until/rename_identifiers.py
	renamed:    paddlenlp/transformers/convert/until/rewrite_child_classes.py -> scripts/codestyle/convert/until/rewrite_child_classes.py
	renamed:    paddlenlp/transformers/qwen2/modeling_qwen2.py -> scripts/codestyle/qwen2/modeling_qwen2.py
	renamed:    paddlenlp/transformers/qwen2/modular_qwen2.py -> scripts/codestyle/qwen2/modular_qwen2.py

* modified:   scripts/codestyle/qwen2/modeling_qwen2.py

* modified:   paddlenlp/transformers/qwen2/configuration.py
	new file:   scripts/codestyle/convert/example/qwen2/__init__.py
	new file:   scripts/codestyle/convert/example/qwen2/configuration.py
	new file:   scripts/codestyle/convert/example/qwen2/modeling.py
	new file:   scripts/codestyle/convert/example/qwen2/modeling_pp.py
	renamed:    scripts/codestyle/qwen2/modeling_qwen2.py -> scripts/codestyle/convert/example/qwen2/modeling_qwen2.py
	renamed:    scripts/codestyle/qwen2/modular_qwen2.py -> scripts/codestyle/convert/example/qwen2/modular_qwen2.py
	new file:   scripts/codestyle/convert/example/qwen2/tokenizer.py
	new file:   scripts/codestyle/convert/example/qwen2/tokenizer_fast.py

* modified:   paddlenlp/transformers/qwen2/configuration.py

* modified:   scripts/codestyle/convert/doc/README.md
	deleted:    scripts/codestyle/convert/doc/process.png
2025-10-30 15:44:26 +08:00
aiyinyuedejustin
1bcf877c7f LoRA: add lora target modules support for qwen2 and qwen3 dense model when using fused keys (#11153) 2025-10-27 14:58:28 +08:00
Shing
c621f0cfa3 BugFix: qwen model sequence parallel can not get batch size (#11147)
* feat(model): add support for Qwen model in RL PipelineParallel

* feat(model): add support for QwenMoe model in RL PipelineParallel

* feat(model): add support for QwenMoe model in RL PipelineParallel

* BugFix: qwen model sequence parallel can not get batch size
2025-10-24 16:57:09 +08:00
Gu Shiwei
3f7eafc774 paddleformers PR check (#11150)
* paddleformers PR check

* echo line

* -x
2025-10-23 17:09:34 +08:00
Pioneer-wxh
51787ba815 commit dislora (#11122)
* commit dislora

* add DisLoRATrainer

* “readme文件修改”

* Delete docs/zh/llm/benchmark/rl/README.md
2025-10-22 14:52:10 +08:00
Shing
a4d16faf33 BugFix: Support for Qwen Model PipelineParallel Training in RLInfra (#11143)
* feat(model): add support for Qwen model in RL PipelineParallel

* feat(model): add support for QwenMoe model in RL PipelineParallel

* feat(model): add support for QwenMoe model in RL PipelineParallel
2025-10-22 10:58:50 +08:00
Xuxinyi
7d30769994 [AutoParallel]update code (#11145)
* update_code

* update_code
2025-10-21 20:52:46 +08:00
yujun
2f78db69b0 Upgrad swandlab code (#11105)
* Upgrad swandlab code

* add SWANLAB_EXP_NAME env
2025-10-16 20:43:18 +08:00
Shing
5dd2855a52 feat(model): add support for Qwen model in RL PipelineParallel (#11135) 2025-10-11 10:35:33 +08:00
ZhenxingLi
119ed11904 [Auto-Paralllel] fix intermediate api use1 (#11125)
* fix intermediate api use

* update
2025-09-30 15:39:42 +08:00
zhongtianyun
3c51eda5d6 [Embedding] Fix readme and env for contrastive_training (#11108)
modified:   csrc/gpu/unittest/test_get_padding_offset_v2.py
	modified:   paddlenlp/experimental/transformers/llama/modeling.py
	modified:   slm/pipelines/examples/contrastive_training/README.md
	modified:   slm/pipelines/examples/contrastive_training/evaluation/eval_mteb.py
	modified:   slm/pipelines/examples/contrastive_training/evaluation/eval_mteb.sh
	modified:   slm/pipelines/examples/contrastive_training/evaluation/modelling_quant.py
	modified:   slm/pipelines/examples/contrastive_training/shortgpt_prune.py
2025-09-29 10:53:53 +08:00
Liujie0926
937b766f21 [CI]Update loss (#11115)
Update loss
2025-09-25 15:21:34 +08:00
Tianyu Zheng
3432f69e07 Pr adapt flex checkpoint (#11065)
* adapt_flex_checkpoint

* Consistently use save_checkpoint_format and load_checkpoint_format

* fix the ckpt_format adapt

* delete the duplicate code

* delete safetensor
2025-09-25 14:16:35 +08:00
Liujie0926
586f5fb544 [CI]Update loss for Paddle#75367 (#11106)
* update loss_base

* update

* skip llama_dygraph_auto_bs8_fp16_DP2-MP2-PP2_hybrid_pp run dygraph auto hybrid pp in align mode

* fix

* fix

* fix
2025-09-24 16:21:02 +08:00
zhangyuqin1998
af07de0b01 [Distributed] refine training_pipeline_step to avoid memory leaks (#11103) 2025-09-23 14:59:25 +08:00
Gu Shiwei
b30ad6ad2b fix approval bypass (#11104)
* fix

* fix

* fix

* fix

* fix
2025-09-23 10:21:16 +08:00
co63oc
615a7c96ed fix typos (#11041) 2025-09-22 17:51:50 +08:00
Tianyu Zheng
03bc1a0063 [AutoParallel] GradientClipByGlobalNorm: Add align mode branch in autotrainer (#10960)
* Add test branch for align mode

* fix test bug

* rerun CI

* add the warning to warn the max_grad_norm is not 0.0
2025-09-22 16:30:31 +08:00
Liujie0926
b6f214efae [CI] Update loss_check (#11090)
* fix loss_check

* fix
2025-09-15 15:44:58 +08:00
Wennie396
e28c816070 Add chunk offload optimizer (#11084)
* add chunk offload optimizer

* fix get offload_opt_buffer_size arg
2025-09-15 11:19:03 +08:00
Zhuoqun Li
efd7d26434 [Embedding] Add qwen3 and update readme (#11034)
* add qwen3 and update readme

* update readme

* update readme

* update readme
2025-09-11 10:20:34 +08:00
sneaxiy
148206ea20 Make sharding_first by default (#11059)
* make sharding_first by default

* update run_ci.sh

* Update V100 baseline

* Update A100 baselines

* Revert "Update A100 baselines"

This reverts commit c682b2752a83b0e532a15a6b6f90ce08e386e447.

* Revert "Update V100 baseline"

This reverts commit 1ca17b7963d1912bc98c27a5ec1a4bfe0bf8abda.

* fix topo in CI cases

* fix JSON format error
2025-09-08 10:49:10 +08:00
Gu Shiwei
462597fc1a add bypass (#11077)
* add bypass

* add bypass
2025-09-08 10:23:53 +08:00
Ferrebo
85295b6955 [fea] support dp-moe for zcc and global_expert_id (#11050)
* support dp-moe for zcc (#10539)

* [fix] zcc ema under non-pp when `acc=1`

* zcc-ema fix load-state-dict when dp-moe

* [BugFix] shard-reshard下dp间is_matched行为不一致,以dp0为准 (#9404)

---------

Co-authored-by: Ferrebo <kebo01@baidu.com>

* [mod] Sharding IO: Added DP-Meta gather for MoE

---------

Co-authored-by: Meiyim <chenxuyi@baidu.com>
2025-09-08 09:56:41 +08:00
sneaxiy
509f005838 [Cherry-pick]Support to load sharded EMA checkpoint (#11075)
* support load sharded EMA checkpoints

* support_ema_loading_no_pdopt

* polish code
2025-09-08 09:55:39 +08:00
Junyuan Shang
20a584fb1a [cherry-pick] add zcc_ema_loss_threshold args to avoid merging models with loss spike (#11079) 2025-09-06 20:38:35 +08:00
Tian
68645cce6b Cherry-pick useful PRs from fleety (#11051)
* [LLM] fix normal sl (#10609)

* [LLM] support disable monkey patch (#10617)

* [LLM] use safer grad sync method when enabling sp (#10714)

* [RL] disable aistudio download and fix qwen bug (#10819)

* [RL] fix qwen load when fuse is enabled and modify gate presion to fp32 (#10842)

* 修复qwen3moe的一系列报错(justin) (#10818)

* [LLM] zcc support rng states (#10430) (#10485)

* [DLTP-85730] optimize save cost for zcc

* [LLM] fix moe using on tensor parallelism

* cherry-pick useful PRs from fleety and fix some typos

---------

Co-authored-by: aiyinyuedejustin <114650502+aiyinyuedejustin@users.noreply.github.com>
2025-09-05 23:21:13 +08:00
weiweisss
e050fd8f93 [PEFT]:nola (#10747)
* 'nola提交'

* Update test_nola.py

* solve conflicts
2025-09-05 17:24:02 +08:00
Liebele
e298ba42f6 LoriKiT (#9776)
* add linchain

* resolve confilct

* add linchain test

* resolve pre-commit

* resolve ci problem and add description.

---------

Co-authored-by: moge <lydo_0826@outlook.com>
2025-09-04 20:44:52 +08:00
XiangzheWang
19a585b507 use key-value to init dataloader (#11058) 2025-09-04 19:18:45 +08:00
Kunbo Ding
13790da6d0 Unified FuseLoss (#11057) 2025-09-04 16:52:05 +08:00
gongel
bad78900ba add more args to Qwen2ForCausalLM (#11068) 2025-09-04 14:24:49 +08:00
blacksheep-Aristotle
bbb8e004d3 token_dispatcher support expert_num 64 (#11066) 2025-09-04 13:23:32 +08:00
risemeup1
96a39777e3 fix custom op compile bug (#11064)
* fix bug

* Fix function calls in setup.py

---------

Co-authored-by: liym27 <33742067+liym27@users.noreply.github.com>
Co-authored-by: YUNSHEN XIE <1084314248@qq.com>
2025-09-04 11:05:56 +08:00
Yichen Zhang
1060ed47e7 [Cherry-pick] Cherry-pick hybrid-expert parallel related PRs from fleety (#11052)
* cherry-pick #10501

* cherry-pick #10526

* cherry-pick #10545
2025-09-03 17:27:47 +08:00
sneaxiy
206403950e Cherry-pick PRs from incubate/paddlenlp_fleety (#11049)
* add offload opt util (#10607)

* fix offload optimizer (#10608)

* fix sharding reshard bug (#10613)

* reset ema (#10790)

* Move fused_quanted_ops and token_dispatcher_utils to FleetY (#10803)

* move setup_fp8.py (#10820)

* Add tokens_zip_unique_add_subbatch and merge_subbatch_cast ops (#10822)

* add tokens_zip_unique_add_subbatch and merge_subbatch_cast ops

* enhance ut

* enhance ut again

* remove duplicate codes

* enhance ut again

* Sharding reshard supports mismatch parameter name (#10479)

* Sharding Reshard Supports N -> 1 (#10532)

* cherry-pick https://github.com/PaddlePaddle/PaddleNLP/pull/10531

* support tpdp-ep sharding reshard (#10568)

* fix typo

* revert sharding_first
2025-09-03 15:44:15 +08:00
zhangyuqin1998
87515b4a33 Support param and moment sync for pp (#11046) 2025-09-03 14:10:26 +08:00
ShenLiang
9c3ae1dbe6 [Cherry-pick] Cherry-pick from fleety (#11047)
* add timer log in trainer (#10880)

* add layer norm backward (#10886)

* add memory usage message in tensorboard (#10887)
2025-09-03 14:02:12 +08:00
umiswing
da9ddf7783 [feat] add params save_sharding_stage1_model_include_freeze_params (#9198) (#10551) (#11045)
Co-authored-by: Ferrebo <kebo01@baidu.com>
2025-09-03 10:59:16 +08:00
Liujie0926
abae89257e [CI]fix no data for dist (#11054)
* fix

* update
2025-09-03 10:57:43 +08:00
umiswing
c0ccc616eb [FEA] PP prepare_inputs add autocast (#10502) (#11043) 2025-09-03 10:28:48 +08:00
umiswing
8f88a68b05 Adapt to non-orthogonal context parallel (#11044)
* Adapt to non-orthogonal context parallel

* fix codestyle
2025-09-03 10:28:39 +08:00
XiangzheWang
42af154348 move the newer deep_gemm to fleety (#10860) (#11040)
Co-authored-by: wangxiangzhe <>
2025-09-02 13:23:23 +08:00
Liujie0926
b6c53b11fc update loss_base for paddle (#11027) 2025-09-01 10:11:34 +08:00
Liujie0926
89ec9af687 [CI] remove CI (#11024)
* remove CI

* remove cpu CI
2025-08-28 18:19:36 +08:00
Liujie0926
c5701e7f2a update is_cuda123 (#11009) 2025-08-28 14:42:41 +08:00
Zhan Rongrui
eda4a868ef Enable check for llama_dygraph_auto_bs8_fp16_DP2-MP2-PP2 and llama_dygraph_auto_bs8_fp32_DP2-MP2 (#10991)
* enable

* fix

* fix
2025-08-26 19:18:00 +08:00
tianshuo78520a
ab5071b359 ADD Approval CI (#10998)
* Update Approval CI

* Update Approval CI

* fix

* fix

* fix

* fix
2025-08-26 14:12:41 +08:00
Liujie0926
c39410ff72 add llm&unittest (#10993) 2025-08-25 13:01:12 +08:00
Liujie0926
ea228be896 [CI]Update Distribute CI (#10990)
* add cuda12.3 loss_base

* add a100 action
2025-08-25 11:24:12 +08:00
Zhuoqun Li
0bb61071d0 [infer] add mistral (#10668) 2025-08-25 10:14:07 +08:00
Zhan Rongrui
7f5cbdd7cc Disable check for llama_dygraph_auto_bs8_fp16_DP2-MP2-PP2 and llama_dygraph_auto_bs8_fp32_DP2-MP2 (#10989)
* update loss

* fix
2025-08-22 14:18:27 +08:00
zhongtianyun
1a58555b56 [feat] Add shortgpt (#10983)
* feat(shortgpt): add new script and polish existing code (typos, paths)

* fix: add shortgpt script, fix formatting and imports
2025-08-22 14:02:21 +08:00
Zhuoqun Li
c83684fe78 Fix hidden states and quant kv cache (#10854)
* fix hidden states

* fix quant kv_cache

* fix Lint style

* fix kv_cache_reuse key error

* fix kv_cache_reuse key error

* remove unused code

* fix kv_cache_reuse default
2025-08-21 15:35:25 +08:00
Liujie0926
887b5d27ae [CI] update loss for Paddle PR#74530 (#10949)
* update loss for Paddle PR#74530

* fix bug

* fix

* fix python
2025-08-21 15:26:29 +08:00
Liujie0926
d38a95c1e2 [CI]update build.sh (#10941)
* update build.sh

* add proxy

* update cache path

* skip aistudio down for connection

* fix
2025-08-20 16:51:05 +08:00
xingmingyyj
d74c950e15 fix path (#10955) 2025-08-19 20:23:03 +08:00
Siming Dai
704fd4fc3b fix ppo global_mini_batch_size (#10937) 2025-08-18 19:10:07 +08:00
zhaody
3e9d3518cb Update ppo (#10912)
* add ppo

* Update run_rl.py

* Update ppo_trainer.py

* Update config_utils.py

* Update run_rl.py

* Update gsm8k_processor.py

* Update run_rl.py

* Update score_model_utils.py

* Update score_model_utils.py

* Update run_rl.py

* Update ppo_trainer.py

* Update ppo_trainer.py

* Update ppo_trainer.py

* Update score_model_utils.py

* Update gsm8k_processor.py

* pre_commit

* Update advantage.py

* Update advantage.py

* pre-commit check

---------

Co-authored-by: DesmonDay <908660116@qq.com>
2025-08-07 14:21:56 +08:00
RevL147
2ae914eae9 fix ordered_save func (#10896)
Co-authored-by: luyuxiang <luyuxiang@YuxiangdeMacBook-Pro.local>
2025-08-05 12:08:30 +08:00
Liujie0926
5b9e0b33c1 fix CI bug (#10890) 2025-07-28 14:14:14 +08:00
ZhenxingLi
d250b3456c [Auto Parallel] Fix sp in gpt modeling_auto (#10835)
* Update modeling_auto.py

* Update pretrain-gpt3_13b_dynamic_auto.json

* update

* fix gpt sp model

* Update loss base

* update loss base

* disable benchmark SP for now
2025-07-25 14:44:38 +08:00
ZhenxingLi
b8f2101ebc clear flag (#10870) 2025-07-21 19:47:12 +08:00
ZhenxingLi
a205bc3f39 Update ci_case_auto.sh (#10855) 2025-07-18 16:41:32 +08:00
Liujie0926
06366431bd [CI] fix workflow (#10861)
* fix workflow

* remove codecov
2025-07-18 11:20:45 +08:00
Liujie0926
e042ac12e1 [CI] update workflow (#10846)
* update workflow for CI

* fix
2025-07-16 14:10:44 +08:00
danleifeng
f4846c1115 【AutoParallel】 add sep strategy for llama (#10837)
* autoparallel add sep strategy for llama

* fix ci

* fix ci error;

* fix ci error;
2025-07-14 19:14:56 +08:00
Yuntao Nie
58bed420fb [Auto Parallel] change fused_layers.py to support fused_linear_grad add/sync_mp_allreduce/sp_async_reduce_scatter in same time (#10797)
* add origin linear

* fix

* update mock_layer in run_pretrain_auto

* fix

* fix

* fix to_static

* fix to_static

* support sp_async_reducescatter

* polish

* fix ci bug: no flashattn in v100

* fix loss base

* close mp async when sp is on

---------

Co-authored-by: chenyuyan <2903319587@qq.com>
2025-07-11 11:15:59 +08:00
waliwali777
15d49bbe95 [AutoParallel] Open dynamic sharding CI test (#10793)
* open sharding CI test and remove flag

* update loss_base
2025-07-10 21:21:26 +08:00
danleifeng
44eff1f93f Add auto_parallel context_parallel strategy (#10722)
* add auto_parallel context_parallel and sep

* fix cp;add cp intermediate api demo

* fix

* fix

* fix

* fix

* fix modeling_auto

* fix modeling_auto

* fix pre-commit error

* fix pre-commit error

* fix ci error;add cp ut case

* fix ci error;add cp ut case

* fix ci error

* fix ci case loss diff error

* fix ci case loss diff error

* fix PaddleNLP-CI-gpt-3 ci error;cp not support non-a100

* fix PaddleNLP-CI-gpt-3 ci error;cp not support non-a100

* fix useless code;

* edit ci loss;changed cause paddle whl;0708
2025-07-09 14:33:27 +08:00
zty-king
78741f9c3e Fix the _save function so that it can save the optimizer parameters. (#10789)
* Fix the _save function so that it can save the optimizer parameters.

* 添加llama_dygraph_auto_bs8_fp16_DP2-MP2-PP2_hybrid_pp热启动单测

* 规范命名

* fix the log error
2025-07-08 11:35:55 +08:00
waliwali777
86621a3fe9 close dynamic sharding CI test (#10791) 2025-07-04 18:41:49 +08:00
gongel
baaa080477 fix_qwen3_moe (#10801) 2025-07-04 14:45:25 +08:00
XiangzheWang
2828bc7e88 fix ut (#10812) 2025-07-04 14:04:40 +08:00
Emmanuel Ferdman
9db95ee962 [tests] migrate to unittest.assertEqual (#10670)
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2025-07-04 11:30:44 +08:00
ZhenxingLi
4355abbe93 [Auto-parallel] Fix sharding all_gather overlap in auto_dy (#10782)
* Update auto_trainer.py

* Update auto_trainer.py
2025-07-02 14:46:34 +08:00
ZhenxingLi
335905a07c Update pretrain-llama2_13b_dynamic_auto.json (#10785) 2025-07-02 11:48:08 +08:00
ZhenxingLi
46c25bfb58 Update pretrain-llama2_7b_dynamic_auto.json (#10786) 2025-07-02 11:47:56 +08:00
liym27
53545aa563 [Auto-Parallel] optimize the perfermance of GPT-3 (#10780) 2025-07-01 16:08:19 +08:00
XiangzheWang
24a8887610 Adapt new nccl version (#10768)
* adapt new nccl version

* adapt new nccl version

* adapt new nccl version

* fix

* fix

* fix

* fix

* fix

* add test

* add test

* fix

* fix ut
2025-07-01 11:42:09 +08:00
ZhenxingLi
6ff098b972 [Auto Parallel] Add enable_linear_fused_grad_add in qwen benchmark (#10779)
* Update qwen-14b_pretrain_dynamic_auto_bs32_bf16_DP1_MP2_Sharding16_Stage1.sh

* Update pretrain-qwen_14b_dynamic_auto.json

* Update pretrain-qwen_14b_dynamic_auto.json
2025-06-30 17:15:06 +08:00
Yuntao Nie
d4be4ab700 [Auto Parallel] Adapt mp_async_allreduce optimize in auto paralle (#10770)
* add mp_async_allreduce

* update mock_layer()

* add comment

* remove comment
2025-06-30 11:00:01 +08:00
YUNSHEN XIE
b8f4b0cba6 disable use_cinn for intermediate_api_meta-llama-Llama-2-7b (#10778) 2025-06-27 20:27:10 +08:00
Liujie0926
8fd74f0b74 [CI] update auto_parallel loss_base for paddle#73408 (#10771)
* update loss_base for paddle#73408

* update

* test for loss

* update loss

* update loss

* update loss

* update

* update

* revert test
2025-06-26 14:14:24 +08:00
waliwali777
06378bb4e5 Add gpt dyanmic auto benchamrk (#10759)
* update

* Update pretrain-gpt3_13b_pp.json

* Update modeling_auto_pp.py

* Update modeling_auto_pp.py

* Update modeling_auto_pp.py

* Update run_pretrain_auto.py

* Update run_pretrain_auto.py

* Update run_pretrain_auto.py

* Update modeling_auto_pp.py

* Update pretrain-gpt3_13b_pp.json

* Update trainer_utils.py

* init benchmark

* update json

* update json

* remove sd flag

* format

* fix rebase

* open enable_linear_fused_grad_add

* pre-commit

---------

Co-authored-by: Xing-lil <zhenxingli@hust.edu.cn>
Co-authored-by: ZhenxingLi <lizhenxing02@baidu.com>
Co-authored-by: Starrysea996 <2462405885@qq.com>
2025-06-25 14:55:32 +08:00
waliwali777
ecf7a0c3f6 add model_type (#10766) 2025-06-25 11:21:03 +08:00
Yuntao Nie
cd4db85734 [Auto Paralle] open llama test (#10762)
* open_ci

* add A100 data
2025-06-25 11:20:45 +08:00
waliwali777
f068df3006 Fix the import issues caused by Paddle version (#10760)
* adapt to the release version of Paddle, fix import

* format

---------

Co-authored-by: Starrysea996 <2462405885@qq.com>
2025-06-24 20:07:40 +08:00
waliwali777
544b7db39e open gpt dp CI test (#10740)
* open gpt dp CI test

* update a100 loss base

* update base

* update loss base

* run gpt base

* update base

* restore
2025-06-24 13:10:36 +08:00
megemini
f2477c0727 【Hackathon 8th No.32】 Adam-mini 精调算法复现 (#10413)
* [Init] AdamWMini

* [Update] blocks per neuron and other

* [Update] adamw_python

* [Update] adamw_python

* [update] fix grad mean

* [update] remove bad conflict resolve

* [update] moment shape align to torch

* [update] test layernorm

* [update] logger

* [add] test case for adamwmini
2025-06-24 10:36:03 +08:00
XiangzheWang
bfba64bb98 [Auto Parallel] add llama with auto pp (#10751)
* llama_with_auto_pp

* support change n_microbatches in json

* fix init model

* keep layers which are not in curr rank

* formal llama_with_auto_pp

* formal llama_with_auto_pp

* style

* formal

* fix

* fix

* fix

* fix

* add condition for hybrid pp

* fix

* add test case

* add test case

* add test case

* add llama type pp_schedule

* fix
2025-06-23 14:59:05 +08:00
waliwali777
1938c9e940 Run llama dyanmic pp perf (#10753)
* llama_with_auto_pp

* support change n_microbatches in json

* fix init model

* keep layers which are not in curr rank

* formal llama_with_auto_pp

* formal llama_with_auto_pp

* style

* formal

* fix

* fix

* fix

* fix

* add condition for hybrid pp

* fix

* add json

* remove old

* update json

---------

Co-authored-by: Waynezee <wangxiangzhe@baidu.com>
2025-06-20 20:27:56 +08:00
Yuntao Nie
e7420b1b38 [Auto Parallel] close llama dynamic dp test temporarily (#10750)
* close_ci

* fix
2025-06-19 11:40:43 +08:00
许万鹏
c6ed7a31e0 Integrate DataProto into the GRPO (#10597)
* Integrate DataProto into the GRPO

* Integrate DataProto into the GRPO, flake8

* Integrate DataProto into the GRPO, isort

* Update DataProto_ver250521

* Update DataProto_ver250530

* Update DataProto_ver250605, aligned

* Update DataProto_ver250610, aligned

* Update DataProto_ver250611, aligned, remove comment, recover Trainer

* Update DataProto_ver250611, aligned use outer autocast, remove comment, recover Trainer

* Update DataProto_ver250611, aligned use outer autocast, remove comment, recover Trainer, pre-commit

* Update DataProto_ver250612

* Update DataProto_ver250612, add copyright

* Update DataProto_ver250617, add docstring, follow style guidelines, black
2025-06-18 19:31:03 +08:00
Yuntao Nie
b79f03e037 [AutoParalle] fix fused layers fp32 multi precision (#10743)
* add enable_fused_linear_grad_add to run

* fix fused_layers fp32 multi precision
2025-06-18 17:11:28 +08:00
zhengzhonghui
7161461e59 Remove restrictions on the use of allgather_overlap (#10741) 2025-06-18 11:29:17 +08:00
Siming Dai
141499b287 fix tp model load (#10739) 2025-06-17 16:55:31 +08:00
Siming Dai
e5c7866c20 update architectures saving (#10738) 2025-06-17 16:55:17 +08:00
waliwali777
98b08b1242 close gpt dynamic dp test temporarily (#10736) 2025-06-13 18:13:29 +08:00
lugimzzz
9f9c1d3e83 fix wint4/8lora (#10728) 2025-06-12 22:53:49 +08:00
Yzc216
c9c0a3ec9e Aistudio 使用 SDK 进行下载 (#10678)
* aistudio SDK

* test: transformer download util

* style: pre-commit check

* test

* fix: remove redundant parameter

* Update aistudio-sdk requirement
2025-06-12 19:36:44 +08:00
bukejiyu
7f5d719555 [inference]Add support for splitting Paddle tensors. (#10721)
* 增加paddle tensor 切分逻辑

* update

* update

* update

---------

Co-authored-by: tangbinhan <tangbinhan@baidu.com>
2025-06-12 11:32:16 +08:00
Liujie0926
88b7a14ab0 [CI] skip unit case for hang (#10642)
* skip case for hang

* fix codestyle

* skip test_data_collator_for_language_modeling

* fix requirements
2025-06-11 14:18:37 +08:00
ZhenxingLi
eb9e7a0392 [AutoParallel] Fix fast_rms_norm (#10711)
* Update ln_api.cpp

* Update ln_api.cpp
2025-06-11 12:00:30 +08:00
lugimzzz
4615d005f6 update fp8 training (#10720) 2025-06-11 11:15:02 +08:00
AIbin
7309a5dde8 update moe_preprocess for wint2.x (#10702) 2025-06-07 12:19:28 +08:00
Siming Dai
7f2de6ea2f update mergekit with remove_keys input (#10693) 2025-06-06 23:14:40 +08:00
lugimzzz
46932b6629 fix ci (#10710) 2025-06-06 15:40:49 +08:00
ZhenxingLi
7c2fcbd778 Update llama_dygraph_auto_bs8_fp32_DP2 mem_base (#10707)
* Update ci_case_auto.sh

* Update ci_case_auto.sh
2025-06-06 14:13:56 +08:00
lugimzzz
ad548d3bcf [llm] support tensorwise fp8/int8 training (#10612) 2025-06-05 15:11:24 +08:00
waliwali777
fb80d7d0d9 improve qwen perf (#10692) 2025-06-05 14:50:11 +08:00
Ting
247ad86e16 [Template] apply chat template support openai format. (#10701)
Co-authored-by: ganzehua <ganzehua@baidu.com>
2025-06-04 21:21:14 +08:00
Siming Dai
acff7e1fa0 Update aistudio-sdk requirement (#10698) 2025-06-04 14:15:54 +08:00
Ting
38ebc26f08 [Template] add jinja plugin, apply_chat_template support dict messages (#10677) 2025-06-03 15:55:28 +08:00
liym27
b550133ff7 Revert "[Auto-Parallel] optimize llama-7b benchmark in temporary solution to …" (#10682)
This reverts commit e0921f0fa8.
2025-06-03 10:40:26 +08:00
Siming Dai
c1322be06c Update loading numpy format state dict (#10679)
* [UC] fix _load_state_dict_into_model

* update load numpy state_dict
2025-05-30 17:23:49 +08:00
ZhenxingLi
ea2976f396 [Auto-Parallel] Add benchmark for sharding opt in qwen N4C32 dy_auto (#10673)
* Update qwen-14b_pretrain_dynamic_auto_bs32_bf16_DP1_MP2_Sharding16_Stage1.sh

* Update pretrain-qwen_14b_dynamic_auto.json
2025-05-30 15:49:27 +08:00
liym27
e0921f0fa8 [Auto-Parallel] optimize llama-7b benchmark in temporary solution to avoid unnecessary communication (#10671) 2025-05-30 14:14:52 +08:00
waliwali777
9ba4e7e046 Remove num_hidden_layers for baichuan (#10655)
* remove num_hidden_layers for baichuan

* add enable_linear_fused_grad_add

* remove fused_linear_param_grad_add

* add tensor_fusion

* add fused_linear_param_grad_add
2025-05-28 19:31:51 +08:00
FireDog2
d67eaa42f1 LoRA-Pro Implemention (#10146)
* lorapro提交

* Fix issues in LoraPro tests and configuration

* Fix loRA-Pro test files bugs

* lorapro pr修改

* Trigger CI re-run
2025-05-28 19:25:24 +08:00
ZhenxingLi
e5858b1204 [Auto-Parallel] Add acc=2 case for tensor_fusion and overlap in auto-dy (#10665)
* Update ci_case_auto.sh

* Update loss_base

* Update ci_case_auto.sh

* Update ci_case_auto.sh
2025-05-28 15:06:17 +08:00
liym27
73118f6d37 [Auto-Parallel] optimize perfermance for qwen-14b (#10652) 2025-05-28 11:09:52 +08:00
waliwali777
988ad5d0d0 [AutoParallel] add use custom op test in pipeline mode (#10653)
* add use rms norm ci test in pp mode

* fix loss base

* fix base
2025-05-27 14:23:03 +08:00
Ze-Yi LIN
062debf2aa [Integration] add swanlab logger (#10594)
* feat: add swanlabcallback

* fix run

* fix lint

* fix requirements dev

* fix url
2025-05-27 11:25:16 +08:00
Hanlin Tang
c418bba09c [Docs] Change tables to list items (#10656) 2025-05-27 11:24:17 +08:00
ZhenxingLi
eb43056b95 Add benchmark for fused_linear in llama7b N4C32 dy_auto (#10647)
* Update pretrain-llama2_7b_dynamic_auto.json

* Update pretrain-llama2_7b_dynamic_auto.json

* Update pretrain-llama2_7b_dynamic_auto.json
2025-05-26 14:43:23 +08:00
Siming Dai
f0eccbde43 [UC] fix _load_state_dict_into_model (#10645) 2025-05-26 14:35:16 +08:00
co63oc
a38f7b7805 [Typos] Fix (#10651) 2025-05-26 11:33:35 +08:00
Hanlin Tang
5f5d9d4cfb [llm] Add pretrain tutorial (#10611) 2025-05-26 11:27:48 +08:00
Hanlin Tang
f90c7a53dd 【PaddleNLP No.2】Add finetune tutorial (#10625)
* [Docs] Add finetune tutorial

* [Docs] fix finetune_tutorial
2025-05-26 11:27:37 +08:00
Hanlin Tang
0643835e13 【PaddleNLP No.3】Add alignment tutorial (#10631)
* [Docs] Add alignment tutorial & fix rl doc formulas

* Update alignment_tutorial.md
2025-05-26 11:27:25 +08:00
Hanlin Tang
d267297277 【PaddleNLP No.4】 Add quant tutorial (#10640)
* [Docs] Add quant tutorial

* [Docs] del tables in quantization_tutorial.md
2025-05-26 11:27:12 +08:00
ZhenxingLi
c309aa7c80 Update meta-llama-Llama-2-7b_pretrain_dynamic_auto_bs32_bf16_Sharding32_Stage2.sh (#10599) 2025-05-23 15:13:42 +08:00
zty-king
c3e25ca527 [AutoParallel] Using local_map replace LocalLayer (#10309) 2025-05-23 15:01:59 +08:00
chen
99e1c105cf [infer] update_input_v2 op will not return eos when env_var is set (#10628)
* Revert "output_len truncated without eos_token_id (#10614)"

This reverts commit 850c6c2859.

* check

* check

* add env var
2025-05-23 14:12:30 +08:00
gongel
7dbba98070 [RL] Fix typo and add wandb log (#10641)
* add log

* add INFERENCE_TRUNCATED_RETURN_EOS

* add INFERENCE_TRUNCATED_RETURN_EOS
2025-05-23 14:11:06 +08:00
SdeeRK
eee766b5de [RL] reinforce learning benchmark framework (#10619)
* 增加rl目录下的init.py文件

* 增加copy rightb并格式化

* add reinforcement learning benchmark framework

* update copyright

* update

* add reinforce learning benchmark framework

* add elapsed time metrics in api serve framework

* fix some bug

* add reinforce learning framework with scripts file

* remove vllm quant type

* reformat rl benchmark code and scripts

* add readme file

* add fastdeploy engine support for api serve
2025-05-23 14:10:45 +08:00
cyy536
134a7b9958 Add ci for sp_async_reduce_scatter_in_dygraph_auto_mode (#10638) 2025-05-23 13:10:13 +08:00
ZhenxingLi
23e4c1ae80 [Auto-Parallel] Add ci for tensor_fusion and overlap in auto-dy (#10598)
* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh
2025-05-23 11:50:37 +08:00
Hanlin Tang
dbf9c44927 [LLM] fix quantization without qlora (#10639) 2025-05-22 18:01:06 +08:00
co63oc
3f2db10ffe [Typos] Fix (#10494)
* Fix
2025-05-22 17:53:07 +08:00
huangjiyi
adf2768fe2 add merge_all_horizontal_groups cinn flag for llama (#10629) 2025-05-22 15:38:25 +08:00
Zero Rains
64afc81733 [FIX] fix the bug that some gemm config did not be handled (#10627)
* fix the bug that some gemm config did not be handled

* change paddle_throw to std::runtime_err
2025-05-21 20:39:03 -07:00
cyy536
a6ea5390f7 Add sp_async_reduce_scatter in dygraph auto mode (#10620) 2025-05-22 10:52:02 +08:00
co63oc
3b0c8ff630 [Typos] Fix (#10486) 2025-05-21 11:48:08 +08:00
Hanlin Tang
af16c95c07 [PIR] Update simcse to apply pir (#10396) 2025-05-21 11:47:08 +08:00
Hanlin Tang
868f6eeed5 [Taskflow] Fix the recognition bug of json format with both PIR suffix and id2label (#10487) 2025-05-21 11:45:18 +08:00
Hanlin Tang
38828ba0bb [PIR] Update paddle.inference infer example for Ernie-vil2.0 (#10500)
* [PIR] Updated arrow data and paddle.inference infer example for Ernie-vil2.0

* [PIR] delete fastdeploy in ernie-vil2.0 doc
2025-05-21 11:37:31 +08:00
Echo-Nie
7ea6253132 【PaddleNLP No.1】 add pre-train.md (#10506)
* Paddle NLP No.1 pretrain.md

* add comment to printInfo

* fix according to review

* fix according to review

* 移除模型列表,改为参考根目录列表

* 修改模型列表措辞
2025-05-21 11:36:52 +08:00
co63oc
9bee5b36ad Fix (#10533) 2025-05-21 11:35:33 +08:00
chen
850c6c2859 output_len truncated without eos_token_id (#10614) 2025-05-20 12:49:14 +08:00
Siming Dai
6f80ea1562 Fix fp8 in dtype_byte_size (#10618) 2025-05-20 11:08:01 +08:00
Zong Wei
5c482b6b64 [INTEL_HPU] Enable FusedBlockMultiTransformerHPU (#10514)
add FusedBlockMultiTransformerHPU and prepare_input_hpu

atten output post-process

FusedBlockMultiTransformerHPU opti for-if-else

kv_head update for HPU shape

fix benchmark can't run with bigger bs issue

Co-authored-by: yanfeich <yanfei.cheng@intel.com>
2025-05-19 17:37:46 +08:00
Zhong Hui
6bdb71622c Update ppo_model_utils.py (#10593)
* Update ppo_model_utils.py

* Update pp_model_utils.py
2025-05-19 17:30:17 +08:00
Jinji Fu
c654d1ae21 merge reshard-1 (#10606) 2025-05-19 17:12:49 +08:00
yujun
ddcb722e3d [RL] logprob compute use the same method (#10596)
* fix logprob compute method

* update
2025-05-15 15:41:50 +08:00
FocusLuo
cd2d2dc05b [INTEL_HPU] add e2e auto test cases (#10108)
* [INTEL_HPU] add e2e auto test cases

* [INTEL_HPU] add e2e auto test cases

---------

Signed-off-by: Luo, Focus <focus.luo@intel.com>
2025-05-14 17:01:44 +08:00
Liujie0926
6de50e6750 [paddlenlp_ops] update whl (#10576)
* update whl

* update
2025-05-14 15:17:37 +08:00
Zhong Hui
2b1efb2efd Update serialization (#10584)
* Update serialization.py

* fix
2025-05-14 11:45:58 +08:00
Weiguo Zhu
91920a68cb fix (#10585) 2025-05-13 19:22:11 +08:00
gongel
477048cccd fix_eos_mask (#10588) 2025-05-13 15:19:54 +08:00
Zhong Hui
6d40971b6e Refactor RL (#10569)
* pathes to RLTrainerBase

* refactor ActorReferenceTrainerBase
2025-05-13 15:17:15 +08:00
chen
fe442e4173 check (#10587) 2025-05-13 15:11:54 +08:00
chen
47de2c6c04 [infer] get_output and save_output recover input without msg_queue_id (#10574)
* check

* fix input_text dy_insert

* check code
2025-05-13 13:06:28 +08:00
Liujie0926
8205e3d194 [CI]add rl to ci (#10553)
* fix scripts for docs

* fix timeout

* add grpo&rf++

* fix path

* update yaml

* fix

* fix data

* add install_external_ops

* fix fused_ln

* fix

* update cmd

* fix path

* fix

* fix path

* fix codestyle

* update class name

* update name
2025-05-13 10:02:56 +08:00
SdeeRK
3570aaac37 增加rl目录下的init.py文件 (#10581)
* 增加rl目录下的init.py文件

* 增加copy rightb并格式化
2025-05-12 17:44:42 +08:00
yulangz
c4e53f6820 [Dockerfile] Add xpu p800 release dockerfile (#10552) 2025-05-12 16:27:53 +08:00
Zhong Hui
c043487a16 [LLM] Add qwen3 (#10524)
* init qwen3

* first version.

* fisrt version support for qwen3

* add missing files.

* add readme

* refine copyright.

* init version for qwen moe.

* fix networks.

* fix generate.

* refine

* fix set_state_dict to slow for supper large network for network, such as moe model.

* fix

* fix

* fix set_state_dict to slow for supper large network for network, such as moe model.

* fix qwen2 tensor parallel.

---------

Co-authored-by: DrownFish19 <DrownFish19@gmail.com>
2025-05-12 10:35:58 +08:00
kebin liu
759ae99609 add qat_fp8linear (#10570) 2025-05-09 14:36:45 +08:00
Liujie0926
247f05e4a6 [paddlenlp_ops] update name (#10518)
* update paddlenlp_ops name

* fix

* update version
2025-05-09 14:30:16 +08:00
zhink
624510af1d [paddlenlp_ops] Fix custom all reduce and cpp_extensions.cu when sm70/75 (#10554) 2025-05-09 10:59:19 +08:00
Siming Dai
72dc85d2d7 fix stop_gradient in uc (#10571) 2025-05-08 18:22:06 +08:00
Hanlin Tang
6c0bfac329 【PaddleNLP No.22】Fix PIR for ernie-layout (#10484) 2025-05-08 15:01:44 +08:00
Tian
276cfc2cd4 [LLM] fix zcc typo (#10559) 2025-05-08 13:18:22 +08:00
lugimzzz
fa41a91efa fix quantlora bug (#10562) 2025-05-07 20:29:26 +08:00
yujun
aa9d8d5788 [RL] 加速推理模型qwen2的set state dict的性能 (#10550)
* 加速推理模型qwen2的set state dict的性能

* dim -> axis
2025-05-07 18:07:56 +08:00
Hanlin Tang
1f9b47ee14 [PIR]Fix ernie-3.0 deploy&add training without hf (#10475) 2025-05-07 15:22:16 +08:00
chen2016013
fea8d82586 fix llama13b bug (#10525) 2025-05-07 11:28:06 +08:00
Weiguo Zhu
c7d44f2bf9 [RL] Fix loading amp custom list from .yaml (#10544)
* fix

* add rf++
2025-05-06 22:17:43 +08:00
Tian
bb83432da0 [LLM] enhance logger output for real filename and lineno (#10537) 2025-05-06 19:18:41 +08:00
Hanlin Tang
1aadf1bce6 [PIR] Fix text_classification (#10497) 2025-05-06 13:13:12 +08:00
Jinji Fu
95901cb11b Fix qwen rl kl coeff (#10530) 2025-04-30 17:08:44 +08:00
yujun
93e58f2357 添加grpo_qwen32b 9机训练命令 (#10528) 2025-04-30 13:53:37 +08:00
Function-Samuel
9b3ef71b62 Add dynamic auto mode cross_entropy CI (#10515)
* add cross_entropy ci

* fix

* fix
2025-04-29 19:33:01 +08:00
Function-Samuel
d0044ab6cb Add qwen cross entropy optimize in dynamic auto mode (#10521) 2025-04-29 19:32:51 +08:00
gongel
713ef2b228 rename (#10523) 2025-04-29 16:45:01 +08:00
gongel
7c565f6f3c update rl doc (#10522) 2025-04-29 15:51:28 +08:00
lugimzzz
3fa6ac6a7c fix readme bug (#10520) 2025-04-29 15:37:10 +08:00
Function-Samuel
fab948ca4f Add qwen-14b benchmark (#10513) 2025-04-29 14:22:34 +08:00
yujun
5f782a840d add grpo kk 0.96 (#10519) 2025-04-29 14:07:42 +08:00
greycooker
a00471f1e9 [RL] Fix GRPO &&RF++ Docs (#10517)
* fix ppo doc

* fix grpo
2025-04-29 11:15:26 +08:00
yujun
edd34aa3bc [RL] RL support varlen flash mask (#10490)
* update rl

* 删除optimizer的timer时间

* 修改rollout_continue_batching_batch_size为rollout_max_num_seqs, quant_type为rollout_quant_type

* 更新global_mini_batch_size

* fix entropy_coeff dtype error

* add einops requirements

* 更新文档

* user rm padding so we donot need to pad_to_multiple_of tp degree

* update rollout_max_num_seqs

* squeeze unsqueeze

* shuffle

* fix training bug

* fix missing pad

* add dataloader_shuffle args
2025-04-28 19:48:17 +08:00
Zhong Hui
d6182ffa65 Update rl_dataset.py with apply_chat_template (#10510) 2025-04-28 16:04:32 +08:00
Liujie0926
4821b63869 [CI]skip unnecessary executions (#10509)
* skip unnecessary executions for unittest

* fix

* fix

* skip unnecessary executions for distribute

* fix unittest

* fix
2025-04-28 10:49:36 +08:00
Echo-Nie
e7516ee3c0 Fix llm_train.rst deaklink(#10505) 2025-04-27 17:12:45 +08:00
Zhong Hui
aad5cbe847 [ArgParser] Support pass python file as config. (#10489)
* fix import.

* add python script.

* support pass python file as config.
2025-04-27 17:06:51 +08:00
l1cacheDell
370702a6bd update setup_cuda.py (#10493) 2025-04-27 00:33:11 -07:00
Liujie0926
d3ee14fab8 [CI]update scripts for ci (#10496)
* update scripts for ci

* fix

* update     install_paddle

* fix

* fix install_paddle

* add timeout for taskflow

* fix case_list

* fix
2025-04-27 11:12:34 +08:00
Function-Samuel
4d358256f8 [Performance Optimization]Replace cross_entropy_with_softmax to c_softmax_with_cross_entropy in dynamic auto mode (#10471)
* Replace cross_entropy_with_softmax to c_softmax_with_cross_entropy in dynamic auto mode

* add sys_path

* add TODO

* add copyright
2025-04-27 10:57:16 +08:00
chen
acb6e224b5 【Inference】Fix Bug set_preids_token_penalty_multi_scores (#10492)
* fix

* check model_inputs[pre_ids] update in dynamic insert
2025-04-25 20:12:46 +08:00
Zero Rains
409fc407c9 [Inference] fix the bug for dynamic/static inference and dy2st for deepseekv2 in weight only int4/int8 (#10491)
* fix the bug in export deepseek_v2

* fix the deepseekv2 dynamic weight only int8

* fix

* fix

* update
2025-04-25 18:20:10 +08:00
Zhong Hui
f0c5aa2814 Fix predict import. (#10476) 2025-04-24 16:22:11 +08:00
co63oc
e8a19d361a Fix typos (#10483) 2025-04-24 12:02:41 +08:00
Echo-Nie
3a23130fa0 [PIR] Fix UIE (#10482) 2025-04-24 11:05:46 +08:00
Hanlin Tang
14bb7cfe7c [PIR] Create paddle.inference infer example of ernie-3.0-tiny (#10480) 2025-04-24 11:04:24 +08:00
Echo-Nie
d75d5ad904 [PIR] Fix ernie-vil2.0 (#10481) 2025-04-24 10:54:41 +08:00
Kunbo Ding
402e2e8494 [RL] Update reward training docs (#10473)
* update rm docs

* update rm docs
2025-04-24 10:51:23 +08:00
yulangz
323ffec4fa [XPU] support absorb mla, separate the model networking from GPU (#10353)
* 独立的,不和 GPU 混用的组网,现在还缺算子迁移过来

* update csrc

* fix

* fix

* 移除多余代码

* support infer param

* fix save output

* add warm script

* 组网剥离

* fix style

* update setup and remove useless files

* fused block attn

* hack 实现 int_wo MOE

* 多线程 mmlu 脚本

* mmlu 8K 输出

* add inference time for benchmark

* fix warm max_dec_len

* Revert "mmlu 8K 输出"

This reverts commit 0c89ea0fa7.

* Revert "多线程 mmlu 脚本"

This reverts commit fe6bfc5a3b.

* add high speed moe

* change rope cos sin to cpu

* fix save output
2025-04-23 20:47:12 +08:00
chen
2211480714 【infer】 predict_dy_insert support more inputs and append attn support excess_blocks input (#10446)
* support input input_ids, and all_rank_return in dy_insert

* refine code

* delete print

* fix kv_cache block mismatch block_table

* check input_ids len

* check input_ids len logger

* fix dy_insert cuda700, append attn support excess_blocks

* check empty_cache order

* check modeling forward input excess_blocks
2025-04-23 20:01:16 +08:00
l1cacheDell
345ff570ae [Triton Kernel] Add varlen segment mean triton kernel (#10369)
* upload triton kernel

* update kernel from review

* fix docstring

* update __init__
2025-04-23 19:55:30 +08:00
zhangyuqin1998
53273adb74 [Trainer] Add forward_backward_overlap_scheduler in pipeline_parallel_config (#10336)
* [Distributed] Add forward_backward_overlap_scheduler in pipeline_parallel_config

* fix codestyle
2025-04-23 17:14:03 +08:00
Liujie0926
671cf1accc [CI] Add timeout exception prompt for ci (#10450)
* fix paddlenlp build

* fix paddlenlp_ops install

* [CI] fix scripts

* exit_code=124

* fix

* add timeout

* add timeout for paddlenlp
2025-04-23 16:56:36 +08:00
co63oc
f65b90610e [Typos] Fix (#10290) 2025-04-23 15:51:51 +08:00
co63oc
e49945aea3 [Typos] Fix (#10289) 2025-04-23 15:46:40 +08:00
Hanlin Tang
fa8359d002 [PIR] Fix test_tipc configs/inference/docs (#10465) 2025-04-23 15:42:34 +08:00
Echo-Nie
5aa907c22c [PIR] Fix information_extraction (#10469) 2025-04-23 15:36:31 +08:00
Echo-Nie
46ebe6e67a [PIR] Fix lexical_analysis (#10470) 2025-04-23 15:36:05 +08:00
will-jl944
d80bce0469 In case dpo uses score-based loss (#10461) 2025-04-23 15:28:47 +08:00
lugimzzz
72e1994b38 add loralinear (#10385)
* add loralinear

* add wint8lora

* fix bug

* add a8w8linear

* add a8w8linear with hadamard

* support fused linear

* support backward

* support wint8

* add a8w8

* add a8w8

* fix following comments

* fix following comments
2025-04-23 15:12:49 +08:00
greycooker
843739d2fc [RL] Refactor code based on gloabl_batch_size (#10462)
* fix wandb proxy

* update num_return_sequences to rollout_n in .md and .json

* 当开启balance_batch的时候,强制prompt的input id需要padding到max_prompt_len

* fix

* fix all_reduce import for single card

* update with global_batch_size

* fix for acc<=0 or train_batch.shape[0] < batch_size

* revert micro upgrade

* fix data shape for multi dataset_world_size

* lint

* add hint

* update for dynamic sampling

* refoctor

* add warning for split_batch_into_micro_batches

* update logger info

* add pad_token_id for split_batch_into_micro_batches

* support prompt_key and prompt_key

* fix for compute_advantage_normalization and eos_mask

* update for args config

* enhance balance token

* add note

---------

Co-authored-by: DrownFish19 <DrownFish19@gmail.com>
Co-authored-by: yujun <573009727@qq.com>
2025-04-23 14:52:42 +08:00
Zong Wei
5d43923863 [INTEL_HPU] Enable Intel HPU fused multi transformer (#10284)
e2e integration

minial fix

refine code and remove unnecessary changes

integrate all fused ops, first fused op still need to optimize on
embedding.

reference pp kernels implementation

align final rms_norm shape with expected.

e2e shape fix

e2e bugs fix

e2e bugs fix2

e2e w/a cast place

e2e batchsize left padding fix

Refine _post_process code in generation_utils.py

combine k/v together

shape and benchmark

Refine Decoder Post-Processing HPU path code

fix multi-card perf benchmark hang issue

batch tokens early stop

optimize for-loop index

fsdpa and rmsNorm updates

code refine to reduce cpu operations

PP refine to remove cpu/gpu copy on python

support static graph mode execution

use cpu to concat all next_tokens to avoid compile and improve perf

fix static graph infer parameters corrupt

Co-authored-by: yanfeich <yanfei.cheng@intel.com>
2025-04-23 13:53:03 +08:00
zhangbo9674
ce7b4ccf35 Fix casual dataset bug (#10357)
* refine log

* fix bug
2025-04-23 11:52:58 +08:00
Weiguo Zhu
04e982f0bd fix (#10468) 2025-04-23 11:51:44 +08:00
Hanlin Tang
5392bdb612 [PaddleNLP No.18] Create new infer example validated on pd3.0 (#10422) 2025-04-23 11:50:08 +08:00
Hanlin Tang
fd22e8fc48 [PIR] Fix test cases (#10456)
* [PIR] Fix pir in comments

* [PIR] re-run pre-commit for pir in comments
2025-04-23 10:05:10 +08:00
Echo-Nie
c8ba30da8f [PIR] Fix ernie_text_matching (#10460)
* fix No33_NLP

* test
2025-04-23 10:03:35 +08:00
Echo-Nie
e9e3df5e37 [PIR] Fix inference_engine (#10466) 2025-04-23 09:56:26 +08:00
Hanlin Tang
55854f2f7d [PIR] Fix text_matching/ernie_matching (#10453) 2025-04-22 17:39:42 +08:00
yaqiang.sun
8e812f6fa6 [Application] Fix index bug for doccano convert (#10361)
Fix index bug for doccano convert
2025-04-22 17:38:35 +08:00
Zhong Hui
1a57b0a0c2 [DOC] Update model weights pages. (#10455)
* optimize_docs

* fix1

* fix2

* fix3

* change to github readme.

---------

Co-authored-by: jie-z-0607 <1712955306@qq.com>
Co-authored-by: Jie.Z <109219440+jie-z-0607@users.noreply.github.com>
2025-04-22 12:55:55 +08:00
chen2016013
9d0b63af34 update_llama_conf_cinn_0218 (#10006)
* update_llama_conf_cinn_0218

* update

* fix llama 13b

* Update run_benchmark.sh

* Update run_benchmark.sh

---------

Co-authored-by: liym27 <33742067+liym27@users.noreply.github.com>
2025-04-22 11:36:29 +08:00
chen
be45d21a94 [BugFix] Fix get_output serving (#10457)
* fix get_output serving

* change queue_id to msg_queue_id
2025-04-22 11:01:55 +08:00
Hanlin Tang
f071343332 [PIR] Fix sentiment_analysis (#10454) 2025-04-22 09:31:29 +08:00
zhangyuqin1998
f53e113c61 [Fix] fix recompute (#10452)
* [Fix] fix recompute

* fix codestyle
2025-04-21 16:08:44 +08:00
Hanlin Tang
031ff474cd [PIR] Fix machine_reading_comprehension SQuAD (#10445)
* [PIR] fix machine_reading_comprehension squad

* Update README.md
2025-04-21 13:10:57 +08:00
chen
d24ec24a08 [infer] Fix per_token_group_quant and support per_tensor_quant (#10359)
* support per_tensor_quant and per_token_group_quant

* check

* add per_token_group_quant, per_tensor_quant_fp8 into pybind_ops_list
2025-04-21 11:20:39 +08:00
greycooker
737a67949f [RL] Fix padding_side (#10448) 2025-04-21 09:35:18 +08:00
Kunbo Ding
97b7af4495 [RL] Fix flashmask reward training (#10443)
* [RL] Fix flashmask reward training

* [RL] Fix flashmask reward training

* [RL] Fix flashmask reward training

* [RL] Fix flashmask reward training
2025-04-18 18:07:52 +08:00
yujun
b3e99ef2ee [RL] Support balance batch (#10444) 2025-04-18 17:10:27 +08:00
chen
f889167043 [Infra] support dynamic_insert in dynamic run (#10387)
* support dynamic_insert in dynamic run

* remove duplicate code

* add save_output_dygraph op

* check pybind op

* note off

* code check

* check mla pybind function signature

* check pybind and batch_size

* support multi-proc save_output and get_output

* check pybind block gemm

* support pybind custom_import in dynamic run

* support non-msg queue stream output in dynamic insert

* check queue_id in d2s, and add sm80 sm90 for pybind

* check pybind for build_wheel.sh

* USE_PYBIND=False

* implement custom_import as context management and decorator

* code check

* add doc for pybind and dynamic_insert

* check

* change USE_PYBIND_CUSTOM_OPS to DYNAMIC_INFERENCE_MODE

* check doc

* code check

* check dynamic_insert debug

* check task_queue is empty when dynamic insert exit

* fix blocking when output_via_mq=1 in dynamic_insert
2025-04-18 16:57:18 +08:00
Zhong Hui
9e64bd09c6 Fix tutorial2 (#10442)
* fix tutorial

* fix

* fix link.
2025-04-18 15:05:22 +08:00
Weiguo Zhu
e887c44492 [Tools] Add Script for Torch Parameters Conversion (#10303)
* add

* format

* update name
2025-04-18 14:54:28 +08:00
Weiguo Zhu
c3091ebead [Inference] Fix for fused_qkv (Qwen2) (#10372)
* fix for fused_qkv

* update to  direct concat mode
2025-04-18 14:17:24 +08:00
Weiguo Zhu
0074e7e575 [Tokenizer] Compatible with the padding_side in _pad (#10423)
* Compatible with the padding_side

* Compatible with the padding_side

* fix
2025-04-18 12:10:39 +08:00
Hanlin Tang
d5b98565bc [PIR] update document_intelligence.py (#10394) 2025-04-18 12:05:49 +08:00
Hanlin Tang
045115a083 [PIR] Fix milvus (#10397) 2025-04-18 12:05:03 +08:00
Zhong Hui
5d8b59390e Fix fail ci Part2 (#10411)
* fix failed ci. part1

* fix ci part 2.

* fix all ci.
2025-04-18 10:56:59 +08:00
Weiguo Zhu
f62b248c16 [LLM] Fix the communication group settings in the moe_layer (#10441) 2025-04-18 10:55:49 +08:00
AIbin
5636299659 【Inference Fix】del while about predict (#10440)
* del while

* del while
2025-04-17 19:55:05 -07:00
Weiguo Zhu
5b161bb490 [Py38] Fix import issue (#10410)
* fix import

* fix import
2025-04-18 10:54:36 +08:00
Zhong Hui
7d6417bc1d Fix tutorial readme (#10432)
* fix tutorial

* fix
2025-04-17 20:03:42 +08:00
jzhang533
8521f027dc Update quick start codes in README.md (#10431)
Signed-off-by: Zhang Jun <jzhang533@gmail.com>
2025-04-17 16:43:18 +08:00
waliwali777
bc06b8a09e [Auto-Parallel] add test of fuse comm sharding optimize in dynamic auto mode (#10403)
* add fuse comm sharding test

* fix

* update

* fix

* add loss base

* update loss base

* fix

* fix ips

* fix
2025-04-17 15:22:30 +08:00
Hanlin Tang
1d5591bdab [PIR] Fix ernie-1.0 infer example and make it compatible with pd3.0.0 (#10426) 2025-04-17 10:18:01 +08:00
greycooker
e6e4928efa 【RL】Add DAPO (#10380)
* add dapo

* fix dapo

* fix conflict
2025-04-17 09:43:23 +08:00
gongel
d85474029a [RL] Add reshard for RL (#10412)
* add reshard

* fix eval
2025-04-16 20:35:24 +08:00
ltd0924
648f051a39 Fix message format type error (#10428) 2025-04-16 19:32:50 +08:00
Weiguo Zhu
9f5b697330 [CI] Fix workflows (#10417) 2025-04-16 12:58:59 +08:00
Function-Samuel
ce7550f6cf [Benchmark] Add baichuan2-13b dynamic auto benchmark (#10384)
* Add baichuan2-13b dynamic auto benchmark

* add FLAGS_fuse_reducescatter_in_opt

* add_hidden_layers

* fix
2025-04-16 10:57:35 +08:00
Hanlin Tang
92d6472fc2 [PIR] Fix cross encoder (#10398) 2025-04-16 09:30:36 +08:00
Hanlin Tang
65391cf483 [PIR] fix ernie_matching (#10399) 2025-04-16 09:29:42 +08:00
zhink
e48148d8c2 [Infra] Add custom all reduce (#10375)
* add custom all reduce

* cleanup_custom_ar safe
2025-04-15 11:56:40 +04:30
will-jl944
4e2fdf3f18 support setting min_lr for cosine lr scheduler (#10393) 2025-04-15 10:37:03 +04:30
zhengzhonghui
b98d8f850d Fix bug of calling TensorParallel multiple times (#10408) 2025-04-15 10:51:17 +08:00
Zhong Hui
d8f9caaa7f Fix failed ci. part1 (#10341) 2025-04-15 10:10:20 +08:00
dongzezhao
3e49b74908 Add pid and start timestamp to metrics dump (#10142)
* Add pid and start timestamp to metrics dump (#10142)

* Add pid and start timestamp to metrics dump

* update start timestamp

* update
2025-04-14 20:39:10 +08:00
Weiguo Zhu
4bf7945ea7 [RL] Update comments to English version (#10400) 2025-04-14 18:14:30 +08:00
AIbin
f232d82d20 [Inference Optimize] Support qwen2.5vl & deepseekvl2 language models to convert to static graph execution (#10377)
* qwen&deepseek_static

* update where

* update deepseek

* update __all__ qwen2

* update __all__ qwen2

* update code

* update deepseek modeling about multimodal inputs_embeds

* update qwen vl model
2025-04-14 11:19:09 +08:00
Zhong Hui
a153370f0d [DOC] Fix dead link (#10343) 2025-04-14 10:19:01 +08:00
Hanlin Tang
e3ed3a30b0 [PIR] update for server/engine/infer.py (#10379) 2025-04-11 15:04:29 +08:00
AIbin
ca1dcc85f2 【Inference Fix Bug】 fix moe_expert_reduce op output shape (#10390)
* fix moe_export_reduce op output shape

* fix moe_expert_reduce op output shape
2025-04-10 23:43:14 -07:00
Wennie396
5dca755f22 【Cherry-pick】add split_norm_comm to split global_norm comm to pp_comm & mp_comm (#10334) (#10368) 2025-04-11 11:37:01 +08:00
waliwali777
50c41840a4 add FLAGS_fuse_reducescatter_in_opt for llama7b benchmark (#10378) 2025-04-11 10:49:27 +08:00
Weiguo Zhu
3b97a283e7 [RL] Refactor code for PPO/GRPO/Reinforce++ Part2 (#10376)
* fix predict for colocate mode

* refoctor

* refactor

* add label_key for new load_dataset method

* fix

* rename  compute_reward to compute_value in critic_trainer
2025-04-11 10:12:11 +08:00
lugimzzz
41706b5b3c fix wint8 inference bug (#10383) 2025-04-11 10:07:18 +08:00
周周周
75550d87cb commit (#10381) 2025-04-10 21:37:55 +08:00
Tian
ae3d5def7f [LLM] fix metrics dumper (#10382) 2025-04-10 19:57:09 +08:00
Hanlin Tang
54c3ec31bf [PIR] Fix in-batch negative recall model for neural_search (#10352) 2025-04-10 19:36:28 +08:00
Weiguo Zhu
ae355c0b35 fix for auto_parallel (#10370) 2025-04-10 09:50:13 +08:00
Weiguo Zhu
d5275b72b0 fix predict for colocate mode (#10373) 2025-04-09 21:34:51 +08:00
Liujie0926
e67789d588 [CI]fix paddlenlp build (#10362)
* fix paddlenlp build

* fix paddlenlp_ops install
2025-04-09 17:07:00 +08:00
Weiguo Zhu
6be4378b1a [CI] Fix tensro_broadcast issues (#10364)
* fix

* fix
2025-04-09 16:19:28 +08:00
Function-Samuel
d2299b1416 remove hidden layers (#10354) 2025-04-09 14:45:16 +08:00
Function-Samuel
a2997336f4 add mem monitor (#10358) 2025-04-09 14:44:59 +08:00
Weiguo Zhu
4b2ae58158 [RL] Refactor code for PPO/GRPO/Reinforce++ (#10310)
* tmp update

* 对应数据流,修改infer的部分直接接收token id

* drop last

* 添加环境变量 JINGDUDUIQI

* add reinforce++

* rm info

* 新增actor_fused_pg_entropy_kl_loss

* 添加fused head loss计算

* entropy_loss

* update

* update

* 修复total_entropy_loss的错误,新增all reduce sum

* 新增optimizer的offload

* add fp32 compute

* support sharding training, add args logprob_batch_size

* per_device_eval_batch_size不能大于self.per_device_rollout_batch_size * self.num_return_sequences

* update rollout_logprob_batch_size

* 新的计算entropy梯度的方法,与原始计算等价,新增final_loss,解决entropy loss和kl loss都关闭的情况的梯度bug

* 支持32B

* sequence parallel支持动态padding到tp的倍数

* 默认关闭entropy_coeff,使用kunbo的fused head loss

* set attr save_output

* 修复temperature先除后除的bug,目前全部在fused算子里面除以.

* 修复entropy loss在tp情况下的问题,需要对entropy_loss_chunk进行all_reduce

* add pure_policy_loss and entropy_loss

* 修复entropy_from_logits的问题,使用pylayer实现VocabParallelEntropy

* update

* remove ptx

* truncation True, max_src_len

* support dataproto & fix dataflow

* update trainer

* rm shell

* 删除一些无用的修改

* update

* update user

* add use_fused_head_and_loss_fn

* fix infer utils

* update

* 中间版本

* temporary version

* temporary version

* temporary version

* temporary version

* no diff (without timer)

* fix prediction_step

* lint

* lint

* update timer_scope and compute_adv

* update compute logprob

* update reward and critic

* update

* update for dev

* update

* fix

* update fused_rms_norm

* fix import

* update inference and timers

* update timers

* update

* lazy_guard

* update

* lint

---------

Co-authored-by: yujun <573009727@qq.com>
Co-authored-by: gongenlei <>
Co-authored-by: yujun <50394665+JunnYu@users.noreply.github.com>
Co-authored-by: gongenlei <gongenlei@baidu.com>
Co-authored-by: greycooker <526929599@qq.com>
2025-04-09 13:05:18 +08:00
lugimzzz
fb694169e4 support wint8 (#10319)
* support wint8

* support wint8

* support wint8

* support wint inferenece

* fix little bug

* support wint8

* support wint8

* support wint8

* fix new bug
2025-04-09 11:56:51 +08:00
AIbin
91b510dc32 【Inference Optimize】Controls whether the message queue is enabled for output (#10185)
* fix mix model save_output

* update enable_stream_output

* del import tokenizer

* update config name

* Reduce redundant member variables
2025-04-08 13:25:57 +08:00
Tian
d53e8cf45e [LLM] release zero cost checkpoint (#10337)
* [LLM] Implement Flash Checkpoint (#9658)

* [LLM] add _save_checkpoint_flash for LLM

* [LLM] cache metas for saving in flash mode

* [LLM] get fused param from optimizer

* [LLM] save model state with plain API

* [LLM] implement flash checkpoint manager and worker

* [LLM] reformat flash checkpoint codes

* [LLM] Add flash save steps (#9664)

* [LLM] process PDC_FLASH_INIT_STEP in ft env

* [LLM] add flash_save_steps

* [LLM] fix compatibility for paddle of old version (#9667)

* [LLM] get sharding meta on all ranks (#9675)

* [LLM] enhance paddle recall for flash checkpoint (#9684)

* [FlashCheckpoint] support EMA (#9815)

* [FlashCheckpoint] support EMA

* refactor: move [flash checkpoint manager] to callback

* [flashcheckpoint] fix save under dp_degree > 1 with use-expert-parallel

* flash-checkpoint EMA: fix cpu mem

* Fc ema v2 (#9909)

* polish ZCC-EMA, remove opt offload

* polish code

* [LLM] format zcc codes

---------

Co-authored-by: Meiyim <chenxuyi@baidu.com>
2025-04-05 11:04:50 +08:00
Function-Samuel
64c0d04130 [test] match filename with model name (#10338)
* fix

* fix
2025-04-03 14:09:34 +08:00
Siming Dai
bfd053db08 [Unified Checkpoint] update moe (#10282)
* update moe

* fix optimizer moe

* update lora moe
2025-04-03 11:11:57 +08:00
LiYuRio
a8f83e3d07 Support dynamic pp scheduler in pp (#9861) (#10329) 2025-04-03 10:15:09 +08:00
Zero Rains
94142af83f [FIX] fix the bug for moe_gemm config searching in sm86 (#10325)
* fix the bug for moe_gemm config searching  in sm86

* rerun
2025-04-02 11:58:09 +08:00
Zhong Hui
4c61882b46 Support parse_yaml files. (#10321) 2025-04-02 11:25:24 +08:00
AIbin
eec767ed47 [Inference Optimize] Support MOE EP Parallel 2. fix moe_export_reduce bug (#10323)
* support MOE EP Parallel 2. fix moe_export_reduce bug

* format

* update
2025-04-01 20:48:42 +08:00
bukejiyu
4f578b9519 [Doc] update lm-serving-cuda124-cudnn9-v2.3 (#10315)
* update doc

* update images

* update
2025-04-01 19:32:57 +08:00
Yuanle Liu
5bf06241cb Fix bug pre_ids length (#10312) 2025-03-31 14:49:42 +08:00
Zhong Hui
88ca820e2b [Deprecated] Delete few used model and tools. (#10279)
* delete few used model and tools.

* fix
2025-03-31 12:06:23 +08:00
Zhong Hui
c050c6a392 Fix load torch. (#10246)
* fix load torch.

* Update serialization.py

* Update serialization.py

* re lint.
2025-03-31 11:35:08 +08:00
Zhong Hui
9df673c499 [Docs] Move docs to docs/zh (#10261)
* move docs to /docs/zh

* fix

* v1 with gpt-4o

* add deepseek part1.

* add deepseek translate part2.

* fix .readthedocs.yaml

* fix yaml.

* fix readme.

* update.

* optimizer docs.

* refine docs.
2025-03-31 09:58:04 +08:00
bukejiyu
81d7bace77 [inference]Update doc (#10278)
* update doc
2025-03-28 17:35:07 +08:00
Zhong Hui
36a8fb3273 Update index.rst (#10295)
* Update index.rst

* Update index.rst

* Update index.rst
2025-03-28 17:09:10 +08:00
yujun
d0752f383c Enhance RLHF (#10123)
* tmp update

* 对应数据流,修改infer的部分直接接收token id

* drop last

* 添加环境变量 JINGDUDUIQI

* add reinforce++

* rm info

* 新增actor_fused_pg_entropy_kl_loss

* 添加fused head loss计算

* entropy_loss

* update

* update

* 修复total_entropy_loss的错误,新增all reduce sum

* 新增optimizer的offload

* add fp32 compute

* support sharding training, add args logprob_batch_size

* per_device_eval_batch_size不能大于self.per_device_rollout_batch_size * self.num_return_sequences

* update rollout_logprob_batch_size

* 新的计算entropy梯度的方法,与原始计算等价,新增final_loss,解决entropy loss和kl loss都关闭的情况的梯度bug

* 支持32B

* sequence parallel支持动态padding到tp的倍数

* 默认关闭entropy_coeff,使用kunbo的fused head loss

* set attr save_output

* 修复temperature先除后除的bug,目前全部在fused算子里面除以.

* 修复entropy loss在tp情况下的问题,需要对entropy_loss_chunk进行all_reduce

* add pure_policy_loss and entropy_loss

* 修复entropy_from_logits的问题,使用pylayer实现VocabParallelEntropy

* truncation True, max_src_len

* rm shell

* 删除一些无用的修改

* update user

* add use_fused_head_and_loss_fn

* fix infer utils

---------

Co-authored-by: gongenlei <>
Co-authored-by: gongenlei <gongenlei@baidu.com>
2025-03-28 17:04:54 +08:00
gaoziyuan
5ff3797425 [Inference]migrate some moe file (#10292)
* migrate some moe file

* fix name
2025-03-28 15:58:08 +08:00
ltd0924
f6100806a4 [Serving] 支持配置version (#10293)
* [Serving] 支持配置version

* [Serving] 支持配置version
2025-03-28 15:35:48 +08:00
co63oc
4710fbcb8f Fix typos in multiple files (#10224)
* Fix
2025-03-27 19:19:49 +08:00
Function-Samuel
f607bad70b Add dynamic llama2-7b benchmark (#10271)
* add dynamic llama 7b benchmark

* rename dynamic suffix

* fix

* rename file

* fix

* fix

* fix

* fix
2025-03-27 14:51:28 +08:00
Yuanle Liu
712495cfc3 [MLA] move compute_out_linear out and fix bug when q_lora_rank is None (#10275) 2025-03-26 20:25:45 +08:00
AIbin
2d40d82d6e 【Inference Optimize】support MOE EP Parallel 1. (#10266)
* support MOE EP Parallel 1.

* support MOE EP Parallel 1. Changed from nranks to tp_degree
2025-03-26 19:27:15 +08:00
chen
a0c08bacb5 【Infer】MLA matrix absorption separation (#10249)
* bf16 batch gemm

* bf16 and wint8 matrix_absorption
2025-03-26 19:26:49 +08:00
Zhuoqun Li
27fa252d4e [Embedding] Add LLARA-passage and bge-en-icl with benchmark (#9887)
* move modeling.py and modeling_nv.py to transformers

* move modeling.py and modeling_nv.py to transformers and replace einops

* move modeling.py and modeling_nv.py to transformers and simplify import path

* move modeling.py and modeling_nv.py to transformers and add test_modeling

* add llara

* fix previous bug

* add bge-en-icl

* add nv-max_seq_length and update requirement

* delete irrelavent content

* update readme and delete irrelavent content

* update readme

* update readme

* update readme

* update msmarco-title file using

* update readme's paddle install

* Organize results and update readme

* update readme

* update readme

* update readme

* update readme

* add reocket qa eval_mteb.sh

* 适配RocketQA (#1)

Co-authored-by: Zhuoqun Li <2305932025@qq.com>

* update eval_mteb.sh and readme

* update eval_mteb.sh and readme

* fix modeling lint fail

* update readme and eval_mteb.sh

* update readme and eval_mteb.sh

* update readme and eval_mteb.sh

* update readme and eval_mteb.sh

* check run ok

* update results in readme

* add recall_at_10

* update recall_10 to readme

* update recall_10

* add mrr_10 and r_10 for mteb

* add scifact mrr_10 and r_10 for mteb

* fix tests

* fix tests

* fix tests

* fix tests

---------

Co-authored-by: Qiming Zhu <58735353+dfmz759837901@users.noreply.github.com>
2025-03-26 11:39:42 +08:00
liufengwei0103
0b09793921 [AutoParallel]: fix auto parallel json config error (#10126)
* [AutoParallel]: fix auto parallel json config error, test=document_fix

* fix log dir, test=document_fix
2025-03-26 10:40:07 +08:00
ooo oo
990d2b698b reopen test for zero-dim tensor (#10242) 2025-03-25 17:48:09 +08:00
bukejiyu
b62530e8bd update (#10255) 2025-03-25 14:36:15 +08:00
Weiguo Zhu
e44986b8e1 [Application] Update distill readme (#10260)
* update eval script

* update readme

* update docs

* update links
2025-03-25 12:03:44 +08:00
Yuanle Liu
f1840d549b fix src_length when --benchmark (#10237) 2025-03-25 11:27:05 +08:00
lugimzzz
be1429fbe5 fix dpop loss (#10239) 2025-03-24 21:05:35 +08:00
Zhong Hui
5b505e487b [Docs] Refactor docs. (#10223)
* refactor docs.

* Refine typos.
2025-03-24 14:39:54 +08:00
ZhenxingLi
7e0885d3d4 [AutoParallel] Add auto parallel DPO docs (#10234)
* update

* Update README.md
2025-03-24 11:55:21 +08:00
Chang Lu
d1e156af9f [Doc] add xpu doc and update llama xpu scripts (#10148)
* add xpu doc

* Update auto_trainer.py

* update amp custom list
2025-03-21 14:53:49 +08:00
lugimzzz
6bde6a2204 [LLM] fix pir problem (#10235)
* fix pir problem

* fix pir problem
2025-03-21 13:17:50 +08:00
ZhenxingLi
9fead81836 [AutoParallel] Add_llama_dpo_auto_parallel_intermediate (#10044)
* dpo_auto_intermediate

* add dpo ci dataset

* update flash_mask

* update

* update path

* update download data

* update

* update

* update

* update

* Update

* update

* Update dpo_auto_trainer.py

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update dpo_argument.py

* Update run_dpo_auto.py

* Update dpo_criterion.py

* Update trl_data.py
2025-03-20 16:32:05 +08:00
bukejiyu
d9644fc339 [Inference] fix cpu install (#10218) 2025-03-20 16:12:18 +08:00
chen
f131d62d76 【Bug Fix】Fix triton_moe shape error (#10216) 2025-03-20 00:10:59 -07:00
co63oc
3925efcea4 Fix typos in multiple files (#10115) 2025-03-20 11:18:29 +08:00
aooxin
104e304e3b [LLM] Add Minimax-Text-01 (#9893)
* add minimax-text-01 model, init.

* fix path bugs.

* add model.

* fix _get_name_mappings.

* forward pass.

* fix MiniMaxText01ForCausalLM bugs.

* add copyright.

* fix MiniMaxText01ForSequenceClassification bugs.

* fix MiniMaxText01ForSequenceClassification bugs .

* add unittest.

* add test init.

* add @require_gpu.
2025-03-20 11:06:05 +08:00
Guanbin_whu
2233a476dc Save config file for inforence in automatic parallel training (#10175)
* save config file

* isort

* pre-commit check

* use _save function to save config, change the code structure

* change the code sturcture

* change the code sturcture

---------

Co-authored-by: jeff41404 <jeff41404@gmail.com>
2025-03-20 10:23:28 +08:00
lizhenyun01
d45bbf56a6 support mla while num_head=128 (#10168) 2025-03-19 05:38:10 -07:00
Liujie0926
bf473768d8 [CI]update upload for ci (#10135)
* update upload for ci

* add build.sh

* fix

* fix paddleocr error

* fix build

* fix

* fix

* del paddlenlp_ops upload

* cp paddlenlp_ops

* fix paddlenlp_ops bos

* fix upload
2025-03-19 17:39:07 +08:00
Liujie0926
98b084f69d [CI]fix bug for deepseek_data & paddleocr2.10_install & paddlenlp_ops whl (#10183)
* fix deepseek_data & paddleocr2.10_install

* update paddlenlp_ops bcebos
2025-03-19 16:43:54 +08:00
ltd0924
d1e956e6e1 [LLM] add port check and fix bugs (#10153) (#10195)
* [LLM] add port check and fix bugs

* [LLM] fix stream output

* [LLM] delete unused param

* [LLM] fix start script
2025-03-19 15:03:01 +08:00
Zhong Hui
f3e85d40db Delete dead links (#10188)
* Update README.md

* Delete docs/llm/auto_parallel/llama/README.md
2025-03-19 12:56:38 +08:00
freeliuzc
d234592a91 [Docs] update_docs (#10180) 2025-03-18 17:15:22 +08:00
Function-Samuel
9d6f81bb54 [Benchmark] modify config (#10181) 2025-03-18 17:14:30 +08:00
ZhenxingLi
33998272bc Update auto_trainer.py (#10170) 2025-03-18 16:22:10 +08:00
waliwali777
4afa702903 Add auto_parallel_sync_shared_params pass flag (#10057)
* fix gpt auto embedding dims_mapping[-1,1]

* add auto_parallel_sync_shared_params flag

* fix
2025-03-18 15:27:22 +08:00
waliwali777
5faa8ee771 [benchmark] Open rc for gpt (#10160) 2025-03-18 15:26:48 +08:00
Jie.Z
e8ad2fa854 Add Contrastive Learning (#10097)
* add_contrastive_learning
2025-03-18 14:38:38 +08:00
yulangz
4ed355a03a [Inference] Support deepseek on xpu (#10060)
* support deepseek on xpu

* remove useless comment

* fix

* support serving
2025-03-18 14:37:12 +08:00
Jie.Z
5475a8a067 Add XLMRoberta in Embedding Train (#10074)
* add xlmroberta in embedding train
2025-03-18 14:34:50 +08:00
gaoziyuan
63c4ea47b0 [Inference] Migrate MoE Kernel from Paddle Inner (#10063)
* save

* backup

* add moe_dispatch&moe_reduce

* add dongzhuanjing

* fix dispatch precis

* rm cutlass_extention

* add zkk inner commit

* fix

* add fused_moe

* add glog third party

* add fused_moe

* formar code style

* fix

* rm gemm config

* add test

* fix

* fix

* fix glog install

* add yazhu fix

* fix

* fix

* fix

* rm glog

* fix

* fix

* fix

* fix glog

* fix

* fix ci
2025-03-18 14:33:10 +08:00
zhaohaixu
550a558707 [predict] fix ddp bug for predict benchmark. (#10171) 2025-03-17 20:28:57 -07:00
Zero Rains
d7250f06bb Fix the bug in tiny_fused_bloom::test_wint8 (#9307) 2025-03-18 11:03:37 +08:00
Zhong Hui
8e213b4691 Update README.md (#10167)
DeepSeek-R1满血版单机部署实测
2025-03-17 20:26:23 +08:00
Weiguo Zhu
8fcd2ee5e3 [Application] Distill and finetune LLM (#10061)
* add distill files

* update

* add requirements.txt

* update filename and add readme

* update readme

* update

* update requirement.txt

* update

* update readme

* update table
2025-03-17 20:23:48 +08:00
lizhenyun01
8c57cc1497 [Hot Fix] hotfix for param decoder_chunk_size_cpu (#10111) 2025-03-17 01:31:14 -07:00
Function-Samuel
2415083412 fix (#10139) 2025-03-17 14:48:07 +08:00
Yuanle Liu
4fe19817d3 [Tools] add tool safetensors_filter (#10140)
* add tool safetensors_filter

* add metadata

* add comment

* add comment
2025-03-16 22:50:55 -07:00
xuxinyi389
2703ea15da [AutoParallel] Add ci for deepseek-v3 (#10064)
* add_ci

* fix

* fix

* open test on a100
2025-03-17 11:49:03 +08:00
AIbin
1998914d8f [Hot Fix] hotfix for param decoder_chunk_size_cpu (#10144)
* support qwen2_5_vl

* support qwen2_5_vl

* fix bug

* update support qwen2_vl & qwen2_5_vl & support multi models mapping

* fix BUG
2025-03-16 20:05:44 -07:00
liufengwei0103
b141f86d6a [AutoParallel]: fix bug because of renaming file (#10132) 2025-03-17 11:05:04 +08:00
Function-Samuel
44144a5753 Support reshard attention mask in intermediate_api (#10137)
* support reshard attention mask in intermediate_api

* fix_test

* set pp=1 in intermediate test case

* fix

* fix

---------

Co-authored-by: liym27 <33742067+liym27@users.noreply.github.com>
2025-03-17 10:57:20 +08:00
l1cacheDell
dd774f1223 [Hot Fix] hotfix for param decoder_chunk_size_cpu during LLM inferencing (#10141)
* hotfix for a param

* bugfix2
2025-03-14 05:28:52 -07:00
Guspan Tanadi
42ba2c0ad2 [docs]: update section links (#9717)
* docs(compression): section links

* docs(compression): section links step
2025-03-13 17:50:35 +08:00
liym27
1056fd7599 [AutoParallel] Pre alloc memory (#9979) 2025-03-13 15:56:55 +08:00
blacksheep-Aristotle
24039c6701 fix reshard_qkv alltoall error (#9949) 2025-03-13 15:01:11 +08:00
ltd0924
f68aadad26 [LLM] fix config reload (#10114)
* [LLM] fix config reload

* close md5 check

* Update processor.py

* Update download_model.py
2025-03-13 14:18:36 +08:00
vivienfanghuagood
ee3de2682c add_benchmark (#10110)
* add_benchmark
2025-03-13 12:08:59 +08:00
ZhenxingLi
94dd1d86a4 [AutoParallel] Fix qwen2vl image shape (#10086)
* Update auto_trainer.py

* Update auto_trainer.py
2025-03-13 11:40:09 +08:00
lizhenyun01
f6c0e6db0b optimize mla to get best performance (#10102)
* support auto search for mla chunksize

* optimize mla to get best performance

* fix

* add note for mla
2025-03-13 11:05:04 +08:00
co63oc
6a8e047057 [Typos] Fix typos (#9933) 2025-03-13 09:56:01 +08:00
Zhong Hui
e5a41fac94 Update README.md for paddlenlp 3.0 beta4 (#10098)
* Update README.md for paddlenlp 3.0 beta4

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
2025-03-12 21:49:45 +08:00
liufengwei0103
183cd790bc [AutoParalle] update README.md (#10033)
* update README.md

* format

* delete intermidate_api

* add more explanation about code example

* add more explanation about code example

* update web ref

* refine infer readme

* fix path

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* refine according to comment

* update recommended paddle version 3.0-rc

* fix bug

* fix bug

* change arg ref to github file

* fix typo

* update paddle version

* add json config, move readme to auto_parallel dir

* fix

* fix

* delete qwen shell launch example

* recover gpt input data config

* recover gpt config

* recover gpt config

* recover gpt config

* update code example path hint

* move line

* change name style

* delete ppo

* normalize task name

* normalize task name

* normalize task name

* fix gpt json config

* recover qwen debug file

* delete run_pretrain_auto.sh
2025-03-12 20:34:27 +08:00
Zhong Hui
d8d6bec83a Refine inference doc (#10090)
* refine inference doc

* refine

* Rename inference.rst to inference_index.rst

* Update index.rst
2025-03-12 20:10:30 +08:00
ltd0924
79dbdbb3aa [LLM] fix speculate_decoding output bug (#10106) 2025-03-12 18:06:54 +08:00
Ting
3d023bd10f Support deepseek-v3/loraGA/ on xpu (#9928)
* support deepseek-v3/loraGA/ on xpu

* fix ds2 config

* fix ds3 eval

* fix seq_aux_loss, weight load time consume, moe tp

* Optimize code of expert dispatch

* optimize moe expert dispatch

* remove redunctant code.

* EP support, MTP fix

* remove print

* add alltoall backward

* fix all2all bwd

* support drop tokens, disable acc cal

* fix bug

* add base_model_prefix in ds3 modeling pp

* fix ci shape mismatch

* update
2025-03-12 18:03:56 +08:00
Liujie0926
985075fcbe [CI]Fix proxy (#10104)
* add set -e for unittest

* update proxy

* fix
2025-03-12 17:50:51 +08:00
freeliuzc
83b1a6f241 Fix serving allocate block bug (#10100) 2025-03-12 15:11:10 +08:00
Yuanle Liu
762a680d30 [Inference] Update docs (#10089)
* change_h100_to_h800

* Update README.md
2025-03-12 14:24:16 +08:00
Yuanle Liu
a37512ff7d [Inference] Enhance fused_rotary_position_encoding and get_position_ids_and_mask_… (#10077)
* enhance fused_rotary_position_encoding and get_position_ids_and_mask_encoder_batch

* update

* fix src_length

* update

* update

* fix ci
2025-03-12 14:17:39 +08:00
ltd0924
9408f4c3ce [Doc] 完善文档,更新示例模型 (#10084)
* [Doc] 完善文档,更新示例模型

* [Doc] 完善文档,更新示例模型

* [Doc] 完善文档,更新示例模型

* fix bug

---------

Co-authored-by: luotingdan <luotingdan@baidu.com>
2025-03-12 11:27:44 +08:00
lizhenyun01
6d80be73ba [INFER] auto set mla_use_tensorcore (#10095) 2025-03-12 10:32:25 +08:00
lzy
f85f1e9bf3 supports mla wg4(Low-precision accumulation) (#10072)
* Support MLA by using 4 WG
2025-03-11 18:14:59 +08:00
ShenLiang
034e4d85e0 Fix oom in dsv3 (#10068) 2025-03-11 16:36:55 +08:00
Zhong Hui
c27a341e30 Remove not need files (#10079) 2025-03-11 16:08:48 +08:00
Zhong Hui
bffd3b549b Skipping 0-D tensor Error. (#10075) 2025-03-11 16:00:19 +08:00
ltd0924
f6ad587ad7 [Doc] 文档完善,新增模型环境设备需求 (#10071)
* [Doc] 文档完善,新增模型环境设备需求

* [Doc] 文档完善,新增模型环境设备需求

---------

Co-authored-by: luotingdan <luotingdan@baidu.com>
2025-03-11 15:15:32 +08:00
Liujie0926
2e8b5d2d55 fix case only in a100 (#10054) 2025-03-11 15:03:32 +08:00
ZhenxingLi
354be23c8f [AutoParallel] Get dtensor from ShardDataloader (#10009)
* get dtensor from ShardDataloader and acc split

* Rename dtensor_idx to dense_tensor_idx

* fix 2D dense_tensor_idx

* Update auto_trainer.py

* Update auto_trainer.py
2025-03-11 15:02:54 +08:00
Yuanle Liu
a3942c8974 update total_max_length use export model (#10052) 2025-03-11 14:58:16 +08:00
chen
3421d486df Fix MTP triton cache not found (#10066) 2025-03-11 14:34:23 +08:00
Zhong Hui
8db460e586 add model list to doc. (#10031) 2025-03-11 14:10:06 +08:00
will-jl944
92a75980a8 Fix eval pp bug when do_train is false (#10012) 2025-03-11 14:04:43 +08:00
lugimzzz
4cd17eaf49 [LLM]support groupwise quant for llama (#10050)
* support groupwise quant for llama

* support groupwise quant for llama
2025-03-11 12:39:28 +08:00
Function-Samuel
a23e504e4b Fix flash_attn diff in base api (#10027) 2025-03-11 11:13:40 +08:00
Yichen Zhang
e1536c0d5c Add import check of local_layer (#10036) 2025-03-11 10:57:37 +08:00
risemeup1
b35f79efd2 [fp8] Support deep gemm in paddle (#9955)
* support fp8 gemm

* support fp8 gemm

* fix

* fix

* update deepGeem remote

* fix test_gemm

* support group_gemm

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* fix
2025-03-11 10:51:11 +08:00
Liujie0926
dfe3a2878c update wheel's name of paddlenlp_ops (#10047)
* update wheel's name

* fix exit

* update paddlenlp_ops install

* fix
2025-03-10 21:51:39 +08:00
liym27
15fbec8813 Revert "[AutoParallel] Support reshard attention mask in intermediate_api (#9…" (#10067)
This reverts commit c9d8e3aabd.
2025-03-10 21:35:50 +08:00
Zhong Hui
219e709889 Update devices README.md (#10062)
* Update README.md
2025-03-10 20:17:13 +08:00
ltd0924
814cc4507d [LLM] fix bug (#10058)
Co-authored-by: luotingdan <luotingdan@baidu.com>
2025-03-10 17:58:51 +08:00
liym27
c9d8e3aabd [AutoParallel] Support reshard attention mask in intermediate_api (#9975) 2025-03-10 17:39:10 +08:00
Zhong Hui
8452021418 Update static_models.md (#10053) 2025-03-10 17:17:02 +08:00
dimensionplane
6861e1749d [LLM] Update GLM (#10000)
* Update GLM

* glm

---------

Co-authored-by: wangxueyang <xueyang.wang@aminer.cn>
2025-03-10 16:30:58 +08:00
bukejiyu
2506f448f5 [server]Add a model download script and fix bugs for the server. (#10034)
* fix

* fix download

* fix

* fix

* support download

---------

Co-authored-by: ltd0924 <32387785+ltd0924@users.noreply.github.com>
2025-03-10 15:00:05 +08:00
ltd0924
098f2348d2 [Doc] 自行下载模型文档说明 (#10048)
* [Doc] 自行下载模型文档说明

* [doc] 支持用户自行下载静态图

* [doc] 支持用户自行下载静态图

* [Doc] fix format

---------

Co-authored-by: luotingdan <luotingdan@baidu.com>
2025-03-10 14:19:00 +08:00
Liujie0926
4554b1cdb6 [CI]Fix ci scripts (#10045)
* update loss_base by Paddle#71301

* fix spelling error

* fix exit code rerun

* fix upload
2025-03-10 14:05:57 +08:00
lzy
ef9aecc0ec [MLA] make MLA supports blocksize 32 (#10039)
* make mla supports blocksize 32

* make mla supports append
2025-03-10 11:58:21 +08:00
Chang Lu
a8ee9438ad [XPU] add llama 7b&13b xpu scripts (#10025)
* add xpu scripts

* Update modeling_auto.py
2025-03-10 11:15:14 +08:00
Guoxia Wang
59fbc79bc0 Add enable_offload_queue to PipelineParallel (#9708) 2025-03-10 10:54:55 +08:00
umiswing
da96c7258e add rdma config hint (#10040) 2025-03-09 20:42:56 +08:00
bukejiyu
a9fd4082a5 update doc (#10028) 2025-03-09 16:06:19 +08:00
Weiguo Zhu
bcc9236344 fix (#10037) 2025-03-09 11:55:08 +08:00
l1cacheDell
23a4880866 [Performance optimization] Sage Attention Enhancement (#10021)
* fuse all sageattn kernels & unified API entry

* remove files

* bug fix

* upload header file
2025-03-07 17:48:18 +08:00
blacksheep-Aristotle
a99829122d [Auto] Using auto parallel to validate SFT/LORA of llama model (#9728)
* add single_model network and use intermediate api

* [AutoParallel]: fix llama_model_network run error

* New version of auto config

* fix gpt_network to use intermediate_api

* fix gpt_network to use intermediate_api

* update api

* update plan

* qwen fit base api

* [AutoParallel]:gpt single network support tp to share_embedding

* add intermediate ci

* add single_model network and use intermediate api

* New version of auto config

* fix sharding

* fix gpt_network to use intermediate_api

* fix gpt_network to use intermediate_api

* update gpt run_pretrain_py

* fix sharding error

* fix gpt format error

* [AutoParallel]:fix llama vpp ci error

* [AutoParallel]:fix ipp error

* [AutoParallel]:fix a100 ci error

* [AutoParallel]:fix a100 ci error

* [AutoParallel]:add explanatory note

* Delete =1.0.0

* [AutoParallel]:add run_fintune scripts

* [AutoParallel]:auto parallel support lora model

* update auto_lora_model

* update auto_lora_model

* [AutoParallel]:nlp support run lora model with intermediate

* [AutoParallel]:update format

* [AutoParallel]:support input attentionmask

* [AutoParallel]:shard dataloader support multi inputs

* [AutoParallel]:auto_sft rebase develop

* [AutoParallel]:auto_sft rebase develop

* [AutoParallel]:fix lora parallel mode

* [AutoParallel]: fix bug about file dep circular and lora config error

* [AutoParallel]: recover default base api config in launch script

* [AutoParallel]: add to do

* [AutoParallel]: add to do

* add single_model network and use intermediate api

* [AutoParallel]: fix llama_model_network run error

* New version of auto config

* fix gpt_network to use intermediate_api

* fix gpt_network to use intermediate_api

* update api

* update plan

* qwen fit base api

* [AutoParallel]:gpt single network support tp to share_embedding

* add intermediate ci

* add single_model network and use intermediate api

* New version of auto config

* fix sharding

* fix gpt_network to use intermediate_api

* fix gpt_network to use intermediate_api

* update gpt run_pretrain_py

* fix sharding error

* fix gpt format error

* [AutoParallel]:fix llama vpp ci error

* [AutoParallel]:fix ipp error

* [AutoParallel]:fix a100 ci error

* [AutoParallel]:fix a100 ci error

* [AutoParallel]:add explanatory note

* Delete =1.0.0

* [AutoParallel]:add run_fintune scripts

* [AutoParallel]:auto parallel support lora model

* update auto_lora_model

* [AutoParallel]:nlp support run lora model with intermediate

* [AutoParallel]:update format

* [AutoParallel]:support input attentionmask

* [AutoParallel]:shard dataloader support multi inputs

* [AutoParallel]:auto_sft rebase develop

* [AutoParallel]:auto_sft rebase develop

* [AutoParallel]: add lora ci and fix bug

* [AutoParallel]: fix lint error

* [AutoParallel]: fix lint error

* [AutoParallel]: fix lint error

* [AutoParallel]: fix ci error about print model

* [AutoParallel]: fix typo

* [AutoParallel]: fix

* [AutoParallel]: fix llama_dygraph_auto_bs8_fp16_DP2-MP2-PP2_intermediate loss base

* [AutoParallel]: delete typo

* [AutoParallel]: delete comment

* [AutoParallel]: fix ci error not on a100

* [AutoParallel]: delete comment

* [AutoParallel]: delete useless code

* [AutoParallel]: ddelete launch script

* [AutoParallel]: recover label mesh to

* [AutoParallel]: fix ci error

* [AutoParallel]: fix loss in ci

* [AutoParallel]: revert editing to max_length padding

* [AutoParallel]: delete comment

* update llama lora test case loss

* add blank line

* delete commment

* format

* delete last slash

* add deterministic flag

---------

Co-authored-by: YuangLiu <liuyuang@baidu.com>
Co-authored-by: liufengwei02 <liufengwei02@baidu.com>
2025-03-07 17:47:13 +08:00
xuxinyi389
3d5cac9df1 [AutoParallel] Add deepseek-v3 config (#10019)
* add_config

* update_config

* update_config

* add_describe
2025-03-07 17:33:40 +08:00
tianshuo78520a
63d920b565 del update_inputs.cu (#10022) 2025-03-07 00:54:58 -08:00
ltd0924
19e10ba59e [LLM] fix llm model path and support download from txt (#10026)
* [LLM] fix llm model path and support download from txt

* [LLM] fix llm model path and support download from txt
2025-03-07 16:28:54 +08:00
vivienfanghuagood
1db27cdaf9 Support mmlu-pro (#10023)
* add_mmlu

* update

* add_gsk8k

* add_mmlu_pro

* add
2025-03-07 15:00:09 +08:00
Weiguo Zhu
34d2980658 [News] update readme (#10020)
* new

* update

* update
2025-03-07 14:16:18 +08:00
freeliuzc
3dc05ada30 update spec docs (#10016) 2025-03-07 13:32:03 +08:00
ShenLiang
d2a976466a Add deepep for deepseekv3 (#10007) 2025-03-07 11:25:16 +08:00
freeliuzc
df10f2c615 update doc (#10014) 2025-03-06 21:13:32 +08:00
Weiguo Zhu
4711e147a1 Update version (#10015) 2025-03-06 20:35:49 +08:00
bukejiyu
0a665a0418 [inference]add docker doc (#9998)
* add doc

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* [LLM] 服务化部署文档

* update

* [LLM] 服务化部署文档

---------

Co-authored-by: ltd0924 <32387785+ltd0924@users.noreply.github.com>
2025-03-06 18:40:06 +08:00
zhangyuqin1998
5329d28881 [Distribution] Support DualPipeV for GPT3 (#9993)
* [Distribution] Support DualPipeV in GPT3

* fix

* fix
2025-03-06 17:21:27 +08:00
lizhenyun01
80272fd51c Default set FLAGS_cascade_attention_max_partition_size as 32K (#10013) 2025-03-06 17:15:25 +08:00
chen
385f613f09 Remove some bug config for block gemm (#10002) 2025-03-06 17:14:37 +08:00
Weiguo Zhu
fce1bf5399 update license (#10003) 2025-03-06 16:55:36 +08:00
Weiguo Zhu
658bec29dd [LLM] Fix MTP for pipeline parallel (#9972)
* fix params loading
2025-03-06 16:22:26 +08:00
Weiguo Zhu
51ea8a42b8 [Doc] Add Qwen/QwQ-32B model ids (#10005)
* update Qwen models

* merge
2025-03-06 14:54:32 +08:00
ltd0924
a313a26f73 [LLM] support fix seq len and cmd run service (#10004)
* [LLM] support fix seq len

* [LLM] support cmd run service

* [LLM] support cmd run service
2025-03-06 14:51:27 +08:00
l1cacheDell
b36d306a65 [Feat] Sage Attention Kernels Support for sm80, sm89, sm90 (#9848)
* add sage attn sm90 kernels

* fix

* add ds sageattn kernel

* update kernels

* update setup_cuda.py

* update dsk MLA kernel

* clean PR branch

* fix sa usage

* bugfix

* modify, for static mode inference SA

* add license info

* add license info for py file

* modify license info

* modify license info

* bsz=1 assert

* fix kernel

* move to import line

* merge develop & support wint8&fp8
2025-03-06 14:47:07 +08:00
Yuanle Liu
ed7f01da68 [Inference] Add deepseek doc (#9964)
* add deepseek doc

* fix dead links

* remove png

* fp8 for mtp

* check

* add weight_block_size and moe_quant_type

* Update inference.md

* add server

* fix

* update

* Update deepseek.md

* update

* update

---------

Co-authored-by: DrownFish19 <DrownFish19@gmail.com>
Co-authored-by: ckl117 <ckl117@163.com>
Co-authored-by: bukejiyu <395822456@qq.com>
2025-03-06 14:12:57 +08:00
umiswing
a381674fd4 Add moe flex dispatcher (#9977)
* add wip flex dispatcher

* wip fix PyLayer segfault

* remove redundant args

* refine

* add group as args

* add license, fix a bug

* refine codestyle

* refine
2025-03-06 11:49:26 +08:00
ltd0924
2c1b1062e0 [LLM] Support for automatic deployment of services, modification of environment variable names (#9966) 2025-03-06 11:41:28 +08:00
gaoziyuan
2921a5168e 【Inference】Add benchmark client test scripts (#9996)
* add benchmark client scripts

* add benchmark client scripts

* add benchmark client scripts

* add benchmark client scripts

* add benchmark client scripts

* add benchmark client scripts
2025-03-05 19:36:35 -08:00
Function-Samuel
c98163bd51 [AutoParallel] Support intermediate_api baichuan test (#9988) 2025-03-06 11:19:58 +08:00
lizhenyun01
47e32664af [DSK] fix tenercore precision while split kv (#9994)
* fix tenercore precision while split kv

* fix

* fix

* fix

* update unittest
2025-03-05 18:12:02 -08:00
Weiguo Zhu
2773ce3e44 fix prm test (#9997) 2025-03-06 09:32:56 +08:00
xuxinyi389
ab1a90cd00 [AutoParallel] Add pp stage id (#9965)
* add_pp_stage_id

* fix some bugs in dygraph pipeline parallel

---------

Co-authored-by: Yichen Zhang <zhangyichen03@baidu.com>
2025-03-05 21:03:13 +08:00
Yuanle Liu
614d10a34b [LLM INFER] update step_paddle (#9991)
* fix step_paddle
2025-03-05 19:52:25 +08:00
ming1753
9f93974e60 [DSK] DeepSeek Support FP8 (#9956)
* DeekSeek suport FP8

* support fp8 block gemm and group quant

* support fp8 gemm with tensor scale tune on sm90

* support read weight_block_size from model config.json

* move tune_fp8_gemm.sh to csrc

* coptimize per_token_group_quant_fp8_api

* support per_token_group_quant_fp8_api transpose_scale True

* optimize preprocess_for_moe

* support tensor core mla

* check fp8 code and support wint8-moe in R1-FP8-small
* deepseek fp8 support moe wint8


---------

Co-authored-by: ckl117 <ckl117@163.com>
Co-authored-by: zhoutianzi666 <17801055074@163.com>
2025-03-05 19:05:51 +08:00
lugimzzz
5ada4dbe99 fix ci (#9989) 2025-03-05 15:47:50 +08:00
Chang Lu
d6fc58dbcf fix profile tool (#9976) 2025-03-05 15:39:10 +08:00
Tian
eb25ccb618 [LLM] add moe parallel groups (#9982) 2025-03-05 15:37:09 +08:00
greycooker
fd0da9381b Fix wandb proxy (#9960) 2025-03-05 15:02:58 +08:00
freeliuzc
14c829eac3 Fix mtp speed (#9987)
* fix mla's precision

* modify mtp serving strategy

---------

Co-authored-by: carryyu <569782149@qq.com>
2025-03-05 12:31:57 +08:00
lugimzzz
f4d4eea5e2 [LLM]fix ci (#9986) 2025-03-05 11:15:17 +08:00
Zhong Hui
4c2a3f76be Update paddle_patch.py (#9984) 2025-03-04 20:48:28 +08:00
Yuanle Liu
91d1a2343c [Inference] MLA use tensor core (#9952)
* mla use tensor core

* update

* update cutlass

* fix

* fix

* add some logic

* 耗时异常

* fix

* update

* fix mla split_kv

* support write cache

* write spec cache

* fix infer.py mla_absorb

* fuse noaux_tc

* fix server

* fix dybatch

* fix start_server.sh

* support mtp with new version

* fix mtp dynamic bug

* fix server

* fix mla's precision and del unused code

* fix mla_hopper.h

---------

Co-authored-by: lizhenyun01 <1500424927@qq.com>
Co-authored-by: freeliuzc <lzc842650834@gmail.com>
Co-authored-by: carryyu <569782149@qq.com>
2025-03-04 19:57:58 +08:00
bukejiyu
a99d6ada59 [Inference] refine csrc/tools/build_wheel.sh (#9971)
* update gpu whl

* add

* update
2025-03-04 01:57:30 -08:00
Chang Lu
55d57fbffc Change llama loss on xpu (#9973) 2025-03-04 16:57:40 +08:00
Zhong Hui
cf4e9c8ed1 Update paddle_patch.py (#9978) 2025-03-04 15:01:17 +08:00
vivienfanghuagood
350acbfb19 Support MMLU eval (#9967)
* add_mmlu

* update

* add_gsk8k
2025-03-04 11:39:53 +08:00
Zhong Hui
5100d08da7 Fix update paddle_patch.py (#9968) 2025-03-04 11:00:52 +08:00
jax
cda527960d Longlora (#9970)
* longlora-paddle

* update tests for longlora

* update longlora test

* update modeling

* update test

* update test

* update test

* update

* update
2025-03-04 10:34:39 +08:00
lugimzzz
cc925d0aea [MergeKit]add log (#9948)
* add log

* add log
2025-03-03 20:49:12 +08:00
lugimzzz
4b65eecb2d [llm]add bf16 moment adamw (#9732)
* add adam

* add triton ops

* update model

* add

* add triton ops

* fix

* fix

* support 16bit

* support 16bit
2025-03-03 17:21:06 +08:00
Yichen Zhang
5936abec96 [AutoParallel] Add auto parallel moe layer (#9886)
* add auto parallel moe layer

* add local layer in MoELayer

* add expert parallel with dygraph auto parallel

* expert parallel in static auto parallel
2025-03-03 14:58:48 +08:00
Zhong Hui
10dd453b40 [Feature] Support float8 dtype storage and deepseek v3 with fp8 inference. (#9906)
* suppport float8 dtype.

* fix

* fix for empty shape.

* Support load fp8 model.

* debug

* [DeepSeek] Support for float8 loading and inference.

* Add paddle patch.

* refine safetensors.

* refine code.

* Fix moe dtype error.

* fix paddle.Tensor.

* fix kwargs with patch api.

* fix for fast safe open

* fix merge kit.

* fix inference.

* remove set device.
2025-03-03 14:54:45 +08:00
nunnunko777
8a8c64f9fb Add Process Reward Model. (#9598)
* Add Process Reward Model.

* Support return_dict=True

* reimplement prm & support Mistrail.

* lowercase in mode path

* tokenizer add_special_tokens=False for placeholder & reward tokens

* support flash mask

* add prm tests

* causal mask

* fix import error of LlamaLMHead & MistralLMHead

* fix import error of LlamaLMHead & MistralLMHead

* verify loss computation

* fix rag reward_tokens

* fix arg reward_tokens

* Lint

* Lint

* Lint

* add test

* remove redundant notes.

* add readme doc

* fix import error
2025-03-03 11:49:45 +08:00
Weiguo Zhu
5477fb85c5 [doc] update config and add docs for grpo (#9962)
* add grpo doc and config

* update ppo

* update

* update

* update

* lint

* update doc

* skip ci
2025-03-03 10:02:23 +08:00
Weiguo Zhu
40c3530dff [RL] Fix PPO and add GRPO (#9925)
* fix ppo and grpo v1

* update grpo

* delete notes and modify argument (#10)

* [RL] Fix PPO and add GRPO  (#11)

* delete notes and modify argument

* delete ppo_config.json

* modify format

* lint

* fix model config set

* fix grpo (#12)

* [New Features] support json file data (#13)

* delete notes and modify argument

* delete ppo_config.json

* modify format

* support json data

* modify argument

* fix

* fix ci

* fix

* fix datapath (#14)

* delete notes and modify argument

* delete ppo_config.json

* modify format

* support json data

* modify argument

* fix data

---------

Co-authored-by: greycooker <94276438+greycooker@users.noreply.github.com>
Co-authored-by: gongel <ainlp88@qq.com>
2025-02-27 21:01:30 +08:00
freeliuzc
85e1238ace 1.fix dynamic_forward of mtp. 2.fix llama-eagle multi-device (#9947) 2025-02-27 20:48:00 +08:00
kevin
02bf7c8dbc [LLM] update llm server dockerfiles (#9940)
* [LLM] update llm server dockerfiles

* update llm dockerfile
2025-02-27 16:39:16 +08:00
Weiguo Zhu
00f1e66c5a [requirements] tokenizers for py38 (#9953) 2025-02-27 16:31:36 +08:00
blacksheep-Aristotle
45b50121b5 use training_args to contorl split input (#9943) 2025-02-27 11:45:32 +08:00
Yuanle Liu
72dd32d903 [DSK] Implement mla use matrix-absorption (#9875)
Implement matrix-absorption version of MLA

---------

Co-authored-by: lizhenyun01 <1500424927@qq.com>
Co-authored-by: lizhenyu04 <lizhenyu04@baidu.com>
2025-02-26 22:10:39 +08:00
Siming Dai
011ae71a8f [Unified Checkpoint] Fix split param loading directly when using ignore_merge_optimizer (#9935)
* fix

* refine code

* update typename
2025-02-26 16:02:14 +08:00
xuxinyi389
b6956a3905 [Autoparallel] Mtp for DeepSeekV3 (#9884)
* refine log

* fix

* add model args

* suppoort_deepseekv2_autoparallel_with_DP/MP

* poolish

* remove_env_set

* update_code

* add_v3

* support_sharding

* move_to_v3

* fix_typo

* update_v3_config

* refine

* refine

* fix

* fix

* fix

* fix

* fix

* mtp_for_v3

* deepseekv3_for_pp

* update_run_pretrain_auto.sh

* update_sh

* fix_typo

---------

Co-authored-by: zhangbo9674 <zhangbo54@baidu.com>
2025-02-26 14:54:51 +08:00
freeliuzc
f60f83e541 【Inference】Support mtp serving (#9936)
* Unify the mtp usage of predictor and serving.

* 1.support speculate complicated args. 2.format serving code

* 1. support mtp serving.  2. Unify Spec argument

* fix mtp serving

* merge develop

* delete debug

* support serving compute accept_ratio
2025-02-26 14:04:21 +08:00
ZiyiHuang
c71287d1fc [taskflow] Fix taskflow bug (#9930)
* fix

* add doc

* update docs

* add experiment

* update readme.md

---------

Co-authored-by: DrownFish19 <DrownFish19@gmail.com>
2025-02-25 19:08:08 +08:00
Weiguo Zhu
7acaf18fa1 [LLM] Add MTP for Deepseekv3 (#9876)
* mtp

* MTP

* update deafult config

* update MTP

* update seq_aux_loss

* update output

* lint

* fix for qwen2moe
2025-02-25 13:28:25 +08:00
Function-Samuel
9790880fc2 Support intermediate_api qwen test (#9910)
* split from pr9882

* gate_up_fused_proj
2025-02-25 12:53:01 +08:00
Function-Samuel
694bb50c68 Support intermediate_api gpt-3 test (#9912)
* split from pr9882

* fix
2025-02-25 12:51:59 +08:00
Yuanle Liu
30df8b6b6a [DeepSeek] Fix some bugs for dsk-v3 (#9874)
* use fused rope

* fix import
2025-02-24 11:58:17 +08:00
AIbin
0b26a02d0b [Inference] Support qwen2_5_vl (#9924)
* support qwen2_5_vl

* update support qwen2_vl & qwen2_5_vl & support multi models mapping
2025-02-24 11:01:51 +08:00
zhaohaixu
0c65ce7f9c [LLM] fix block_size setting for llama. (#9921) 2025-02-21 17:57:21 +08:00
Liujie0926
c65dc182c7 [CI]update ci scripts (#9889)
* update ci scripts

* upload fail_log to bos

* fix unittest

* fix

* paddlenlp_ops build

* fix env

* revert

* fix log
2025-02-21 14:06:51 +08:00
Sijun He
a095e97929 Update finetune.md (#9922) 2025-02-21 13:53:19 +08:00
lugimzzz
b8ebe3ee0d add count trained tokens (#9800)
* add count

* fix

* fix
2025-02-20 16:40:40 +08:00
bukejiyu
347d77ccc2 add gpu whl (#9890) 2025-02-20 14:08:04 +08:00
Weiguo Zhu
7ea422863f [DOC] PP-UIE (#9913) 2025-02-20 11:39:42 +08:00
liym27
b49d9ff37c [Benchmark] Align benchmark conf for static baichuan2 gpt3 (#9901)
* align benchmark conf for static baichuan2 gpt3

* align benchmark conf for static qwen-14b

* fix scripts
2025-02-20 11:37:17 +08:00
Weiguo Zhu
2e1d57bb6f [DOC] Update README for PP-UIE (#9911)
* update doc for pp-uie

* update
2025-02-20 11:16:08 +08:00
ZiyiHuang
3a5e9b831f [LLM-IE] Add pp-uie to Taskflow (#9845)
* fix taskflow

* add llm/ie for SFT of ie task

* remove data folder

* update readme

* add taskflow

* remove taskflow

* add sft for ie task

* add multi_stage_predict of taskflow

* fix some bug and rename qwen2 as uie-llm

* fixed test and lint

* fixed test and lint

* fixed test and lint

* update 0109

* update 0109

* update 0113

* updaate 0113

* remove static mode in taskflow

* update 0115

* update 0115

* update 0115

* update 0116

* update 0116

* update readme.md

* update readme.md

* update 0116

* update taskflow.py and readme.md

* rename model name

* update
2025-02-20 10:26:15 +08:00
Weiguo Zhu
777fc2793f [TaskFlow] Fix pir for taskflow (#9822)
* fix pir for taskflow

* update suffix for PIR(ON/OFF)

* fix and revert skip

* update dependency_parsing

* fix pir bug

* fix pir bug

* fix lint

* fix ci

* disable test case

---------

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
Co-authored-by: Fantasy-02 <1026931135@qq.com>
2025-02-20 10:21:53 +08:00
freeliuzc
11684064d6 [Inference] Fix deepseek_v3 with mtp in multi-gpu mode (#9894)
* fix deepseek_v3 with mtp in multi-gpu mode

* fix IWR bug
2025-02-19 20:22:01 +08:00
liym27
08183d7fea [CI] Update the best conf for gpt-13b in dygraph mode (#9891)
* update the best conf for gpt-13b in dygraph mode

* fix run mode
2025-02-19 15:54:53 +08:00
Longzhi Wang
7e9052a921 【SpecInfer】修复 InferenceWithReference 接收率不高的 bug (#9880) 2025-02-18 22:41:43 -08:00
ltd0924
60ef0afaf8 [Server] Support multi machine deployment (#9872) 2025-02-19 13:31:42 +08:00
lugimzzz
775ed2ad36 fix (#9885) 2025-02-19 11:47:57 +08:00
liym27
8e4ff0743c [Test] Suppport intermediate_api llama test (#9850)
* suppport intermediate_api llama test
* fix
* add 70b
2025-02-18 15:40:53 +08:00
xuxinyi389
c42a3d6270 [AutoParallel]support_ppo_ckpt (#9823)
* support_ppo_ckpt

* fix readme

* fix_typo
2025-02-18 15:31:40 +08:00
Weiguo Zhu
71bfc333ad [Docs] news of DeepSeek (#9834) 2025-02-18 12:07:43 +08:00
Zhong Hui
ac980d3dc2 [Docs] fix docs for inference and servering (#9877)
* fix docs.

* refine docs.

* inference servering doc to one.

* fix

* refactor.

* fix link.

* add flask server doc.

* fix typo.

* model with new tab.
2025-02-17 19:25:45 +08:00
Zhuoqun Li
2e06a18d7a [LLM] move modeling.py and modeling_nv.py to transformers (#9676)
* move modeling.py and modeling_nv.py to transformers

* move modeling.py and modeling_nv.py to transformers and simplify import path

* move modeling.py and modeling_nv.py to transformers and add test_modeling

---------

Co-authored-by: DrownFish19 <DrownFish19@gmail.com>
2025-02-17 19:16:49 +08:00
xuxinyi389
5eeb7aa17a [AutoParallel] Support deepseekv2 with DP/MP (#9862)
* suppoort_deepseekv2_autoparallel_with_DP/MP

* poolish

* remove_env_set

* update_code

* add_v3

* support_sharding

* move_to_v3

* fix_typo

* update_v3_config
2025-02-17 15:50:27 +08:00
freeliuzc
235c24e984 [Inference]Support mtp with deepseek-v3 (#9856)
* support mtp with deepseek_v3 both in static and dygraph mode

* fix speculate tokenizer in unittest

* delete useless code
2025-02-15 18:14:56 +08:00
Zhong Hui
62eac0ca04 [PreTrain] Support deepseek mfu for pretraining and fix tflops for pretrain pipe model (#9855)
* git flops with pp model.

* Support hareware tflops for deepseek.
2025-02-15 16:45:37 +08:00
Weiguo Zhu
8f4e0f09d2 [Inference] Update deepseek (#9864)
* fix

* fix infra
2025-02-14 18:02:38 +08:00
QingshuChen
5ebe42b1ac [XPU] Add xpu fused op for deepseek (#9854) 2025-02-14 16:18:31 +08:00
Ruibiao Chen
98d27d659a Support XPU for auto-paralllel LLaMa (#9796)
* Support XPU for auto-paralllel LLaMa

* Update

* Update

* Update

* Update

* Fix CI errors

* Update
2025-02-14 16:03:23 +08:00
Zhong Hui
ca22425e06 [Optimization] Support lower memory cards. (#9804)
* support lower memory cards.

* add doc for v100 16G such devices.

* remove debug info.

* add pre divided factor to overcome overfit problem for fp16 attention.
2025-02-14 14:53:46 +08:00
Yuanle Liu
1ca1d593fe [Bugfix] Fix dsk rope diff (#9859)
* fix dsk diff

* fix

* update
2025-02-14 14:11:37 +08:00
Siming Dai
5a1c4ac0e0 save extra special tokens (#9837) 2025-02-13 14:20:11 +08:00
zty-king
3900428f6c Solve the compatibility problem of type annotation Python version (#9853) 2025-02-13 11:38:05 +08:00
Yuanle Liu
d53e39de17 [DSK] support deepseek-v3/r1 (mha/fp16/bf16/wint8/wint4) (#9769)
* support deepseek-v3

* support head_dim=192,256 for append_attn c16

* update 0113

* attention run

* refine code

* add softmax_scale

* support weight_only_int8

* refine code

* support tp

* delete test_append_attn

* add splited fused_moe from ziyuan

* fix repe for deepseek-v3

* add deepseek-v3 class

* fix wint8 precision and refine code

* fix wint4, big diff

* add e_score_correction_bias

* fix head_dim

* fix v3 verify

* fix d2s

* fix v3 verify

* support qk_head_dim != v_head_dim

* fix wint8 v_head_dim

* fix rope

* fix qwen2

* mla use position_ids only

* remove control flow

* remove gpu concat

* fix norm weight dtype

* remove all_reduce in fused_moe

* fix static run

* refine rope code

* compute position_ids use custom op

* fuse rope

* fix macro

* fix mixtral

* support mla for speculate

* fix tokenizer and qwen

* fix moe diff due to e_score_correction_bias

* fix fast tokenizer

* fix import

---------

Co-authored-by: lizhenyun01 <1500424927@qq.com>
Co-authored-by: lizhenyun <lizhenyun@baidu.com>
2025-02-13 00:21:25 +08:00
Tian
763c59af39 [LLM] fix checkpoint save for non flash mode (#9830) 2025-02-12 14:02:54 +08:00
Zhong Hui
85b77f2d90 [Inference] Flask server compatible with OpenAI api. (#9828)
* flask server compatible with OpenAI api.

* fix max_length to max_tokens.

* fix with think model.
2025-02-12 13:32:39 +08:00
Siming Dai
9ded9bf880 [Unified Checkpoint] Fix expert parallel (#9821)
* fix expert parallel

* fix split_param for expert parallel

* add filter_sync_parameters
2025-02-12 10:59:00 +08:00
lugimzzz
765ab8d076 [Mergekit]update & add LoRA merge (#9811)
* add

* fix bug

* fix

* add

* add lora merge

* add

* add

* add

* add

* add

* add
2025-02-11 17:46:33 +08:00
Weiguo Zhu
58fc49f32e [LLM] Add pipeline and flashmask for Qwen2Moe and Deepseek (#9827)
* add modleing_pp

* add modleing_pp for qwen2moe

* add flashmask and pp for Qwen2MoE and Deepseek

* remove

* fix fast_tokenizer save

* update for topk_weight of noaux_tc

* fix for flashmask

* add use_expert_parallel for pretrain

* fix tokenizer test
2025-02-11 16:23:55 +08:00
Weiguo Zhu
86286e09f8 Fix position_ids for infra (#9841) 2025-02-11 14:06:45 +08:00
Weiguo Zhu
55db2ff067 [Inference] Fix multibatch inference (#9831)
* fix batch infra

* fix deepseekv2 infra
2025-02-10 11:52:52 +08:00
will-jl944
eab22f2b4a [XPU] Support empty_cache on XPUs (#9789)
* [XPU] Support empty_cache on XPUs

* warn if current device doesn't support
2025-02-08 11:46:10 +08:00
Yuanle Liu
a9d8648120 [Readme] Update mixtral.md (#9829) 2025-02-07 12:02:23 +08:00
will-jl944
bad224079f Fix LLAMA arg parsing bug in pp (#9806) 2025-02-06 19:25:17 +08:00
YUNSHEN XIE
fa98268be9 修复benchmark多机任务异常退出的处理 (#9651)
* 修复benchmark多机任务异常退出的处理

* fix bug

* update
2025-02-06 17:09:19 +08:00
Chang Lu
54b8882079 [AutoParallel] add sharding tensor_fusion save load switch (#9810)
* support tensor_fusion save load

* apply suggestions from code review
2025-02-05 16:45:09 +08:00
Weiguo Zhu
96856bdd0e [LLM] Update model convert and fix TP for deepseekv3 (#9797)
* fix model convert and tp in MoEMLP

* fix tp_action filter

* update convert accoding to num_nextn_predict_layers

* add deepseek-R1
2025-01-24 18:12:08 +08:00
Siming Dai
3967f76e66 fix split_param (#9817) 2025-01-24 11:01:00 +08:00
Zhong Hui
2f85a64edd [README] Update README.md for documention (#9785)
* Update README.md

* Update README.md

* Update README_en.md
2025-01-23 11:41:43 +08:00
Ting
e247c85405 [Trainer] Wrap model when lora is ON and only do evaluation. (#9803) 2025-01-23 11:37:29 +08:00
Zhong Hui
30fa8b920d [CI] Fix ci of small models (#9633) 2025-01-23 11:16:31 +08:00
freeliuzc
bb103a32da [Inference] Support eagle for llama (#9812) 2025-01-23 11:14:32 +08:00
kevin
bb0c9ad75b [LLM] merge code from fastdeploy (#9791)
* [LLM] update llm server dockerfiles

* merge code from fastdeploy
2025-01-23 11:12:14 +08:00
Mangodadada
ac095f5096 mergekit gpu 1226 (#9702)
* mergekit gpu 1226

* merge model gpu

* merge gpu

* add lora model

* change valueerror

* add lora

* gpu test
2025-01-21 15:38:15 +08:00
Liujie0926
7c1c9baec7 [LLM Benchmark]update scripts (#9722)
* add no_proxy & del paddlenlp_ops

* update timeout for dpo

* fix sequence_parallel

* add timeout

* add Total_Tokens_per_second_per_gpu

* fix Tokens_per_second_per_gpu

* update Total_Tokens_per_second_per_gpu
2025-01-21 15:19:36 +08:00
Tian
730a7626ec [LLM] support flash device on static model (#9619) (#9787)
* [LLM] support flash device on static model

* [LLM] adapt pdc sdk
2025-01-21 14:52:10 +08:00
aooxin
fb3e4c0403 [Infer] Add pir_model path for server infer. (#9790) 2025-01-17 11:13:33 +08:00
Ting
d039ad2c56 fix dpo pp criterion (#9786) 2025-01-16 17:21:23 +08:00
Siming Dai
13053a7148 [MoE] fix expert parallel (#9760)
* fix moe uc
2025-01-16 14:14:37 +08:00
Weiguo Zhu
1afb9b2ed4 fix (#9779) 2025-01-15 13:22:22 +08:00
blacksheep-Aristotle
9e0b830eb1 Fix ce error (#9783)
* [AutoParallel]:fix ci error

* [AutoParallel]:fix ci error
2025-01-15 13:22:01 +08:00
Siming Dai
8fb109ae11 Update register_sequence_parallel_allreduce_hooks (#9782)
* fix sequence parallel

* update register_sequence_parallel_allreduce_hooks

* update fuse_sequence_parallel_allreduce
2025-01-15 11:15:06 +08:00
Tian
efd07c0e59 [Distributed] support fuse optimizer (#9519) (#9777) 2025-01-14 18:01:20 +08:00
Siming Dai
7b53fec78d [BugFix] Fix matryoshka norm loss (#9774)
* fix matryoshka norm
2025-01-14 17:32:42 +08:00
Zhong Hui
4bdb06c3ba Update README.md (#9766)
* Update README.md
2025-01-14 15:16:55 +08:00
blacksheep-Aristotle
595e74f331 Fix ernie ci auto trainer error (#9758)
* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* [AutoParallel]:fix ernine auto_trainer error

* Update run_pretrain_auto.py
2025-01-14 14:03:39 +08:00
greycooker
94e798f986 fix loraga merge (#9765)
* fix loraga merge

* change sign
2025-01-14 10:41:54 +08:00
Chang Lu
027b5304f5 [AutoParallel] open tensor_fusion for benchmark (#9749)
* open tensor_fusion for benchmark
2025-01-10 16:48:29 +08:00
Weiguo Zhu
2c556e76fb [LLM] Add DeepseekV3 (#9738)
* update deepseek-v2

* add deepseek_v3

* update for deepseekv3

* update deepseekv3 model_ids
2025-01-10 14:15:22 +08:00
Weiguo Zhu
cf5e3e72e1 [tokenizer] Fix AutoTokenizer (#9745)
* fix auto tokenizer

* fix auto tokenizer

* lint

---------

Co-authored-by: lyuwenyu <wenyu.lyu@gmail.com>
2025-01-10 14:07:55 +08:00
Siming Dai
b4325b980d [Trainer] update sequence parallel (#9757)
* update emb doc

* update register_sequence_parallel_allreduce_hooks

* update fuse_sequence_parallel_allreduce
2025-01-10 11:26:19 +08:00
will-jl944
331131b3af [NPU] Adapt to new flash_attention_npu api (#9762) 2025-01-10 11:10:14 +08:00
Longzhi Wang
048387fb5b [Inference] merge speculate_step into step op (#9674) 2025-01-09 19:08:25 -08:00
Longzhi Wang
9af0466f17 fix speculate_verify_and_update op (#9759) 2025-01-09 19:04:58 -08:00
lizhenyun01
55e7e33e2a fix get_block_shape_and_split_kv_block (#9752) 2025-01-08 23:13:32 -08:00
blacksheep-Aristotle
fb60645d8a [AutoParallel] Fix ernie auto_trainer error (#9753) 2025-01-08 19:48:40 +08:00
Jie.Z
1d74d62b82 [Model] Add XLMRoBERTaModel in paddlenlp (#9720)
* add xlm_roberta in paddlenlp
2025-01-08 16:56:56 +08:00
xuxinyi389
b286544727 [AutoParallel]ckpt support local views keys to global views keys (#9604)
* ckpt_support_moe

* fix_bugs
2025-01-08 16:15:43 +08:00
aooxin
95ae8a82aa [CI] Fix import bugs. (#9751) 2025-01-08 11:07:16 +08:00
blacksheep-Aristotle
06da1c3a96 [AutoParallel]: fix ernie ci error (#9750) 2025-01-07 18:06:58 +08:00
Siming Dai
67bc4e2cc2 [Unified Checkpoint] Fix expert parallel (#9741) 2025-01-07 11:16:26 +08:00
YUNSHEN XIE
142258ce8c Modify the environment variables and model configuration of the benchmark test case. (#9725) 2025-01-06 20:13:38 +08:00
Zhong Hui
171726d047 [BugFix] Update predictor.py (#9742) 2025-01-06 19:46:46 +08:00
Weiguo Zhu
4953500520 [Docs] Fix (#9746)
* add `Before submitting` for PR

* fix dead links

* fix dead links

* Update sync to avoid dead links.

* avoid fused_ln in README.md

* update scripts/get_modified_files.py

* update

* fix README.md
2025-01-06 19:46:15 +08:00
waliwali777
7e06e02528 [AutoParallel] Add test for PIR refined recompute (#9679)
* Add test for refine recompute

* move `refined_ops_patterns` flag to auto training args
2025-01-06 17:36:21 +08:00
will-jl944
1f07325ace Adapt to new npu flash_attention api (#9735) 2025-01-06 17:01:07 +08:00
Chang Lu
a83e8faadb [AutoParallel] add parameter enable_stage1_tensor_fusion_blanced_save_load and enable_stage1_tensor_fusion (#9714)
* add param

* update note
2025-01-06 14:04:19 +08:00
zhink
a52035f6ba Added FLAGS to replace four params and the value can be adjusted for better speedup (#9624)
* add FLAGS instead max_partition_size

* encoder_max_partition_size eq max_seq_len when encoder
2025-01-06 11:03:11 +08:00
aooxin
bb85eb42ab add common models and common params unit test for llm predictor. (#9711)
* add test_predictor_v1.

* del. src_length and fix bug.

* del. GPUsPredictorTest previous.

* update.

* activate ci

---------

Co-authored-by: Yuanle Liu <yuanlehome@163.com>
2025-01-04 07:22:59 +08:00
Tian
7713ca8a57 [LLM] [Cherry-Pick] Integrate PDC SDK for LLM training fault tolerance platform (#9706)
* Add PDC sdk (#9431)
* [LLM] support download ckpt from pdc (#9443)
---------

Co-authored-by: dongzezhao <2283296285@qq.com>
Co-authored-by: luoyuedong <530122286@qq.com>
2025-01-03 17:29:30 +08:00
will-jl944
3e15f0ec3b Add offload_recompute_inputs (#9715) 2025-01-03 14:14:04 +08:00
Zhong Hui
dac27c4a12 [Docs] Refactor custom devices. (#9734) 2025-01-03 11:37:46 +08:00
blacksheep-Aristotle
575896cca8 add single_model network and use intermediate api (#9412)
* add single_model network and use intermediate api

* [AutoParallel]: fix llama_model_network run error

* New version of auto config

* bug fix

* [AutoParallel]:add qwen run intermedaite api script

* fix sharding

* support attn_mask not None for pp

* fix for mp

* update api calling

* update the script

* add qwen mp/sp/pp config and process attn_mask and position_id

* fix issue of pipeline and add lazy_init

* fix gpt_network to use intermediate_api

* fix gpt_network to use intermediate_api

* [Auto Parallel] add llama2 7b/13b intermediate benchmark config

* update api

* update plan

* qwen fit base api

* fix alibi and attn_mask

* bug fix

* [AutoParallel]:gpt single network support tp to share_embedding

* [AutoParallel]:gpt single network support tp to share_embedding

* add intermediate ci

* add single_model network and use intermediate api

* New version of auto config

* fix sharding

* fix gpt_network to use intermediate_api

* fix gpt_network to use intermediate_api

* update ci loss baseline

* update gpt run_pretrain_py

* fix sharding error

* fix gpt format error

* [AutoParallel]:fix llama vpp ci error

* [AutoParallel]:fix llama A100 ci failed

* [AutoParallel]:update model formate

* [AutoParallel]:fix ipp error

* [AutoParallel]:fix a100 ci error

* [AutoParallel]:fix a100 ci error

* [AutoParallel]:update model_netowrk formate

* [AutoParallel]:add explanatory note

* [AutoParallel]:add explanatory note

* [AutoParallel]:add explanatory note

* Delete =1.0.0

---------

Co-authored-by: YuangLiu <liuyuang@baidu.com>
Co-authored-by: zhengzhonghui <zhengzhonghui@baidu.com>
Co-authored-by: jeff41404 <jeff41404@gmail.com>
2025-01-03 09:25:24 +08:00
yujun
fa3fd39a02 [Refined Recompute] Remove refined recompute deep copy (#9617)
* remove rr deep copy

* make sure test on gpu
2025-01-02 14:50:39 +08:00
Siming Dai
3a3bb653ed [Embedding] Fix embedding random (#9721) 2025-01-02 14:49:20 +08:00
lugimzzz
3aa9f4c339 [llm] Add KTO (#9689)
* add kto

* add kto

* add kto

* add kto'

* add kto

* add

* fix conflict

* add llm
2024-12-31 14:12:57 +08:00
Tian
dff62a10ea [LLM] [Cherry-Pick] add asynchronous metrics dumper for llm training (#9704)
* [LLM] add metrics dumper in background (#9049)

* [LLM] compat older paddlenlp for metrics dumper (#9072)

* fix exit bug for paddlenlp (#9237)

* fix UT

---------

Co-authored-by: ShenLiang <2282912238@qq.com>
2024-12-30 15:38:09 +08:00
Liujie0926
62274fa58c [LLM_benchmark]update LLM_benchmark scripts (#9662) 2024-12-30 14:54:10 +08:00
waliwali777
c080bb8d3f fix_recompute_test (#9672) 2024-12-30 11:12:47 +08:00
Ting
07ad5e61f5 support qwen dpo fused kernel (#9686) 2024-12-30 10:58:10 +08:00
lugimzzz
79695ccd74 [llm]support dpo pp for qwen & llama (#9695)
* support dpo pp

* add dpo pp

* add dpo pp
2024-12-27 16:53:01 +08:00
Tian
691ae01d14 [LLM] valid loss before optimizer step (#9255) (#9705) 2024-12-27 16:05:25 +08:00
zhink
7197b79c1d [Inference] Use cuda core(int8_sq) for m <=4 in gemm_dequant OP (#9707) 2024-12-27 14:07:01 +08:00
xuxinyi389
b53f7ebd67 fix_typo (#9703) 2024-12-27 11:01:36 +08:00
blacksheep-Aristotle
a0c4b4ccda update gpt&baichuan&qwen ce name (#9697)
* update gpt&baichuan&qwen ce name

* update gpt&baichuan&qwen ce name

* update gpt&baichuan&qwen ce name

* update gpt&baichuan&qwen ce name

* update gpt&baichuan&qwen ce name
2024-12-26 18:59:15 +08:00
xuxinyi389
8c04a159ad [AutoParallel] merge ckpt for inference (#9688)
* add_readme

* add_unified_ckpt

* fix typo
2024-12-26 18:02:28 +08:00
tianyuzhou668
f7f3957d24 [Iluvatar] Add readme for llama-13b (#9670)
Co-authored-by: tianyuzhou668 <tianyuzhou668@github.com>
2024-12-26 15:41:55 +08:00
chen
36d53337ed [LLM INFER] cutlass 3.x gemm on sm90 (#9398)
* cutlass 3.x gemm on sm90

* change cutlass to v3.5.1, because v3.5.0 don't support fp8 gemm on hopper

* support tune cutlass 3.x FP8 GEMM

* auto gen cutlass 3.x FP8 GEMM code

* add FP8 docs

* change FP8 tune, and remove -O3

* check

* check

* support dual gemm on sm90

* code check

* dual gemm cutlass kernel

* code check

* code check

* setup_cuda.py check

* delete invalid gemm config

* change gitignore

* Update csrc/setup_cuda.py

Co-authored-by: Yuanle Liu <yuanlehome@163.com>

---------

Co-authored-by: ckl117 <ck117@163.com>
Co-authored-by: Yuanle Liu <yuanlehome@163.com>
2024-12-25 23:06:15 -08:00
greycooker
d007615b91 fix loraga amp (#9699) 2024-12-26 15:02:12 +08:00
Jie.Z
40fa402dc4 [Embedding] Add inf-cl in embedding trainer (#9673)
* add inf-cl in embedding trainer
2024-12-25 17:19:25 +08:00
kevin
da320870f8 [LLM] Add deploy server (#9581)
* [LLM] add deploy server
2024-12-25 16:32:43 +08:00
sneaxiy
f67f421184 [MLU] Add MLU llama readme (#9671) (#9685)
Co-authored-by: PeiyuLau <135964669+PeiyuLau@users.noreply.github.com>
2024-12-25 12:47:30 +08:00
PeiyuLau
801682de72 [MLU] Add MLU llama readme (#9671) 2024-12-24 14:35:38 +08:00
sneaxiy
947ee9d669 Optimize performance for Qwen2 model (#9616)
* Optimizer performance for Qwen2 model

* fix format

* fix swiglu

* fix ut

* fix ut failure
2024-12-24 14:29:02 +08:00
Siming Dai
3374e7fcf9 [UnifiedCheckpoint] Add tied_weight_keys for pipeline model (#9663)
* update trainer.py

* fix tied_weights_keys

* update
2024-12-23 21:05:28 +08:00
Siming Dai
97ae9adc3c [Unified Checkpoint] bug fix for missing optimizer.safetensors.index.json (#9669)
* Update unified_checkpoint.py
2024-12-23 15:58:01 +08:00
yujun
1842d6d133 [Ops] Add paddlenlp_kernel for CUDA and Triton ops(#9471)
* add paddlenlp_gpu_ops

* add inf_cl loss function

* rename ppnlp_kernel

* rename paddlenlp_kernel
2024-12-23 14:36:04 +08:00
Liujie0926
f4f578cc40 [CI]update blacklist for gpt3 (#9555)
* update blacklist

* update

* update

* update

* update

* fix

* fix
2024-12-23 14:16:41 +08:00
Mangodadada
c6ab784b90 merge docs (#9657)
* merge docs1218

* docs

* fix soft link

* rename

* fix merge docs

* rename

* merge docs 1220

* merge docs
2024-12-23 11:06:10 +08:00
AIbin
e91c2d3d63 【Qwen2-VL Inference】add qwen2-vl high performance inference (#9575)
* qwen2-vl
2024-12-20 17:02:39 +08:00
Qiming Zhu
a26ddc4242 Structured Index of Documents (#9411)
* Structured Index of Documents

* 替换pdf为url

* 更改下载方式

* 更新README

* 更新README

* 修改环境安装指令
2024-12-20 15:28:23 +08:00
shang-mt
297dbced6b [Doc] [Mthreads] Support llama 13B pre-train (#9666) 2024-12-20 14:35:27 +08:00
Zhong Hui
029801da82 [DOC] Polish README of UC (#9668) 2024-12-20 14:20:16 +08:00
Siming Dai
9b6271271b [Trainer] update remove_master_weight (#9640) 2024-12-20 13:25:55 +08:00
zhengzhonghui
cae63987b7 [BugFix] Make the timer compatible with devices other than GPU (#9665) 2024-12-20 12:06:32 +08:00
wanly young
2d950b959a [DCU] update hygon dcu docs (#9298)
* update hygon dcu docs
2024-12-20 11:30:31 +08:00
will-jl944
0b6ed4ddb7 [XPU] qwen2 supports fused_rope (#9660) 2024-12-20 09:37:50 +08:00
lugimzzz
19fcdcbf17 fix lora (#9659) 2024-12-19 18:43:23 +08:00
blacksheep-Aristotle
25415fbe3d fix qwen&baichaun&gpt ci error (#9650)
* fix qwen&baichaun&gpt ci error

* fix qwen&baichaun&gpt ci error

* fix qwen&baichaun&gpt ci error

* fix qwen&baichaun&gpt ci error

* fix qwen&baichaun&gpt ci error

* add gpt_dy ce

* revert qwen&baichuan dygraph ce

* revert qwen&baichuan dygraph ce

---------

Co-authored-by: xuexixi <xuexixi@baidu.com>
2024-12-19 14:34:17 +08:00
Siming Dai
49d762f2ac [Trainer] update trainer.py for seed resume (#9656) 2024-12-19 14:19:15 +08:00
lugimzzz
e0ace1614b [llm]update peft docs (#9655)
* fix docs

* fix docs

* fix docs

* fix docs
2024-12-19 12:51:57 +08:00
lcykww
90bc68e163 MoRA Implementation (#9562)
* MoRA Implementation

* MoRA算法

* MoRA

* MoRA

* MoRA

* MoRA

* MoRA

* MoRA

* MoRA

* MoRA
2024-12-18 17:08:20 +08:00
Siming Dai
605a4eaad2 Update embedding trainer state (#9629)
* add trainer state

* add trainer_state
2024-12-18 16:16:51 +08:00
ZhenxingLi
047046635e [AutoParallel] Add config replace_with_c_embedding (#9638)
* update

* Update ci_case_auto.sh
2024-12-18 14:55:19 +08:00
will-jl944
b9cf723cc4 Fix paddle.where (#9652) 2024-12-18 14:46:22 +08:00
Mangodadada
fa0febce87 mergekit_with_sparsify (#9561)
* mergekit_with_sparsify

* mergekit_with_sparsify

* 参数上传修改

* change sparsify style

* test

* add merge

* add merge

* add merge

* add merge

* add test

* add tensor

* add merge

* add del

* add merge

* add merge

* del base

* del base

* alpha

* update follow comments

---------

Co-authored-by: lugimzzz <zhenglujing@baidu.com>
2024-12-18 12:24:15 +08:00
greycooker
407b3e6fc6 [PEFT]Add LoRA-GA (#9592)
* Support LoRA-GA initialization

* modify loraga_reinit

* Support multi GPU initialization

* support resume training and gradient offlaod hook

* remove trl/llm_utils.py

* use loraga trainer

* fix comment

* fix loraga

* change variable name
2024-12-18 10:36:44 +08:00
Siming Dai
2231feb068 [Embedding] Add embedding training (#9508)
* add Qwen2SentenceEmbedding

* add embedding trainer

---------

Co-authored-by: DrownFish19 <DrownFish19@gmail.com>
2024-12-17 20:51:28 +08:00
zhengzhonghui
da7a7d296f [AutoParallel] change loss_base after dropout support spmd (#9647)
* [AutoParallel] change loss_base after dropout support spmd

* [AutoParallel] change loss_base after dropout support spmd
2024-12-17 16:07:18 +08:00
waliwali777
4451c05879 Add replace_with_parallel_cross_entropy flag (#9579)
* Add replace_with_parallel_cross_entropy flag

* add a100 loss_base

* fix
2024-12-17 15:57:42 +08:00
Zhong Hui
12fba788c0 Update README.md for 3.0 beta3(#9644) 2024-12-17 15:56:59 +08:00
waliwali777
bb9793130e add test (#9621) 2024-12-17 15:55:45 +08:00
Weiguo Zhu
9eb3cfeafc [Tokenizer] Fix tokenizer of llama3.3 (#9641)
* fix tokenizer of llama3 and add test case

* fix paddle.where
2024-12-17 14:04:25 +08:00
Weiguo Zhu
dc0ca03b52 [LLM DOCs] Add deepseek models (#9643)
* update
2024-12-16 19:30:44 +08:00
Zhong Hui
5a94e04521 [Release] Update version for beta3 (#9553)
* Update README.md
2024-12-16 19:16:02 +08:00
lugimzzz
da41c4f252 [llm]add adam-mini (#9542)
* add adam-mini

* fix following comments
2024-12-16 16:41:11 +08:00
lugimzzz
f3ba5b3c6a [llm]update dpo criterion (#9620)
* update dpo criterion

* update dpo criterion
2024-12-16 16:41:01 +08:00
thinking-computer
5e1f01fd97 [Custom Devices] feat(sdaa): support sdaa backend infer (#9570)
1.add sdaa python paddlenlp_ops setup and README
2.update llm scripts and README
2024-12-16 15:11:42 +08:00
Weiguo Zhu
98a1cdc081 Add news (#9632) 2024-12-16 13:41:35 +08:00
Zhuoqun Li
c8aa7bf1a3 [Embedding] add llama and nv-embed training (#9323)
* add llama and nv-embed training

* add llama and nv-embed training and refine evaluation

* add llama and nv-embed training and refine evaluation

* add llama and nv-embed training and refine evaluation

* add llama and nv-embed training and refine evaluation

* add llama and nv-embed training and refine evaluation

* add llama and nv-embed training and refine evaluation

* add llama and nv-embed training and refine evaluation

* add llama and nv-embed training and refine evaluation
2024-12-16 12:04:45 +08:00
Siming Dai
7947bca07f Update unified_checkpoint.md (#9634) 2024-12-13 18:18:09 +08:00
Ting
e7a48db5a2 [DOC] Checkpoint Compression Doc (#9614)
* Checkpoint Compression Doc

* Update unified_checkpoint.md

---------

Co-authored-by: Siming Dai <908660116@qq.com>
2024-12-13 16:45:44 +08:00
Liujie0926
d3f3bbfc0a [LLM benchmark]add qwen2.5-7b (#9524)
* add qwen2.5-7b

* add qwen2.5-1.5b/14b

* add fix

* update data

* fix

* fix

* fix

* Update run_ci.sh

* update ips for dpo

* add llama2
2024-12-13 16:43:28 +08:00
Liujie0926
4102eb0719 [CI]update a100 loss_base for gpt (#9626)
* [CI]update a100 loss_base

* fix PaddleNLP_CI

* update

* update
2024-12-13 15:46:22 +08:00
Wangzheee
db38937b39 [Inference] Change norm outputs in dynamic and static mode(#9569) 2024-12-13 13:12:01 +08:00
Weiguo Zhu
c96260bb5b Fix link (#9628) 2024-12-12 17:20:19 +08:00
Yuanle Liu
f1126c1cbe [Inference] Fix docs and support llama3.2 (#9613)
* fix docs and use fast tokenizer default
* support llama3.2
2024-12-12 16:50:04 +08:00
Longzhi Wang
4f571798dd [Inference] Fix get_save_output op and refactor specu_decoding (#9576)
* fix get_save_output op and refactor specu_decoding
* add token_penalty for speculate decoding
2024-12-12 14:59:54 +08:00
will-jl944
70e80c7c4a Speedup FusedHeadAndCrossEntropy (#9601) 2024-12-12 11:42:20 +08:00
tianhaodongbd
23cf634dbf fix pp_config bug (#9605) 2024-12-12 11:21:28 +08:00
yinfan98
f445a7a56a 【Hackathon 7th No.43】TokenizerFast for Ernie (#9594) 2024-12-12 10:14:30 +08:00
wawltor
cd5468ca66 fix the d2s bug in qwen2 modeling (#9603)
* fix the d2s bug in qwen2 modeling

* update the code for the predictor
2024-12-11 22:28:08 +08:00
Ting
b7c6b4e7e6 [Unified Checkpoint] Fix checkpoint quant log (#9606) 2024-12-11 20:46:29 +08:00
Weiguo Zhu
272e715199 fix (#9612) 2024-12-11 19:15:31 +08:00
Siming Dai
b205922c1f update embedding trainer (#9608) 2024-12-11 17:31:52 +08:00
YUNSHEN XIE
b4f6e82a3d fix benchmark scripts (#9597) 2024-12-11 16:24:46 +08:00
greycooker
b31c627a22 [Trainer]Fix _get_eval_sampler (#9374)
* Fix eval sampler

* change sampler name
2024-12-11 16:21:05 +08:00
Weiguo Zhu
325deb506e [Requirements] Update protobuf version (#9118) 2024-12-11 11:37:32 +08:00
Weiguo Zhu
45eeac77e1 [LLM] update tensor and pipeline parallel for chatglmv2 (#9204)
* fix_chatglmv2_8k

* update modeling and modeling_pp
2024-12-11 11:35:19 +08:00
lugimzzz
9421c0ae87 fix dpo (#9607) 2024-12-11 11:21:58 +08:00
blacksheep-Aristotle
9f237b4dd9 [AutoParallel]:add gpt&baichuan&qwen ce (#9591) 2024-12-10 14:32:42 +08:00
zhangbo9674
009aca6e44 [CI] Add llama2-7b-cinn test (#9578)
* refine log
* refine
2024-12-10 11:15:20 +08:00
blacksheep-Aristotle
8ed579a683 [AutoParallel]:add gpt & baichuan auto ci (#9551)
* [AutoParallel]:add gpt & baichuan auto ci

* [AutoParallel]:add gpt & baichuan auto ci

* [AutoParallel]:add gpt & baichuan auto ci

* [AutoParallel]:add gpt & baichuan auto ci

* [AutoParallel]:add gpt & baichuan auto ci

* [AutoParallel]:fix attention_error

* [AutoParallel]:fix attention_error

* [AutoParallel]:fix attention_error

* [AutoParallel]:fix attention_error

* [AutoParallel]:add gpt&baichaun ci

* [AutoParallel]:add gpt&baichaun ci

* [AutoParallel]:add gpt&baichaun ci

* [AutoParallel]:add gpt&baichaun ci
2024-12-09 18:36:11 +08:00
Weiguo Zhu
eb4e6a1591 [DOC] Fix dead links (#9585)
* update docs/llm
2024-12-09 17:25:15 +08:00
tianhaodongbd
c565b77e75 [npu] fix where bug (#9573)
* [npu] fix where bug

* fix
2024-12-09 14:54:22 +08:00
sneaxiy
19172578c5 [Timer] Add gpu timer (#9582) 2024-12-09 14:41:39 +08:00
ZhenxingLi
5b54d716dd [AutoParallel] Fix ckpt oom paddlenlp (#9507)
* Update ckpt_converter.py
2024-12-09 11:14:52 +08:00
thinking-computer
b8942010b7 fix(export_model): fix export_model.py python path (#9571)
1.fix python path to paddlenlp project
2024-12-08 18:35:36 -08:00
yinfan98
753436afe0 【Hackathon 7th No.43】Tokenizer for Gemma (#9577)
* add gemma tokenizer

* fix lint

* rm version

* Update tokenizer_fast.py

* Update tokenizer_fast.py
2024-12-09 09:42:33 +08:00
tianhaodongbd
cfcd079ca1 Adapting npu for FusedHeadAndCrossEntropy (#9499)
* Adapting npu for FusedHeadAndCrossEntropy

* wrapper npu function
2024-12-06 16:28:25 +08:00
Liujie0926
a603a49568 [CI] update scripts (#9547) 2024-12-06 14:48:54 +08:00
HydrogenSulfate
dfbd8f9e10 [Develop] Update adam ops for support amsgrad (#9568) 2024-12-06 11:40:21 +08:00
yinfan98
8bd881434b 【Hackathon 7th No.43】TokenizerFast for GPT (#9548)
* add qwen2 tokenizer fast

* add qwen2 tokenizer fast

* fix

* add gpt tokenizer fast

* delete print

* Update utils.py

* Update ernie-gen

* Update data_tools

* Update tokenizer.py

* Update tokenizer_fast.py
2024-12-05 14:07:33 +08:00
Siming Dai
fb57a5e137 [Unified Checkpoint] fix load missing keys (#9523)
* fix load missing keys

* Update check_completion.py
2024-12-05 13:28:25 +08:00
Cheng Yanfei
8d9c341c5a [Intel_HPU]FSDPA custom kernel API update (#9556)
* sdpa API update

* sdpa fuse transpose
2024-12-05 11:23:59 +08:00
Longzhi Wang
e6b8e5bfe4 [INFER] Add more model support for speculate_decoding and refactor speculate_decoding (#9504)
* align the speculative decoding and SPECULATE_BSZ

* add specu_decoding support for Mixtral,qwen2,qwen2-moe
2024-12-05 11:22:17 +08:00
Leo Chen
14ed2a220b add llama3.1 config (#9541) 2024-12-04 19:54:04 +08:00
blacksheep-Aristotle
a2b5e18965 [AutoParallel]: add qwen model_auto and ci (#9538)
* [AutoParallel]: add qwen model_auto and  ci

* [AutoParallel]: add qwen model_auto and  ci

* [AutoParallel]:add qwen ci
2024-12-04 16:25:53 +08:00
will-jl944
733059312d [XPU] qwen2 supports flash_attn on XPU (#9549) 2024-12-04 15:32:09 +08:00
Ting
a5ec6bf623 run dpo script support qwen2 (#9543) 2024-12-04 09:52:29 +08:00
Yuanle Liu
f7da5a6ac3 [Infer] Delete generate_rank_mapping when export multi cards model (#9552) 2024-12-03 20:14:31 +08:00
Siming Dai
c4d79f47f7 Fix multi-threading load_state_dict (#9464)
* Update model_utils.py

* Update model_utils.py
2024-12-03 16:20:50 +08:00
Siming Dai
2b3d7bf02d [Unified Checkpoint] fix single card loading without master weights (#9540) 2024-12-03 14:21:24 +08:00
Zhong Hui
44b5b0bb7e [Fix] Update requirements.txt (#9514) 2024-12-03 13:15:24 +08:00
Zhong Hui
4d0fd0bdfc Support call sft training with clone PaddleNLP (#9516)
* init.

* refactor

* fix import.

* fix error.

* refactor

* fix

* refactor.

* fix

* refine

* fix argument update.

* refactor.

* refactor.

* refactor

* fix typo.

* fix.

* add missing.

* support short call sft training.

* add missing file.

* fix import

* add init file.

---------

Co-authored-by: gongenlei <gongenlei@baidu.com>
2024-12-03 13:09:07 +08:00
Zero Rains
2c1387f9f3 [INFER][LLM] Add the AutoPredictor for inference (#9445)
* add the AutoPredictor

* decoupling the model loading and predictor loading

* polish the AutoPredictor and AutoModel
2024-12-03 11:38:49 +08:00
yinfan98
7a221ccb0b 【Hackathon 7th No.43】TokenizerFast for Qwen2 (#9532)
* add qwen2 tokenizer fast
2024-12-02 20:38:54 +08:00
Yuanle Liu
2522bf8b70 [INFER] Fix tune_cublaslt_int8_gemm.py and remove dist_config (#9520) 2024-12-02 17:19:18 +08:00
tianhaodongbd
eae8d9f032 support offload/reload optimizer's states for custom device (#9467) 2024-12-02 15:34:21 +08:00
Weiguo Zhu
0b6284e00f [Inference] Update DygraphInferencePredictor (#9491)
* update DygraphInferencePredictor

* update batch_size
2024-12-02 15:33:07 +08:00
Weiguo Zhu
d45518172d [CI] Compatible with paddle.where (#9534)
* fix
2024-12-02 11:55:42 +08:00
zhangbo9674
fc25d3285c Fix ckpt convert bug1 (#9522)
* refine log

* refine

* fix

* fix
2024-11-29 19:30:53 +08:00
Ting
741785a3d9 support pp accuracy calculation (#9379)
* support pp accuracy calculation

* add pp accuracy ci

* add comment

* update

* mv logits accumulation to cpu

* refactor code

* code refactor

* remove ci, not support yet

* update
2024-11-29 14:12:38 +08:00
zhangbo9674
020a25fb86 Fix ckpt convert bug (#9521)
* refine log

* refine

* refine

* refine
2024-11-29 11:00:12 +08:00
Ting
2985f90327 support quant ckpt limit strategy (#9494)
* support quant ckpt limit strategy

* bug fix

* bug fix

* fix bug

* add log, fix bug
2024-11-29 10:22:00 +08:00
Weiguo Zhu
756bce7431 update (#9511) 2024-11-28 21:48:01 +08:00
Longzhi Wang
049b0b5cf8 Add document for speculative decoding (#9492)
* Add document for speculative decoding

* update

* update docu
2024-11-28 01:41:27 -08:00
Yuanle Liu
e23214b4c2 Fix csrc readme (#9515) 2024-11-28 17:38:06 +08:00
Zhong Hui
5926c30e93 [Refactor] SFTTrainer SFTConfig (#9318)
* refactor

* fix import.
2024-11-28 17:30:02 +08:00
YUNSHEN XIE
cbe5af14ab 移除CUDA_DEVICE_MAX_CONNECTIONS环境变量, 优化benchmark执行脚本 (#9500)
* CE case执行移除CUDA_DEVICE_MAX_CONNECTIONS环境变量

* 优化benchmark执行脚本

* update
2024-11-28 15:13:50 +08:00
Walter Wu
3ef14dc19b Adding LoKrModel Class to paddle.peft library (#9269)
* passing pre-commit

* removing tp and pp logic for single gpu training

* add disable_lokr attribute in lokr_layer

* refine comments

* add lokr tests and modified layer bug

* add lokrtests

* add lokrtests

* add lokr_argument.json

* add integration test, fix bugs based on tests.

* refactor lora_dim to lokr_dim

* no inference

* add more tests

* resolve merge conflict

* add more randtests

* pass isort check(maybe)
2024-11-27 20:52:07 +08:00
yujun
8d8a42cc85 [BugFix] fix pp eval (#9505) 2024-11-27 19:24:09 +08:00
yinfan98
a9a6b80a62 【Hackathon 7th No.43】TokenizerFast for BLOOM (#9407)
* add bloom tokenizer fast

* fix fast

* Update test_tokenizer.py

* fix lint

* reopen ci

* rerun ci

* fix ci

* fix bloom test

* fix bloom coverage test

* fix bloom coverage test

* add copyright for bert tokenizer fast

* add copyright for bloom tokenizer fast
2024-11-27 14:36:19 +08:00
yujun
b1466d7e6e [NEW Feature] 新增基于hook的refined_recompute支持 (#9396)
* 代码实现refined_recompute

* 更新rr的实现,新增单测测试pp和非pp

* update llama and support refined recompute

* update rr

* update

* update create_skip_config_for_refined_recompute config.num_hidden_layers

* update llama pp recompute

* refined recompute only support recompute_use_reentrant=False

* LOD_TENSOR

* typo

* rr 支持qwen模型

* support RRColumnParallelLinear & RRRowParallelLinear

* fix

* update llm test

* fix

* update test_refined_recompute
2024-11-27 10:34:34 +08:00
Yuanle Liu
f5ca96efcd [LLM INFER] not use gemm_dequant default and fix bug (#9498)
* not use gemm_dequant default and fix bug
2024-11-26 20:51:11 +08:00
enzodechine
4b02477458 [XPU] set appropriate mask value for xpu (#9495) 2024-11-26 16:31:31 +08:00
zhink
0b4b810ae6 [Inference] use fp8 cuda core gemm kernel when M<=4 (#9423) 2024-11-26 13:29:41 +08:00
Weiguo Zhu
d6d181b719 [Tokenizer] Support fast tokenizer within AutoTokenizer import (#9466)
* add tokenizerfast import

* add test case
2024-11-26 12:00:53 +08:00
blacksheep-Aristotle
6141f80b17 [AutoParallel]:fix baichuan d2s fail (#9478) 2024-11-26 11:47:11 +08:00
lvdongyi
131888eb2c [ChatTemplate] Fix chat template for Yuan when answer is contained within question. (#9485)
* Fix chat template for Yuan when answer is contained within question

* add more models to test
2024-11-26 11:22:49 +08:00
Chang Lu
d9a4e682a1 [AutoParallel] open vpp test cast at v100 machines (#9468)
* update

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh
2024-11-26 10:48:37 +08:00
Weiguo Zhu
8fd33a9518 [Fix] Remove data args print (#9486) 2024-11-25 15:54:21 +08:00
Longzhi Wang
d68a385fcf [LLM INFER] Support speculative decoding (llama) (#9180)
* add specu_decoding custom cuda kernels

* rename the speculate_update kernel to speculate_verify_and_update kernel

* Add the speculate_decoding framework

* Add licence and more comment

* fix top_p_candidates and add cooment for proposer

* fix top_p_candidates

* add static graph support for speculate_decoding

* fix specu_decoding framework

* v1.0: fix accuracy of the framework

* fix custom op

* fix comment and add type annotation

* fix custom_op and speculate_read_res

* update

* update

* add input_ids_cpu for proposers to align with inner implementation

* fix typo

* update and add test

* fix the place of proposers

* fix code lint

* fix test

* remove the unused custom op

* remove the unused custom op

* merge speculate custom op

* fix conflict

* fix typo

* fix typo

* merge custom op and fix code style

* fix circular import

* fix circular import

* fix circular import

* fix typo

* fix import

* fix static

* refactor test

* refactor test

* refactor get_output and save_with_output_msg

* merge the SpeculatePredictor to BlockPredictor

* refactor read_res

* fix conflict and refactor comment
2024-11-24 21:55:21 -08:00
张明明
e3db4c048f fixbug for chatglm_v2's RetaryEmbedding dtype (#9476) 2024-11-24 21:54:15 -08:00
Ting
195fde32b8 [Unified Checkpoint] Checkpoint compression (#9183)
* checkpoint compression init

* add ckpt quant argument

* add ckpt quant ci

* fix ci

* fix lint

* remove stage O2, change O3 --> O2

* support async save

* file adjustment

* magic string remove

* ci fix

* ci fix, code refinement

* function extraction

* fix ci

* code refinement

* fix ci

* fix ci

* support non merge tp ckpt quantization

* fix ci

* update

* fix bug

* code refactor

* fix lint

* fix ci

* del old uc.py

* fix lint

* add mgpu ci

* fix ci

* multi thread loading

* fix lint

* fix bug

* refactor code

* add comment

* fix lint

* add comment

* add comment

* fix bug

* fix bugs when ckpt no quant and no master weight

* remove uni-test
2024-11-25 11:38:02 +08:00
blacksheep-Aristotle
58a6eb9c03 [AutoParallel]:fix run llama_13b_auto error (#9480) 2024-11-25 10:49:17 +08:00
Chang Lu
1ba3bef24b add param (#9481) 2024-11-22 21:27:29 +08:00
lixc
9494e9a380 [Inference]Move quantization code from run_finetune.py to run_quantization.py (#9450)
* 1. Move quantization code from run_finetune.py to run_quantization.py
2. Remove experimental code about quantization in llm/experimental. These code will merge in Paddleslim.

* repair experimental/ceval

* update readme and remove useless code

* add test for run_quantization

* update wrong comment

* update qwen2 fp8 quantization config
2024-11-22 17:11:26 +08:00
Siming Dai
7bfe5bc006 Fix eval for map dataset (#9472) 2024-11-22 14:58:10 +08:00
TranscenderNing
183e01201a add Moslora (#9331)
* add mos lora

* add tests

* correct something by comment

* add tests code for coverage rate
2024-11-22 10:15:50 +08:00
blacksheep-Aristotle
1ca1d4992b [AutoParallel]:gpt 13b model support fused_linear sp fused_attention and add gpt 13b pir ci (#9477) 2024-11-22 10:08:58 +08:00
blacksheep-Aristotle
b690222c50 [AutoParallel]: llama_model_auto support alibi (#9422)
* [AutoParallel]: llama_model_auto support alibi

* [AutoParallel]: llama_model_auto support alibi

* [AutoParallel]: llama_model_auto support alibi

* [AutoParallel]: change model_auto shard logits so change the loss base

* [AutoParallel]: change model_auto shard logits so change the loss base

* [AutoParallel]: fix llama run vpp error when use alibi
2024-11-22 10:08:26 +08:00
TranscenderNing
9ee691ac5f add reft method (#8819)
* solve lint error

* resolve test err

* add tests

* dependency error

* add tests for reft

* Supplementary test cases

* Supplementary test cases1

* Supplementary test cases11

* Supplementary test cases111

* correct CI-Unittest error

* correct CI-Unittest error

* correct CI-Unittest error

* correct CI-Unittest error1

* simplify code

* simplify codes

* delete reft

* make lint tidy

* add more tests

* unify trainer and simplify codes

* test predict

* delete nohup

* correct CaualTrainer to SFTTrainer

* test tests

* solve tests question

* solve conflict

* add set_seed

* solve set seed

* gpt3-ci err

* solve gpt3 ci problem
2024-11-21 18:59:28 +08:00
Yuanle Liu
90a1e335fd fix AutoInferenceModel for qwen-vl (#9463)
* fix AutoInferenceModel for qwen-vl

* fix AutoInferenceModel for qwen-vl

* fix readme.md in csrc

* fix export_model.py
2024-11-21 18:24:37 +08:00
whf313
6813e40b67 Revised PoSE (#8822)
* Yarn

* Revise

* Delete paddlenlp/transformers/llama/modeling_new.py

* Delete paddlenlp/transformers/llama/modeling_sparse.py

* Delete paddlenlp/transformers/long_sequence_strategies/embedding_strategies_old.py

* Delete paddlenlp/transformers/long_sequence_strategies/embedding_strategies_yarn.py

* Delete llm/run_finetune_old.py

* Update data.py

* Update test_long_sequence_strategies_pose.py

* Update test_long_sequence_strategies_pose.py

* Create test_long_sequence_strategies_pose.py

* Update and rename test_long_sequence_strategies_pose.py to test_yarn.py

* Delete tests/peft/test_yarn.py

* Update run_finetune.py

* Update pyproject.toml

* Update pyproject.toml

* Add files via upload

* Update pyproject.toml

* Revise

* Revised

* Revised

* Revised

* update

* update

* update
2024-11-21 16:06:41 +08:00
wawltor
5a343cf93a fixed the init problem in tensor parallel (#9452) 2024-11-21 15:26:41 +08:00
HydrogenSulfate
2b8a77b711 Update modeling_auto.py (#9461)
use paddle.cast instead of Tensor.astype
2024-11-21 15:23:17 +08:00
lvdongyi
872aafa093 [Tokenizer] Fix chat template for Gemma when answer is contained within question (#9462) 2024-11-21 10:15:38 +08:00
waliwali777
5ceb930bc3 Fix auto parallel CI exit -6 (#9460)
* merge two function list

* move env set before func running

* fix

* fix track case result status

* fix
2024-11-20 21:07:04 +08:00
Chang Lu
bd1fd926c5 [AutoParallel] Reconstruct sharding mesh dimension inference logic - Part2 add sharding_mesh_dimension param (#9382)
* add custom sharding_dim

* Update training_args.py

* Update auto_trainer.py

* Update auto_trainer.py
2024-11-20 20:27:14 +08:00
lugimzzz
d74df4d0ef add set_seed (#9429) 2024-11-20 16:10:27 +08:00
YUNSHEN XIE
db7ed0feac 增加benchmark多机任务执行脚本对于异常退出的处理 (#9442)
* 处理多机任务CE case的异常退出,增加对于训练日志更新状态的监控

* update

* Set execution variables for CE cases
2024-11-20 15:39:31 +08:00
Weiguo Zhu
590081a968 [LLM] Add expert parallel (#9368)
* add expert parallel utils

* update gates

* update

* update base methods

* update moe_layer

* update moebase

* add moe_gate and moe_layer for qwen2moe

* add config

* update

* update gate dtype

* update moe gate and layer

* update moe_layer.py

* update

* update

* update token_priority method

* update data type

* remove old moe

* fix moe capacity reduce.Max

* update comment

* lint
2024-11-20 14:57:46 +08:00
Weiguo Zhu
ca1af448f8 [ChatTemplate] Fix chat template when answer is contained within question. (#9444)
* fix chat template

* remove ans generation_prompt

* fix

* remove split test case

* add comments

* update

* revert fix

* fix qwen2 chat_template

* compatible with python 3.10

* support add token and update chat_template for llama3

* revert llama chat_template
2024-11-20 14:56:57 +08:00
Weiguo Zhu
554941fa7a update (#9447) 2024-11-20 14:56:35 +08:00
Chang Lu
d5a90f74ca [AutoParallel] add release_gradients and comm_buffer_size_MB to strategy (#9432)
* add release_gradients and comm_buffer_size_MB to strategy

* Update training_args.py

* add note

* fix codestyle
2024-11-20 13:56:49 +08:00
liym27
79bba4fa35 update conf for sharding overlap in auto_parallel static (#9456) 2024-11-19 21:44:36 +08:00
gongel
619c1b9279 refactor tool of creating pretrain dataset (#9454) 2024-11-19 20:17:25 +08:00
will-jl944
707240627d Fix row parallel lora layers parameters initialization bug (#9427)
* Fix row parallel lora layers parameters initialization bug

* Fix ColumnParallel LoRA layers

* Fix QuantLora param init bug
2024-11-19 17:26:19 +08:00
waliwali777
3fe6aba68e Reduce long duration for the exit -6 re-run process. (#9400)
* Reduce long duration for the `exit -6 re-run` process.

* fix

* Add export env

* Add log colorful
2024-11-19 15:58:51 +08:00
lugimzzz
f21329c279 fix pp no drop last (#9439) 2024-11-19 14:50:13 +08:00
Siming Dai
801dd74002 Update dist_dataloader.py (#9451) 2024-11-19 14:44:22 +08:00
Siming Dai
2ecf7ef484 [DistDataloader] fix eval new_group (#9438) 2024-11-18 21:27:09 +08:00
Weiguo Zhu
04291490f7 fix import in py38 (#9446) 2024-11-18 19:02:39 +08:00
co63oc
d971b2af4c Fix (#9419) 2024-11-18 18:59:18 +08:00
co63oc
a11367af72 Fix (#9434) 2024-11-18 18:58:51 +08:00
Dangweichong
81a2d43c6f [DCU] update dcu paddlenlp_ops (#9433) 2024-11-14 18:58:31 -08:00
Siming Dai
921fc44a4f [Unified Checkpoint] Support sharding_comm_overlap (#9392)
* update
2024-11-14 16:08:10 +08:00
Zero Rains
018b5300c4 [INFER][LLM] Add the AutoModel for inference mode (#9416)
* add the AutoModel for inference mode in dynamic graph

* add the AutoModel for inference mode in static graph

* create AutoInferenceModelForCausalLM class  and polish the code

* fix the return result

* add the confirm_inference_model method

* roback the AutoModel

* modify the description

* update
2024-11-13 23:13:49 -08:00
Liujie0926
c9cfa99f4a [CI]update target_lists_for_llm (#9417)
* update target_lists_for_llm

* add scripts/regression
2024-11-13 19:30:00 +08:00
Dangweichong
09d2c14c47 fix hip paddle_nlp_ops bug (#9418)
Co-authored-by: root <root@localhost.localdomain>
2024-11-13 01:09:05 -08:00
Jianbang Yang
2838e80e9d [XPU] llama swiglu uses Paddle's native swiglu (#9414) 2024-11-13 09:24:57 +08:00
zhangbo9674
10a62c7a36 [AutoParallel] refine log (#9397) 2024-11-11 17:45:04 +08:00
lugimzzz
b5e3f0cccb [LLM]add ktotrainer (#9393)
* add ktotrainer

* fix oom
2024-11-08 16:54:22 +08:00
Liujie0926
5c6279abc3 [CI]fix scripts (#9394)
* fix ci scripts

* [CI]add recursive for submodule

* [CI]fix
2024-11-08 16:53:08 +08:00
Liujie0926
eca4da486f [CI] add recursive for submodule (#9389)
* fix ci scripts

* [CI]add recursive for submodule
2024-11-08 10:28:26 +08:00
risemeup1
140ea48e20 Add submodule (#9385)
* add submodule

* add submodule
2024-11-07 15:41:18 +08:00
Siming Dai
d526be29d2 [Unified Checkpoint] Support empty state_dict saving (#9380)
* fix empty state_dict

* update sharding split_parma
2024-11-07 11:39:41 +08:00
tianyuzhou668
2f0b407d4a [Llama] Support pp + no_recompute_layer. (#9373)
Co-authored-by: 周天宇 <tianyu.zhou@iluvatar.com>
2024-11-06 17:03:51 +08:00
waliwali777
3971fc7c5f [AutoParallel] Fix EXCODE bug of AutoParallel CI (#9355)
* Fix exitcode bug

* Fix `track_case_status` func match bug

* Fix return code

* Fix print_info func with exit -6

* set output format of fail tests
modify verification check failed
2024-11-06 16:18:06 +08:00
gaoziyuan
09778587d6 [LLM INFER] Optimize fuse some kernels in postprocess (#9201)
* optimize fuse some kernels

* optimize fuse some kernels

* fix top_p reject

* fix

* ci

* fix review

* fix
2024-11-05 19:55:12 -08:00
zhangyuqin1998
19a2e1f5aa [Auto Parallel] fix adapt_stale_fwd_patch for to_static mode (#9372) 2024-11-06 10:24:30 +08:00
Siming Dai
85333aa6ad [Trainer] Update assert to warning (#9332)
* mv assert to warning
2024-11-05 14:34:28 +08:00
ShenLiang
9d658a9997 Add check for sharding stage1-v2 using amp master grad (#9333) 2024-11-05 14:33:55 +08:00
wanghuancoder
ab62e477a2 refine dtype use (#9366) 2024-11-05 14:11:16 +08:00
ShenLiang
565a6ab150 Add offload/reload for optimizer (#9359)
* support optimizer state offload (#8715)

* support optimizer offload

* update doc

* [FleetY]offload optimizer state after load optmizer state (#9352)

* add offload optimizer

* fix memory

* [FleetY] Add reload/offload for optimizer (#9356)

* add reload/offload for optimizer

* fix bug

---------

Co-authored-by: Guoxia Wang <mingzilaochongtu@gmail.com>
2024-11-05 10:10:09 +08:00
Weiguo Zhu
55a1bcb6d8 fix (#9363) 2024-11-05 10:06:58 +08:00
Siming Dai
e2cc3d5ae4 [Unified Checkpoint] Fix fp32 dtype for using newest paddle(#9360) 2024-11-04 19:23:50 +08:00
Leo Chen
1aa91be7bf clean print in auto_trainer (#9357) 2024-11-04 17:11:12 +08:00
lvdongyi
cd22b0de17 [Tokenizer] Add BertTokenizerFast, support register new tokenizer (#9353)
* Add , support register tokenizer, fix some typo

* add more tests

* CustomTokenizerFast2->CustomTokenizerFastWithoutSlow

* lint
2024-11-04 16:31:03 +08:00
chen
5217a3b795 [Inference] Append attn FP8 quant (#9328)
* add fp8 gen files to gitignore

* append_attn support fp8 quant

* Unified FP8 Network

* include cuda_fp8.h

* simplify qwen2 network and FusedBlockMultiTransformerFP8

* simplify llama network and code check

* check fp8 params

* code check

* check

* default config for fp8 gemm
2024-11-03 23:34:29 -08:00
waliwali777
582ff5eb2c Add CI testing for A100 and V100 device (#9324)
* Add ci for A100 and V100 device

* Fix device judge

* fix compare of float var

* Add output of test failed

* Fix cal fail test count

* Remove compare_float fun with `!=` to compare

* Fix output of fail tests

* Run  gpt-3_dygraph when related files modified

* add track status( fail tests ) for every case

* Add track status of loss verification failed test

* Move output position of every case

* modify `exit` to `return 0`
2024-11-04 10:55:58 +08:00
JZ-LIANG
66c5d65f18 [AutoParallel] Hang Bugfix for VPP-Sharding (#9336)
* bugfixed
2024-11-01 16:54:27 +08:00
ShenLiang
ba5c2ca330 Add ordered save to avoid OOM (#9347) 2024-11-01 14:52:33 +08:00
Weiguo Zhu
71dafa679f [Tokenizer] Support adding special tokens to Qwen tokenizer (#9344)
* update qwen tokenizer

* add test case
2024-11-01 14:33:33 +08:00
Weiguo Zhu
149cfa8789 [Docs] Add precision alignment doc (#9346)
* add precision alignment doc
2024-11-01 14:32:48 +08:00
Weiguo Zhu
8279b14497 [Tokenizer] Fix Llama3Tokenizer import (#9341) 2024-10-31 17:05:07 +08:00
Weiguo Zhu
483fff4adb Compatible with Tensor.to change to out_of_place. (#9343) 2024-10-31 15:38:30 +08:00
Cheng Yanfei
ce083f0739 [intel_hpu] initial commit for intel_hpu support (#9273)
* add intel hpu device

* add wa for intel hpu

---------

Co-authored-by: Zhai Feiyue <feizhai@habana.ai>
2024-10-31 11:13:21 +08:00
Leo Chen
26b73c2644 align default custom black/white list for dygraph and static graph (#9340) 2024-10-30 23:10:25 +08:00
lvdongyi
ec25cb8c84 [Tokenizer] Support reading Tiktoken tokenizer.model. (#9215)
* add support of tiktoken tokenizer, refactor some code

* add case of built-in tokenizers to handle CI error
2024-10-30 12:03:38 +08:00
Weiguo Zhu
f5f9d8524c Update README.md (#9339) 2024-10-30 11:50:38 +08:00
Siming Dai
78f911afb1 Update load_save_single_card.py (#9337) 2024-10-30 09:48:40 +08:00
Weiguo Zhu
3f1787fdf2 [Docs] Update flashmask (#9330)
* Update flashmask.md

* update link
2024-10-29 19:19:42 +08:00
Leo Chen
ec3973793d fix parameter calculation in auto_parallel mode (#9327) 2024-10-29 16:48:47 +08:00
Yuanle Liu
9575245c7b fix bug (#9335) 2024-10-29 15:20:01 +08:00
Yuanle Liu
f0aa672220 [LLM INFER] add rope_theta for block_multihead_attention (#9334)
* add rope_theta for block_multihead_attention
2024-10-29 15:13:13 +08:00
bukejiyu
975d5c72e4 [Inference] fix paddle cpu docs. (#9299) 2024-10-29 11:29:06 +08:00
Siming Dai
ce3a1ce11e [Unified Checkpoint] update non-merge checkpoint loading, move async_save_info.json location (#9321)
* [Unified checkpoint] update optimizer async save signal

* update async_save_info.json file place
2024-10-28 20:41:59 +08:00
Mangodadada
394aadaf83 fix readme (#9326)
Co-authored-by: huxinye <2392038429>
2024-10-28 20:07:03 +08:00
Mangodadada
2993974626 add flash_attention on model chatglm_v2 (#9296)
* add flash_attention on model chatglm_v2

* add flash attn and consider sequence parallel

---------

Co-authored-by: huxinye <2392038429>
2024-10-28 20:06:27 +08:00
Weiguo Zhu
7e37028bc0 Update QR code (#9325) 2024-10-28 17:51:50 +08:00
idontkonwher
05ae377f92 [METAX] Support llama for MX C550 (#9186)
* [METAX] Support llama for MX C550

* fix typo, add paddlenlp branch, add greedy strategy for demo

* add MXMACA software stack acquisition path
2024-10-28 15:32:17 +08:00
Siming Dai
c9d5673416 [Unified Checkpoint] Add split param and refactor code (#9240)
* [Unified checkpoint] update optimizer async save signal

* update paddlepaddle

* split param

* add save for split param

* fix save split_param

* add load uc split_param

* update uc files

* update uc files

* update split_param loading

* mkdir unified_checkpoint directory

* rename file

* update async handler

* update files

---------

Co-authored-by: gongenlei <gongenlei@baidu.com>
2024-10-28 13:14:11 +08:00
Yuanle Liu
81f5ab5452 update llm infer docs (#9314)
* update llm infer docs

* update
2024-10-25 18:43:08 +08:00
lugimzzz
81ffc78715 [Doc] Add flash mask (#9219)
* add flash mask

* translate

* translate

* update introduction
2024-10-25 16:19:12 +08:00
Yuanle Liu
2e8b220eb8 [LLM INFER] Fix some bugs and chatglm_v2 support block_attn (#9271)
* chatglm2 support block_attn and fix some bugs
* fix ci
* fix more ut error
* update
2024-10-25 15:06:23 +08:00
Lucas
b237ba7868 [XPU], support unified ckpt function (#9312) 2024-10-25 14:54:21 +08:00
Zhong Hui
2bf3d7f27e [TRL] Rename sft trainer. (#9292)
* rename sft trainer.
2024-10-25 14:08:20 +08:00
wawltor
75f44ef747 change the directory legacy to slm (#9311) 2024-10-25 10:52:59 +08:00
gongel
ff7ee8ade8 Fix non-pipelayer to distributed (#9310) 2024-10-24 17:51:50 +08:00
CrystalX
75517304a7 [Unified Checkpoint] Accelerate loading checkpoint by multi-thread (#9034)
* [Unified Checkpoint] speed up loading checkpoint by multi thread

* [Unified CHeckpoint] speed up load by multi-thread

* [Unified CHeckpoint] speed up load by multi-thread

* [Unified CHeckpoint] speed up load by multi-thread

* Unified CHeckpoint] speed up loading checkpoint by  multi-thread

* Unified CHeckpoint] speed up loading checkpoint by  multi-thread

* Unified CHeckpoint] speed up loading checkpoint by  multi-thread

* Unified CHeckpoint] speed up loading checkpoint by  multi-thread

* Unified CHeckpoint] speed up loading checkpoint by  multi-thread

* Unified CHeckpoint] speed up loading checkpoint by  multi-thread
2024-10-24 14:18:16 +08:00
Leo Chen
6211e3d38f clean llama static modeling file (#9301)
* clean llama static modeling file

* update readme

* fix

---------

Co-authored-by: wangnian01 <wangnian01@baidu.com>
2024-10-23 16:42:37 +08:00
Jianbang Yang
0102f311b4 [Tokenizer] Fix TokenizerFast missing clean_up_tokenization_spaces (#9304) 2024-10-23 15:17:23 +08:00
zhangyuqin1998
a564483f67 [Auto Parallel] fix bugs for split_batches_for_accumulation && fix bu… (#9217)
* [Auto Parallel] fix bugs for split_batches_for_accumulation && fix bugs for enable_delay_scale_loss

* add enable_delay_scale_loss flag for auto_parallel

* fix ut

* Update ci_case_auto.sh
2024-10-23 15:16:00 +08:00
Yuanle Liu
31c6b9a670 [LLM INFER] Append attn (#9244)
* refine paddle::empty(), fix memory error, support multi_stream for attention

* fix and rename attention as append_attention

* rename file
---------

Co-authored-by: lizhenyun <lizhenyun@baidu.com>
Co-authored-by: lizhenyun01 <1500424927@qq.com>
2024-10-23 12:06:53 +08:00
lugimzzz
3443b9f097 fix lora sharding v2 (#9300) 2024-10-22 20:37:18 +08:00
Yuang Liu
51f6a4b2fa [XPU] bug fix for xpu_parallel_matmul tensor parallel output. (#9297) 2024-10-22 16:25:42 +08:00
Weiguo Zhu
76a118b808 [FlashMask] Add FlashMask for Qwen2 (#9264)
* add flashmask
2024-10-21 15:05:49 +08:00
Guoxia Wang
220cc95c48 Support attention mask using causal=True for Baichuan 13B (#9268) 2024-10-21 11:10:31 +08:00
Weiguo Zhu
fe8b527a59 [CI] Fix llm/alignment/rm/flashmask path (#9289)
* fix llm/alignment/rm/flashmask

* update
2024-10-19 22:22:43 +08:00
Weiguo Zhu
1770b51ac6 [Tokenizer] Unify tokenizer _pad (#9280)
* add test cases for 3D attention_mask and attn_mask_startend_row_indices

* update attn_mask_startend_row_indices return type
2024-10-18 15:22:23 +08:00
Weiguo Zhu
b62ae984a5 [LLM] Add deepseekv2 (#9250)
* add deepseekv2
* update softmax_scale and attn_weights
---------

Co-authored-by: huxinye <2392038429@qq.com>
2024-10-18 14:39:10 +08:00
Weiguo Zhu
1dc6e18c48 [CI] Skip inference test cases (#9270)
* skip inference test cases
2024-10-18 14:09:03 +08:00
Siming Dai
2b975b1974 [Trainer] fix save_model (#9286)
* bug fix

* bug fix
2024-10-17 23:23:32 +08:00
Weiguo Zhu
5244e615a6 [Tokenizer] Enable padding_side as call time kwargs (#9258)
* enable padding_side as call time kwargs

* [padding_size] Compatible with self._pad without padding_size

---------

Co-authored-by: lvdongyi <lvdongyi1222@gmail.com>
2024-10-17 19:30:23 +08:00
zhangbo9674
5d45695d02 [AutoParallel] Change llama test from sharding stage2 to stage1 (#9281) 2024-10-17 17:45:21 +08:00
Siming Dai
823d69f789 [BugFix] Fix async hang (#9276)
* update async save signal

* fix async save hang
2024-10-17 12:13:43 +08:00
Mangodadada
cf0f478865 [DOC] Add config file for model chatglm2,gemma,yuan (#9139)
* add config file for model chatglm2,gemma,yuan

* fix dpo.md file, add soft link, fix readme.md

---------

Co-authored-by: huxinye <2392038429>
2024-10-16 19:18:04 +08:00
Siming Dai
697a4cc59e [Unified Checkpoint] update async save logic (#9274)
* update async save signal

* fix async save hang
2024-10-16 14:53:20 +08:00
lugimzzz
b090f18a3e change dataset (#9266) 2024-10-16 11:48:18 +08:00
liym27
e9532bc8c2 Fix tests for pass paddle AutoParallel CI (#9267) 2024-10-15 19:35:24 +08:00
Weiguo Zhu
5ad7a9c376 [Unified Checkpoint] Fix generation config save (#9223) 2024-10-14 22:40:03 +08:00
LiYuRio
0e96b0f37e Cherry-pick some PRs from incubate/paddlenlp-fleety (#9253)
* support pp-sharding reshard (#9153)

* support best unbalaced pp scheduler (#9235)

* remove pp hack (#9189)

---------

Co-authored-by: Meiyim <chenxuyi@baidu.com>
2024-10-14 17:00:52 +08:00
Yuanle Liu
3007c7912d [BugFix] fix pir dt2st (#9251) 2024-10-14 14:35:49 +08:00
Siming Dai
d46bc06fd2 [Unified Checkpoint] Support expert parallel (#9055)
* update code
2024-10-14 11:37:08 +08:00
sneaxiy
80916db4cf Cherry-pick some PRs from incubate/paddlenlp-fleety (#9245) 2024-10-12 16:41:48 +08:00
Yuanle Liu
04f3c20f37 [PIR] fix pir open bugs (#9248) 2024-10-12 10:36:58 +08:00
vivienfanghuagood
8a43b0f841 [CI] Reduce the time spent on git downloading third-party libraries (#9246) 2024-10-12 10:35:34 +08:00
Yuanle Liu
156182e715 [INFER] update tune_cublaslt_gemm op and fix some bugs (#9222) 2024-10-11 14:26:10 +08:00
gaoziyuan
f9eb62edc4 [LLM INFER] top_p_sampling_reject support top_p=0 and custom seed (#9202)
* fix top_p reject
2024-10-11 14:22:33 +08:00
zhangyuqin1998
ea37a6971e [Auto Parallel] Adding align mode support (#9150) 2024-10-11 11:52:59 +08:00
Weiguo Zhu
8b2cc08193 [version] update version info (#9241) 2024-10-11 09:41:44 +08:00
Zhong Hui
d2d0ae6aa8 [CI] Fix ci import. (#9239)
Co-authored-by: lugimzzz <zhenglujing@baidu.com>
2024-10-10 20:17:05 +08:00
zhangbo9674
0040a6068f [AutoParallel] Add test for fuse_ffn and fuse_attention_qkv pass (#9203)
* add ut

* add ut

* sovle conflict

* sovle conflict

* fix
2024-10-10 13:16:39 +08:00
Hanyonggong
37c211adf0 [LLM] Add tools for parameters (#9137)
* add tools
2024-10-10 11:19:06 +08:00
Chang Lu
dbd3947542 fix ut (#9228) 2024-10-08 19:21:09 +08:00
LixinGuo
7be935cd9a [CI] Fix auto ci return bug when run in v100 (#9216) 2024-10-08 17:16:19 +08:00
Chang Lu
75f5031dac [AutoParallel] add vpp align and pp amp test (#9176)
* add vpp test

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* add new test

* add new test

* Update ci_case_auto.sh
2024-10-08 15:44:16 +08:00
Guoxia Wang
1fc942924d compatible with flashmask API rename upgrade (#9019) 2024-09-30 11:28:47 +08:00
Wennie396
c2fcc3e0bc [AutoParallel] Move some auto_parallel args into class AutoTrainingArguments (#9155) 2024-09-30 11:02:54 +08:00
Weiguo Zhu
db80bddc50 [Models] Add Llama-3.2 (#9199)
* add llama3.2
2024-09-27 17:36:24 +08:00
LixinGuo
1694d7c00b Fix ci not set no_proxy and modify tests in pir mode (#9205) 2024-09-27 15:34:54 +08:00
Yuanle Liu
0289118c9b [LLM_INFER] Support quantized model from bos and fix docs (#9197)
* llama A8W8 support skip_scale
* support top_k
* qwen2 support skip scales
* merge develop
* add comment
* support quantized model from bos
---------

Co-authored-by: minghaipeng <minghaipeng@baidu.com>
2024-09-27 12:35:39 +08:00
lugimzzz
b2e4db2dcd Add FlashMask reward model (#9154) 2024-09-27 11:26:25 +08:00
Siming Dai
31e47a5a89 [Unified Checkpoint] update async_save_info in develop (#9173) 2024-09-26 16:25:56 +08:00
Weiguo Zhu
f80a051337 Skip dynamic to static test cases (#9196) 2024-09-25 23:49:11 +08:00
zhangbo9674
1b8f37f632 [AutoParallel] Fix ckpt convert bug for sharding v2 (#9179) 2024-09-25 23:48:52 +08:00
zhangbo9674
1ce2642efb [AutoParallel] Add FLAGS_enable_fused_ffn_qkv_pass for llama (#9182) 2024-09-25 23:48:13 +08:00
Ti Zhou
c62390157d [XPU] add xpu support for llama sft (#9152)
Co-authored-by: tizhou86 <tizhou86@users.noreply.github.com>
2024-09-25 16:14:20 +08:00
Zhong Hui
c4d3a2f19d Revert "[Tokenier] Enable padding_side as call time kwargs (#9161)" (#9192)
This reverts commit c5e6db56a3.
2024-09-25 15:43:36 +08:00
lvdongyi
c5e6db56a3 [Tokenier] Enable padding_side as call time kwargs (#9161) 2024-09-24 12:05:22 +08:00
LixinGuo
cd4e81640e [CI] remove run_pretrain_auto_static.py CI when open PIR (#9177) 2024-09-23 17:25:57 +08:00
greycooker
ad14dc4f46 [Trainer] Support skip data intervals (#8989)
* support skip data intervals

* add debug_data arg

* fix loss compute

* remove callback while skip data

* remove debug data

* add callback_handler

* remove debug_data

* fix conflict
2024-09-23 14:59:26 +08:00
Zhong Hui
353d2785a2 [Tools] Rename tool_helpers to fast_dataindex. (#9134) 2024-09-23 14:39:11 +08:00
lugimzzz
bc55104def [LLM][TRL] Support DPO with Pipeline Parallel (#9039)
* support dpo/kto pp
2024-09-20 18:01:57 +08:00
JZ-LIANG
8212b53cba [AutoParallel] enable ci for dp amp clip (#9062)
* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh
2024-09-20 16:51:48 +08:00
chen
c4f7acf454 [Inference] FP8 dual gemm auto-tune and support compile parallelization (#9151)
* fp8

* check

* check

* check

* check

* cutlass fp8

* fp8 chech

* check

* ffn1 tune

* delete

* check

* change file path

* top_p_sampling_reject.cu
2024-09-20 01:23:01 -07:00
Zhong Hui
25a5b4fa1b Update README.md (#9160) 2024-09-20 16:12:47 +08:00
Weiguo Zhu
7deb33c194 [Models] Add Qwen2.5 (#9157) 2024-09-20 15:46:56 +08:00
gaoziyuan
907ad20496 【Inference】Optimize top_p kernel performance (#9132)
* add top_p kernel
* fix code style
2024-09-20 11:52:18 +08:00
Weiguo Zhu
c93bada815 [Tokenizer] Fix decode output with space in decode_token (#9010)
* fix

* fix
2024-09-19 16:31:39 +08:00
lvdongyi
90cef20408 [Tokenizer] Add replace_additional_special_tokens parameter to add_special_tokens (#9144) 2024-09-19 11:35:06 +08:00
LixinGuo
7faad55567 Fix llm ce predict run error (#9149)
* fix llm ce predict run error
2024-09-19 11:29:20 +08:00
Weiguo Zhu
a6cf8826af [Docs] Update LLM docs (#9143)
* sync llm to docs/llm
* update pre-commit config
* update pre-commit config
2024-09-18 19:51:16 +08:00
Ferrebo
0540e97c50 [Fix] freeze shard-reshard (#9067) (#9148) 2024-09-18 16:59:43 +08:00
a31413510
4503dd3000 add multy devices supported models (#9079) 2024-09-18 15:31:57 +08:00
Jingqi Chen
e340457ece [LLM Inference] Qwen2_Moe Support wint4 (#9129)
* support wint4

* fix codestyle
2024-09-14 18:35:51 +08:00
Weiguo Zhu
d90617105a [DOC] Update docs (#9141)
* update doc
2024-09-14 16:02:44 +08:00
lixc
0832b5934b [Inference] Update fakequant (#9140)
* add a8w8(fp8) a8w8c8(int8) quant_type support
* add llama3.1 and qwen2 ptq config
* reformat quantization.md and argument.py
* update prepare data method for ceval ptq
* fix wint4 config bug
* use independent avg/abs_max observer
* rename fp8 quant_type
* update quantization.md
* remove ceval in run_finetune.py
2024-09-14 14:35:45 +08:00
zhangyuqin1998
e9338c24b9 [Auto Parallel] Fix ckpt_converter for auto_parallel (#9136) 2024-09-14 10:19:15 +08:00
zhangbo9674
089a3c3b3f [Benchmark] Fix amp level bug in some gpt tests (#9116) 2024-09-13 16:40:25 +08:00
Zhong Hui
5c1779c8bd [Feature] Add hardware flops for pretraining (#9069)
* fix hardware tflops.

* Support mfu for pretraining.
2024-09-13 14:53:07 +08:00
Ryan
e2f4c33d5e [DOC] Update quick_start.rst (#9127) 2024-09-13 14:33:28 +08:00
Weiguo Zhu
11252bcc89 [Fix] Remove ring_flash_attention warning (#9119)
* fix
2024-09-13 14:25:32 +08:00
wanghuancoder
399490b7b7 fix pir dtype (#9130) 2024-09-13 12:06:10 +08:00
Ruibiao Chen
cd3dc95814 Add fast_ln spmd rules (#9125) 2024-09-13 12:05:24 +08:00
chen
db270d91b7 [Inference]qwen2-a8w8c8 support use_fake_parameter (#9109)
* use_fake_parameter

* fixed qwen2 and llama fake data. support qwen2 multi-card inference

* check
2024-09-12 19:24:19 +08:00
Siming Dai
93a9b2cd8d [Unified Checkpoint] Fix uc lora config, fix release_grads (#9082)
* [Unified checkpoint] update optimizer async save signal
---------

Co-authored-by: gongenlei <gongenlei@baidu.com>
2024-09-12 17:49:21 +08:00
Jingqi Chen
d3302c5515 [LLM Inference] Support Qwen2_Moe Inference with MultiGPU (#9121)
* Support Qwen2-57B-A14B
* Fix codestyle
2024-09-12 13:23:11 +08:00
zhangbo9674
51b54d236f [AutoParallel] Fix add ut (#9120) 2024-09-12 11:03:28 +08:00
chen
3675ea2d90 [Inference] FP8 gemm auto-tune (#9094)
* fp8 cutlass gemm tune

* git ignore third_party

* check csrc/readme.md
2024-09-11 21:21:04 +08:00
duanyanhui
73a3db98d6 [DCU] fix DCU w8a8c8 GEMM shape (#9115) 2024-09-11 21:18:13 +08:00
gaoziyuan
ba9c345ec1 【Inference】fix step kernel (#9122)
* fix step.cu when setting FLAGS_allocator_strategy=auto_growth
2024-09-11 18:51:14 +08:00
Hongwen Xin
af23e2db5c [Bugfix] fix multi-gpu infer (#9107) 2024-09-10 14:42:43 +08:00
lixc
98062936c2 remove ceval from run_finetune (#9100) 2024-09-10 10:54:49 +08:00
JZ-LIANG
33fc7ff1ee [AutoParallel] Enable CI for gradclip (#9059)
* Update ci_case_auto.sh

* Update ci_case_auto.sh
2024-09-10 10:39:54 +08:00
zhangbo9674
2f31866d9c [AutoParallel] Disable UT (#9108) 2024-09-09 19:56:02 +08:00
Tian
d245d0787f [LLM] fix trainer on npu (#9101) 2024-09-06 23:16:27 +08:00
Siming Dai
c90dc87949 [CI] Fix paddlepaddle install (#9102)
* [Unified checkpoint] update optimizer async save signal

* update paddlepaddle

---------

Co-authored-by: gongenlei <gongenlei@baidu.com>
2024-09-06 22:56:48 +08:00
AIbin
2150ae3539 fix use paddle.incubate.jit.inference(model) errors (#9016)
* fix use paddle.incubate.jit.inference(model) errors

* fix jit_inference function

* fix jit_inference function

* fix jit_inference function

* fix jit_inference function

* fix jit_inference function

* fix jit_inference function

* fix jit_inference function

* fix jit_inference function

* fix jit_inference function

* fix jit_inference function

* fix jit_inference function
2024-09-06 17:35:27 +08:00
LixinGuo
ce0c0e73c5 Fix baseline because of PR#8769 (#9092) 2024-09-06 14:31:01 +08:00
yujun
7783744531 [data] update tool_helpers version and add unittest (#9093) 2024-09-06 12:18:19 +08:00
SevenSamon
f4cff9665e [LLM] Add tensor parallel for chatglmv2 (#9014)
* fix_chatglmv2_8k
2024-09-05 20:57:10 +08:00
EnflameGCU
1ef3ec2de8 [GCU] update readme (#9046) 2024-09-05 15:12:07 +08:00
Sonder
235f09f363 [PIR] add pir grad merge test (#9074)
* add test

* change task name

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh
2024-09-05 14:34:23 +08:00
LixinGuo
0854287269 Fix llm predict install error (#9088)
* fix llm predict install error
2024-09-05 14:10:46 +08:00
zhengzhonghui
951e3d45d5 Fix hang when Flag_dataloader_use_file_descriptor=True (#9080) 2024-09-05 11:19:27 +08:00
zhangyuqin1998
8ee99a46b7 [Auto Parallel] fix data stream bug of dist.to_static (#9077) 2024-09-05 09:40:49 +08:00
lixc
70da48252f [Inference] Fix weight_only_int4 bug (#9073) 2024-09-04 16:53:38 +08:00
Hanyonggong
fbbc0a2676 Fix the memory overflow bug of the tune_cublaslt_gemm operator (#9076)
* fix bug

* add cudacheck
2024-09-04 14:25:25 +08:00
Weiguo Zhu
9939f8451c [MLU] Fix Llama attrntion_mask in npu and mlu (#9075)
* fix
2024-09-03 20:47:23 +08:00
ronnywang
4e7fb49f27 [NPU] Fix baichuan2-13b-chat infer (#9070) 2024-09-03 11:19:15 +08:00
Weiguo Zhu
a4fbc5221f [Version] update version info (#9060)
* update version

* update

* update

* update
2024-09-03 09:32:49 +08:00
chen
84469d61e8 [Inference] Qwen2 support fp8 inference (#8954)
* qwen2 fp8

* fp8 check

* fp8 cutlass

* int8 cachekv

* a8w8c8_fp8
2024-09-02 21:02:43 +08:00
chen
a275ab7a47 [Inference] support llama3 a8w8c8_fp8 inference and cutlass_fp8_gemm (#8953)
* fp8

* check

* check

* check

* check

* cutlass fp8

* fp8 chech

* check

* support int8 kv cache

* a8w8c8_fp8

* Copyright check

---------

Co-authored-by: ckl117 <ck117@163.com>
2024-09-02 18:50:53 +08:00
PeiyuLau
a12781f928 Support rms_norm_mlu (#8504) 2024-09-02 16:57:14 +08:00
Sonder
e204b6db31 [AutoParallel][PIR] Fit pir grad merge (#8985)
* fit pir llm grad merge

* fit code style

* add grad merge llama test

* Update run_pretrain_auto.py

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* Update ci_case_auto.sh

* remove test

* Update ci_case_auto.sh

* Update ci_case_auto.sh
2024-09-02 12:39:08 +08:00
lixc
cda9594dce [Inference] Update fakequant script (#9054)
* 1. add a8w8(fp8) a8w8c8(int8) quant_type support
2. add llama3.1 and qwen2 ptq config
3. update quantization.md

* fix load_quant_model bug

* fix load quant bug

* update ll/README.md

* remove useless code

* update quant observer config

* resolve wrong modify

* fix prepare_qconfig

* remove unuse files

* update quantization.md

* reformat quantization.md and argument.py

* update prepare data method for ceval ptq
2024-09-02 10:50:44 +08:00
xuzhang
116841a089 fix bos download (#9023)
* fix bos download

* add test

* update
2024-09-02 10:43:20 +08:00
greycooker
90863b14b2 [Trainer] Add dp degree init (#9056) 2024-08-30 17:00:16 +08:00
Zhong Hui
3ec9a1ad32 Update quantization.md (#9057) 2024-08-30 16:41:29 +08:00
Meiyim
3ee8ab79d8 [Trainer] Fix moe save load (#9045)
* fix `upload signal` under pure dp and dp-moe (#8874)
---------

Co-authored-by: Ferrebo <kebo01@baidu.com>
2024-08-30 11:29:22 +08:00
liym27
312d41c419 [AutoParallel] Add test (#9015) 2024-08-30 11:11:54 +08:00
lixc
e0ba7ef923 [Inference] update fakequant support (#9047)
* 1. add a8w8(fp8) a8w8c8(int8) quant_type support
2. add llama3.1 and qwen2 ptq config
3. update quantization.md

* fix load_quant_model bug

* fix load quant bug

* update ll/README.md

* remove useless code

* update quant observer config

* resolve wrong modify

* fix prepare_qconfig

* remove unuse files
2024-08-29 22:19:19 +08:00
gaoziyuan
c28caf70b0 [Inference] Add cutlass gemm dequant op (#8909)
* change gpu name

* add cutlass gemm_dequant op

* add cutlass gemm_dequant op

* fix format

* fix fused_transformer_layers

* fix layer

* fix layer

* fix format

* fix format

* fix review

* fix review

* fix review

* fix review

* fix review

* fix review

* fix review
2024-08-29 20:58:38 +08:00
Yuanle Liu
a18e220c32 Fix setup.py for llm inference (#9041) 2024-08-29 11:42:00 +08:00
Hongwen Xin
47a95422d8 [Bugfix] fix bias optional (#9037) 2024-08-29 11:33:10 +08:00
lugimzzz
7be1e1663f [llm]support pad to max_length & fix sp bug (#9040)
* add sp hook

* support zero padding pad to max_length

* support finetune pad to max_length
2024-08-29 11:20:25 +08:00
Siming Dai
59568226eb [Unified Checkpoint] Update async save info (#8982)
* [Unified checkpoint] update optimizer async save signal

* [Unified Checkpoint] Update async save info
2024-08-29 11:11:03 +08:00
ShenLiang
ae691e21a0 [Cherry-pick] add comm buffer size (#8963) (#9031)
* add comm buffer size (#8963)

* add doc
2024-08-29 10:24:40 +08:00
ShenLiang
5eb8d034ae Fix checker of nan/inf (#9029)
* fix checker position for nan/inf

* fix checker position for nan/inf
2024-08-29 10:24:13 +08:00
lixc
19927ba5c2 [Inference] Add a8w8(fp8) a8w8c8(int8) quant_type support (#9032)
* 1. add a8w8(fp8) a8w8c8(int8) quant_type support
2. add llama3.1 and qwen2 ptq config
3. update quantization.md

* fix load_quant_model bug

* fix load quant bug

* update ll/README.md
2024-08-28 22:21:56 +08:00
Weiguo Zhu
3e7c5caa4a [Tokenizer] Support for loading added_tokens_decoder (#8997)
* fix added_tokens_decoder load

* fix decode

* fix saving and loading added_token_decoder

* fix mamba

* fix special_tokens_map_file load

* fix gemma tokenizer

* fix llama tokenzier

* revert llama tokenizer

* fix _decode
2024-08-28 20:38:07 +08:00
sneaxiy
c656452634 [Cherry-pick] Add is_distributed field in sharding reshard param_meta (#9028) 2024-08-28 20:05:15 +08:00
wawltor
ae02a3c1a2 fix the recompute for recall model. 2024-08-28 19:29:31 +08:00
wawltor
9b442c8bef Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2024-08-28 19:24:50 +08:00
bukejiyu
25a6d4e96b update cpu inference (#8984) 2024-08-28 19:16:09 +08:00
Yuanle Liu
2f567e6bf4 fix llama3 static run (#8849) 2024-08-28 16:09:43 +08:00
Jingqi Chen
34a71c8242 supprot qwen-moe (#8892)
Co-authored-by: yuanlehome <yuanlehome@163.com>
2024-08-28 11:50:00 +08:00
Sunny-bot1
a2f9558a81 llm inference docs (#8976)
* update inference docs

* update

* update

* update

* update

* fix comments

* fix comments

* fix comments

* update inference.md
2024-08-27 22:16:39 +08:00
Hongwen Xin
f6fc7ff64f [Feature] fused mixtral wint4 (#9013)
* [Feature] fused mixtral wint4

* [Refactor] refine code
2024-08-27 17:40:02 +08:00
zhangbo9674
a0609e8c3f Refine checkpoint converter (#9001)
* refine
2024-08-27 16:10:09 +08:00
Yuanle Liu
48820cbc1f Fix step.cu bug (#8995) 2024-08-27 10:58:54 +08:00
Weiguo Zhu
56d293dd77 Fix zero_padding (#9003) 2024-08-26 21:04:22 +08:00
zhengzhonghui
24fa97ee43 Fix qwen model use_casual_mask (#9009) 2024-08-26 19:22:47 +08:00
EnflameGCU
154928a0f5 [GCU] Add gcu llama2-13b readme (#8950) 2024-08-26 17:31:09 +08:00
xiguapipi
3ef7c1ba72 [XPU] Add README.md for llama2-7b (#8979)
* [xpu]add README.md for llama2-7b

* [xpu]add README.md for llama2-7b

* [xpu]rm readme.md

* [xpu]modify README.md for llama2-7b

* [xpu]modify README.md for llama2-7b

* [xpu]modify README.md for llama2-7b
2024-08-26 14:23:36 +08:00
Hongwen Xin
31cc283f07 [Feature] Fused Mixtral support (#8901)
* [Feature] Fused Mixtral support

* [Refactor] add MoeConfig and fix static graph export problem

* [Bugfix] fix small bug

* [Bugfix] fix moe_config bug

* [Bugfix] fix moe_config bug

* [Refactor] refine code

* [Refactor] refine code

* [Refactor] refine code

* [Refactor] match fused moe api change

* [Feature] wint8 support
2024-08-26 11:47:30 +08:00
lugimzzz
9f6b486501 【llm】update docs (#8999)
* update readme

* update readme

---------

Co-authored-by: DesmonDay <908660116@qq.com>
2024-08-26 10:22:08 +08:00
ShenLiang
8e1f6e6a76 [Distributed]Add loss nan/inf checker (#8943)
* add checker

* fix fp16
2024-08-23 16:14:09 +08:00
duanyanhui
1ea1f5079f [DCU] Add DCU inference docs (#8983) 2024-08-23 16:13:43 +08:00
yujun
de1dc17de0 Upgrade tool_helpers to support 32766个dataset. (#8994) 2024-08-23 14:26:58 +08:00
lugimzzz
3c4d157500 update finetune.md (#8990)
Co-authored-by: DesmonDay <908660116@qq.com>
2024-08-23 14:02:48 +08:00
xingmingyyj
aaacb3272f [auto_parallel] Add checkpoint convertor (#8847)
* Add the checkpoint conversion module
2024-08-22 18:11:26 +08:00
LixinGuo
38dd5700a6 Fix pip error in legacy benchmarks (#8978)
* fix pip error
2024-08-22 16:52:29 +08:00
zhangyuqin1998
56dba6d225 [Bug fix] fix skip consumed_samples twice bug (#8980) 2024-08-22 15:13:33 +08:00
winter-wang
cf3a672617 fix the loss base in llama_align_dygraph_dy2st_auto_bs2_bf16_DP2-MP1-PP1 for A100 (#8986) 2024-08-22 14:49:10 +08:00
Mangodadada
dd909d1330 更正run_dpo.py文件路径 (#8952) 2024-08-21 19:03:45 +08:00
Siming Dai
1191a51e91 [Unified checkpoint] update optimizer async save signal (#8975) 2024-08-21 17:12:16 +08:00
winter-wang
5f6998f32d add amp unit test case for auto_parallel ci. (#8966) 2024-08-21 15:14:41 +08:00
Weiguo Zhu
30a2ac6d90 [ZeroPadding] padding to max_length for sequence parallel (#8973)
* fix zero_padding for sequence parallel
2024-08-21 15:09:43 +08:00
zhengzhonghui
d505a97727 Fix qwen benchmark (#8969) 2024-08-21 11:35:43 +08:00
zhangbo9674
fbe1fae140 [Auto Parallel] Support save model file (#8927) 2024-08-21 11:16:09 +08:00
Siming Dai
0136312b74 [Unified Checkpoint] update async save (#8801)
* update async save

* move load_unified_optimizer

* update async save

* tmp

* add config

* update final async save

* add load_non_merge_optimizer

* update unlink func

* update final signal

* update windows for async_save

* fix rng load

* fix unittest

* fix distdataloader, update async_save

* update unlink

* remove dist dataloader

* fix load optimizer oom
2024-08-20 16:41:49 +08:00
Weiguo Zhu
27f8462f42 [CI] Fix (#8793)
* fix ci
2024-08-20 16:22:14 +08:00
Zhong Hui
326cf82153 Enable tensor parallel tests. (#8757) 2024-08-20 16:20:32 +08:00
yujun
bafd7e5c90 fix JambaModelIntegrationTest (#8965) 2024-08-20 14:47:35 +08:00
chen
ecfe0aca35 [LLM Inference] support qwen2 a8w8c8 inference (#8925)
* qwen2-1.5b a8w8c8
2024-08-20 11:43:11 +08:00
Yuanle Liu
71b3be3a51 [LLM Inference] add --use_fake_parameter option for ptq fake scales and fix compute error of total_max_length (#8955)
* update some code

* update

* update

* update

* update tune_cublaslt_gemm demo

* fix step in tune_cublaslt_gemm
2024-08-19 21:04:56 +08:00
yujun
0ec78aa916 [NEW Model] Add jamba (#8517)
* Add jamba
2024-08-19 20:12:21 +08:00
yujun
12107af7a2 [BUG] fix mamba tokenizer (#8958)
* fix

* fix

* fix

* fix
2024-08-19 16:42:49 +08:00
yujun
b08e44509d [NEW Model] Add mamba (#8513)
* add mamba

* update

* do not shift

* update

* push

* mamba 单测pass

* mamba

* update_model_kwargs_for_generation

* fix tests

* test

* test

* add tokenizer test
2024-08-19 13:22:45 +08:00
Siming Dai
8599a53410 Add greedy_zero_padding (#8933) 2024-08-19 11:47:12 +08:00
Weiguo Zhu
d2d4d92fb6 [Tokenizer] Add Fast Tokenizer (#8832)
* add fast tokenizer

* add convert slow tokenizer method
2024-08-19 11:09:42 +08:00
Siming Dai
e8708edf82 [Trainer] Fix distributed dataloader (#8932)
* fix ddloader, fix uc unittest

* update dataloader
2024-08-16 16:28:28 +08:00
winter-wang
277fdb4a5c support amp in pir dy2st mode. (#8485) 2024-08-16 15:39:11 +08:00
Zeyu Chen
e0d2809432 Update README.md 2024-08-16 13:18:19 +08:00
Yuanle Liu
6e12ef3400 [LLM Inference] move llm.utils.utils.py to paddlenlp.utils.llm_utils.py (#8946)
* adjust some code

* update

* update
2024-08-16 12:13:57 +08:00
Yuanle Liu
6d538c7b33 Fix predictor bug (#8947)
* fix bug

* update
2024-08-16 02:43:23 +08:00
Siming Dai
310a7bcb13 [Unified Checkpoint] Fix load best checkpoint (#8935)
* fix load best

* update
2024-08-15 20:43:36 +08:00
Yuanle Liu
c88a971ddf [BugFix] fix predict get_tensor_parallel_mappings (#8939) 2024-08-15 11:30:43 +08:00
zhangyuqin1998
9b76eb2452 [BugFix] fix create_optimizer_and_scheduler for auto_parallel (#8937) 2024-08-15 11:11:42 +08:00
Weiguo Zhu
8f6b001e39 update tokens compute (#8938) 2024-08-14 22:19:02 +08:00
Yuanle Liu
3fff3787ed [LLM Inference] support llama3.1 (#8929)
* support llama3.1

* update
2024-08-14 17:49:58 +08:00
Yuanle Liu
82ea8bc590 fix test_wint8 ut (#8930) 2024-08-14 16:57:46 +08:00
gongel
01bb1f80a2 [Cherry-pick] Fix pipeline eval (#8924) 2024-08-14 15:52:43 +08:00
zhengzhonghui
75c76365fd [TIPC] Set logging_step to 5 with baichuan && qwen benchmark (#8928)
* set logging_step to 5 with baichuan && qwen benchmark
2024-08-14 15:27:44 +08:00
greycooker
85fbe52fcc support json parameter (#8446) 2024-08-14 13:45:21 +08:00
Weiguo Zhu
0cc8554735 [doc] Update README (#8922)
* add yuan2 model list

* update
2024-08-14 10:36:03 +08:00
zhengzhonghui
f069a5350f Update qwen && baichuan benchmark config (#8920) 2024-08-13 12:58:36 +08:00
zhaogf01
30fc639eba [LLM]Update yuan model (#8786)
* add yuan model

* add yuan model settings

* fix conflict

* add readme

* update format

* update readme

* update readme

* update for lint

* update for lint

* update for lint

* update for lint

* add fp16

* update utils

* fix bug

* format

* correct pre-commit

* correct fp16

* delete rearrange

* add pre_train

* auto convert from torch

* support sft lora

* update structure

* fix yuantokenizer pad

* update scripts

* update readme

* update readme

* add pad_token_id

* format

* format

* update readme

* update for review

* update for review

* fix bug

* update to CRLF

* format

* support param convert

* update sft config

* fix modeling

* fix qk fuse&spilt and fix fa

* format

* format

* format

* fix fa dtype

---------

Co-authored-by: drownfish19 <drownfish19@gmail.com>
2024-08-12 16:25:07 +08:00
xiaoguoguo626807
57a42f8aa9 modify dict include none to aviod pir dytostatic bug in while op (#8898)
* modify dict include none

* recover
2024-08-12 14:27:46 +08:00
Yuanle Liu
0a5de127b7 [LLM Inference] Support qwen2 (#8893)
* stage 1

* update

* update

* support qwen2 bf16/wint8

* add qwen2 ptq map

* update

* fix tune_cublaslt_gemm.cu
2024-08-12 14:01:59 +08:00
greycooker
6f3e736ddb 【Fix】modify tensorboard requirements (#8904)
* modify tensorboard requirements

* modify tensorboard requirements

* modify tensorboard requirement
2024-08-12 11:48:59 +08:00
Yuanle Liu
5bc040a157 [LLM Inference] Refactor BlockInferencePredictor (#8879)
* stage 1

* update

* update

* fix ci

* fix ci

* fix ut
2024-08-12 10:08:41 +08:00
ShenLiang
718729921f fix format (#8878) 2024-08-09 16:55:15 +08:00
Zhong Hui
4ebec1d46d [Readme] Update README.md (#8908)
* Update README.md

* Update README_en.md
2024-08-09 13:19:02 +08:00
JZ-LIANG
c5e81094d3 bugfix auto parallel FA (#8903)
Co-authored-by: winter-wang <1030748926@qq.com>
2024-08-09 10:38:28 +08:00
Weiguo Zhu
4860d631e6 [doc] Update readme (#8905)
* update

* update

* remove
2024-08-08 22:13:00 +08:00
Zhong Hui
996198a199 Update run_pretrain.py (#8902) 2024-08-08 18:07:50 +08:00
zhengzhonghui
6f5bb76e96 [Fix] enable_sp_async_reduce_scatter for qwen_72b && llama2_70b (#8897) 2024-08-08 16:55:15 +08:00
Wennie396
fd692a8003 Fix fast_ln InferDtypeFn (#8891) 2024-08-08 16:41:22 +08:00
lugimzzz
2491f5d087 fix zeropadding (#8895) 2024-08-08 16:01:49 +08:00
xiaoguoguo626807
5c5701559e modify Paddlemix qwen dytostatic (#8869)
* modify api for pir

* modify api for pir

* pass none for while

* modify ci test
2024-08-07 17:31:53 +08:00
S M
678843e5bd Fix the issue of P-tuning official sample error (#8884)
* Fix the issue of P-tuning official sample error

* Create codecov workflow.yml

* Delete .github/workflows/workflow.yml
2024-08-07 17:30:07 +08:00
Ben
6235fcd09a Fix the bug with issues code 8641. (#8880) 2024-08-07 11:33:41 +08:00
zhengzhonghui
4cf0806677 Support nested list of dict inputs (#8876) 2024-08-06 17:24:03 +08:00
sneaxiy
dbf395f8bf Cherry pick some changes from incubate branch (#8862)
* Fix sharding reshard bug and support reshard in different partition ways (#8837)

* Fix sharding reshard bug and support reshard in different partition ways

* fix some bugs

* refine codes

* revert some useless codes

* add log

* Fix TP sync (#8846)

* fix sharding reshard compatiblity for wrong master weight name (#8851)

* change print to logger.info

* remove useless f-string
2024-08-06 11:05:07 +08:00
greycooker
c4d1abfbe5 support sft mapdataset (#8840)
* support sft mapdataset

* fix __len__ and __getitem__

* fix judge impl method

* fix mmap

* change variable name
2024-08-05 17:38:53 +08:00
Yuanle Liu
a6a7870761 [Inference LLM] support static c8 (#8833)
* support llama2 static c8

* fix

* fix

* fix

* fix ci

* fix ci

* fix ci

* fix ci
2024-08-05 11:30:04 +08:00
wawltor
680b85e543 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2024-08-01 20:43:42 +08:00
Siming Dai
77480a071d [UC] Fix tie_word_embeddings (#8795) 2024-08-01 19:41:04 +08:00
Siming Dai
12ba7ee237 Add release_grads (#8829) 2024-08-01 19:12:15 +08:00
Siming Dai
d4975e0b45 update_uc_merge (#8856) 2024-08-01 16:16:41 +08:00
zhangbo9674
7c43bc8a6e [AutoParallel] Refine save and load ckpt for auto_trainer (#8828) 2024-08-01 11:47:42 +08:00
Yuanle Liu
d406e56d1a Fix tune_cublaslt_gemm compile bug (#8844)
* fix tune_cublaslt_gemm

* Fix:

* fix
2024-07-31 15:36:05 +08:00
Hanyonggong
99d9bcb481 Add tune_cublaslt_gemm operator by cublaslt gemm algorithm and generate algo cache file (#8799)
* Add tune_gemm feature
2024-07-31 13:22:29 +08:00
yujun
fe7e2fe24e [BUG] Fix build train valid test datasets (#8826)
* train_val_test_num_samples
2024-07-31 11:26:08 +08:00
Weiguo Zhu
e85a68dfa3 [Models] Add llama3.1 (#8824) 2024-07-31 11:05:22 +08:00
GoldPancake
5da5c36522 [DCU] fix llama inference bug on DCU (#8815) 2024-07-29 15:57:10 +08:00
Yuanle Liu
6ea9dc0930 fix pad_token_id bug (#8814) 2024-07-29 13:02:28 +08:00
Zhuoqun Li
ee4944e75c add paddle nv-embed-v1 (#8785)
* add paddle nv-embed-v1

* rename hf_model and use config in models
2024-07-28 15:53:31 +08:00
Guoxia Wang
39632e97ec support Llama3.1 8B 128K generation on single GPU 80GB (#8811)
* support Llama3.1 8B 128K generation on single GPU 80GB

* support llama3 rope

* try to fix _clear

* fix

* fix

* add config
2024-07-28 11:56:39 +08:00
Weiguo Zhu
77c0b0ef9f [Doc] Update README (#8817)
* update readme

* update

* update

* update
2024-07-26 18:53:13 +08:00
Siming Dai
054c3addd9 [MoE] Optimizer parameter broadcast (#8810) 2024-07-26 18:00:06 +08:00
wawltor
53a510a460 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2024-07-26 16:43:11 +08:00
zhangbo9674
e6d74f7f64 [AutoParallel] Refine auto_trainer save load (#8767) 2024-07-26 14:07:22 +08:00
Siming Dai
5fd6dd23c1 add enable_sp_async_reduce_scatter (#8803) 2024-07-25 21:33:14 +08:00
Siming Dai
77f6e98114 [Prediction] Update LLM prediction. (#8778)
* update llama predict

* update qwen predict

* update chatglm predict

* update opt, gpt predict

* update return_numpy=True

* fix tp split

* bug fix
2024-07-25 20:47:41 +08:00
GoldPancake
105e0da074 [DCU] Llama a8w8 inference performance optimization (#8800)
* [DCU] Llama a8w8 inference performance optimization

* keep two cases

* change back
2024-07-24 21:30:23 +08:00
wawltor
320dfc7ee4 Update quantization.md 2024-07-24 19:15:38 +08:00
Yuanle Liu
6f56bd47d5 [Inference LLM] refine some code in llama wint8/4 (#8796)
* delete validate model and fix wint8/4 in llama

* update
2024-07-24 15:36:03 +08:00
Weiguo Zhu
da1eb9c875 fix (#8792) 2024-07-24 09:52:40 +08:00
TranscenderNing
de7d103dc3 vera-pissa method added (#8722)
* vera-pissa method added

* add vera-pissa

* Add vera-pissa and test

* Add vera-pissa and tests and correct the lint format

* Revise according to the review comments and add tests

* Revise according to the review comments and pass tests

* Revise according to the review comments and pass tests 1

* Revise according to the review comments and pass tests 2

* Revise according to the review comments and pass tests 3

* Revise according to the review comments and pass tests 31

* Revise according to the review comments and pass tests 32
2024-07-23 19:48:25 +08:00
yujun
7c18d9d71b [BUG] 额外添加20个样本,防止制作预训练数据的时候超过index (#8789) 2024-07-23 10:50:34 +08:00
Weiguo Zhu
c4efddf48f update version (#8791) 2024-07-22 20:56:27 +08:00
houj04
88d4b19bc6 [XPU] use allgather and fp32 multinomial for XPU (#8787) 2024-07-22 11:21:25 +08:00
Weiguo Zhu
e8e59d069c fix (#8779) 2024-07-22 11:03:21 +08:00
Zhong Hui
57000fa12c Refine savable (#8758)
* mark tensor_parallel_degree savable.

* fix
2024-07-19 14:23:13 +08:00
lszxb
dedf4c5662 fix incorrect token counting in llm/predictor.py (#8769) 2024-07-18 10:51:35 +08:00
Difer
62a18c4ad8 [Trainer] Enable parallel_config to use commas as delimiters. (#8677) 2024-07-17 20:09:25 +08:00
wawltor
e89399a21e fix the ce for the unittest (#8772) 2024-07-17 15:32:14 +08:00
wawltor
89095c34d2 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2024-07-17 13:05:41 +08:00
lszxb
ab72ba7940 fix the missing truncation=True in llm/predictor.py (#8768) 2024-07-17 11:14:39 +08:00
LixinGuo
227ec81e63 add benchmark baichuan2 scripts (#8683)
* remove tsinghua pypi

* modify gpt dateset addr for benchmark

* fix run_benchmark for llama2_70b in auto_parallel

* fix autotunner benchmark error and fix llama2 dy2st benchmark

* fix benchmark dir because of PR#8627

* Update run_benchmark.sh

Update run_benchmark.sh

* fix benchmark dir because of PR#8627

* add qwen N4C32

* fix etcd

* fix qwen N4C32 for per_device_type

* fix benchmark dir and add CUDA_DEVICE_MAX_CONNECTIONS to qwen

* add benchmark baichuan2 scripts

* fix run time

* update baichun2_13b config
2024-07-17 10:55:09 +08:00
lizexu123
5e53db1361 【inference】support load or save Llama2-7b in three patterns (#8766)
* config:

* fix
2024-07-16 20:43:00 +08:00
Weiguo Zhu
5a508e5c4c Fix version show (#8754) 2024-07-15 14:38:41 +08:00
Weiguo Zhu
be957f06fa [NPU] Fix sequence parallel lib import (#8760) 2024-07-15 11:13:48 +08:00
JZ-LIANG
7a1c4394d8 [AutoParallel] update loss for global clip (#8750)
* update loss for global clip

* skip ci
2024-07-12 16:14:29 +08:00
Weiguo Zhu
10d058d2b1 [PaddleNLP 3.0] Update README (#8681)
* update

* update readme

* update

* update

* update

* update

* update

* update

* update

* update README(EN)

* correct broken links in readme

Signed-off-by: Zhang Jun <jzhang533@gmail.com>

* add markdownlint

* update

* add check_spaces

* update

* update readme

* update readme

* update

* update

update readme

* update readmes

* update

* update

* update llm doc index

* update

* add rlhf docs

---------

Signed-off-by: Zhang Jun <jzhang533@gmail.com>
Co-authored-by: Zhang Jun <jzhang533@gmail.com>
2024-07-12 11:06:56 +08:00
Leo Chen
028206b6cb update a100 loss (#8708)
* update a100 loss

* disable test

* enable check
2024-07-11 19:38:31 +08:00
zhangyuqin1998
2f0f8b1628 [Bug fixes] Fix ring attention (#8740)
* fix ring attention

* fix

* fix
2024-07-11 16:52:19 +08:00
Weiguo Zhu
e336e78c33 [LLM] Update sequence parallel linear import (#8706)
* Update sequence parallel linear import

* update lora models

* update lora sequence parallel layer
2024-07-11 12:04:05 +08:00
LixinGuo
c4f99ee07a fix nlp dir and auto_parallel_ci exit -6 (#8744) 2024-07-11 11:19:20 +08:00
zhaogf01
1af227adda [LLM] Add Yuan model (#8654)
* add yuan model

* add yuan model settings

* fix conflict

* add readme

* update format

* update readme

* update readme

* update for lint

* update for lint

* update for lint

* update for lint

* add fp16

* update utils

* fix bug

* format

* correct pre-commit

* correct fp16

* delete rearrange

* add pre_train
2024-07-11 10:42:16 +08:00
ronnywang
a1dbc39aae revert benchmark fix (#8747) 2024-07-10 20:06:38 +08:00
wawltor
04c9b39f22 fix the tipc ce case 2024-07-10 19:48:31 +08:00
jzhang533
324112048d correct broken links in readme (#8741)
Signed-off-by: Zhang Jun <jzhang533@gmail.com>
2024-07-10 16:28:30 +08:00
Weiguo Zhu
1a2502c4b8 [Safetensors] Fix mmap for Windows system (#8734)
* fix mmap for Windows system
2024-07-10 14:33:53 +08:00
lugimzzz
fbe613bbc5 disable lora (#8674)
* disable lora

* lora disable & merge

* fix

* fix unitest

* fix the finetune and predict in llm

---------

Co-authored-by: wawltor <fangzeyang0904@hotmail.com>
2024-07-09 10:53:10 +08:00
Yuang Liu
595c2fbf8f bug fix (#8730) 2024-07-09 10:04:30 +08:00
tianhaodongbd
e6810195d0 Finetune support use_fast_layer_norm (#8717) 2024-07-08 16:52:25 +08:00
zhengzhonghui
bdd2287bf3 fix fast_ln backward (#8719) 2024-07-05 16:30:52 +08:00
lizexu123
d8ddba9244 【inference】support load or save Llama2-7b in three patterns (#8712)
* fix

* fix

* 删除注释

* 恢复+删除

* 删除+恢复
2024-07-05 10:32:03 +08:00
Yuang Liu
e471b1e8af fix xpu gather for unified ckpt (#8710) 2024-07-05 10:18:02 +08:00
zhengzhonghui
70564ba8cd [Benchmark] Enable use_fast_layer_norm for llama2 benchmark (#8714) 2024-07-04 20:35:08 +08:00
zhengzhonghui
fd01043844 [Performance] Add fast_rmsnorm (#8680)
* add fast_rmsnorm
---------

Co-authored-by: Liu Yiqun <liuyiqun01@baidu.com>
2024-07-04 17:00:15 +08:00
Yuang Liu
6d464bfa79 xpu use allgather (#8697)
* xpu use allgather

* xpu use allgather
2024-07-03 17:19:25 +08:00
yujun
85cbadad35 num_samples 向下去整,防止prefrech预取时候超过数据集最大长度... (#8690) 2024-07-03 15:54:31 +08:00
wawltor
cf57f86755 fix the fast tokenizer in the taskflow 2024-07-03 11:24:32 +08:00
Siming Dai
c574d6de5a [Safetensors] Fix safetensors shape (#8702)
* Update sequence_parallel for predict

* Do not save moe_group

* Fix safetensors reading
2024-07-03 11:03:03 +08:00
Ting
af19dc4c4f Add new mistral (#7425)
* mistral model init commit

* code save

* add dump code

* mistral support lora,prefix,multi-gpu

* bug fix

* add flash attention

* mistral sliding windows attention (attention_mask version)

* llm json fix

* bug fix

* ci code save

* mistral ci, attention mask

* remove redundant comment

* remove print

* empty commit

* update

* add init py

* bugfix

* remove swa strategy

* update

* lora support

* update

* add tp cross entropy

* support zero padding

* update README.md
2024-07-03 10:55:11 +08:00
Leo Chen
64efd1ff0c update loss base of auto-parallel tests (#8701)
* clean legacy case

* clean gpt tests in model_zoo

* disable check

* fix loss base

* enable check
2024-07-03 10:49:40 +08:00
gmm
eaa80c985c [benchmark] Change the mirror source for pip (#8699) 2024-07-02 20:36:26 +08:00
lzydev
4a56c68855 change max_steps (#8679) 2024-07-02 19:57:41 +08:00
xiaoguoguo626807
d832282f84 【pir save 】Modiy export llama model file in pir mode (#8689)
* modify model to support llama export json

* modify model to support llama export json

* modify id

* modify full_like None

* modfiy utils

* reply comment
2024-07-02 19:51:11 +08:00
sunrui
79de55278a [Pre-Train] 支持qwen2预训练处理 (#8698) 2024-07-02 17:02:16 +08:00
Jianbang Yang
a53477cddf [XPU] add lora optimization (#8527)
* [XPU] add lora optimization

* fix

* refine
2024-07-02 11:16:47 +08:00
Ting
2723138738 bug fix (#8687) 2024-07-01 15:01:58 +08:00
LixinGuo
be5bb14a8b fix benchmark dir and add CUDA_DEVICE_MAX_CONNECTIONS to qwen (#8678)
* remove tsinghua pypi

* modify gpt dateset addr for benchmark

* fix run_benchmark for llama2_70b in auto_parallel

* fix autotunner benchmark error and fix llama2 dy2st benchmark

* fix benchmark dir because of PR#8627

* Update run_benchmark.sh

Update run_benchmark.sh

* fix benchmark dir because of PR#8627

* add qwen N4C32

* fix etcd

* fix qwen N4C32 for per_device_type

* fix benchmark dir and add CUDA_DEVICE_MAX_CONNECTIONS to qwen
2024-06-28 15:14:09 +08:00
yuguo
5364d5e612 [DCU] high performance LLM train and inference for DCU (#8580)
* [DCU] high performance LLM train and inference for DCU
2024-06-28 15:04:31 +08:00
gongel
a2b8a7835c update version (#8676) 2024-06-28 10:44:16 +08:00
Ting
c86e44774e Sft flash mask (#8664)
* support sft flash mask

* dpo support

* update

* remove dense mask when using flash mask

* bugfix

* support pp

* bugfix

* bugfix

* bugfix

---------

Co-authored-by: gongel <ainlp88@qq.com>
2024-06-28 10:43:42 +08:00
gongel
3ebe938339 Update version (#8675)
* update version

* update pre-commit
2024-06-27 20:56:41 +08:00
Siming Dai
cd5ca827f7 Update export model (#8671)
* Update sequence_parallel for predict

* Do not save moe_group

* update export model
2024-06-27 20:54:10 +08:00
lugimzzz
513e21d1d2 adjust llm readme (#8672)
* fix readme

* update readme

* fix readme

* fix readme
2024-06-27 20:53:30 +08:00
DrownFish19
04c2f2b0ec [PaddleNLP 3.0] Update README.md (#8666)
* update README.md

* update readme

* update readme

* fix

* fix dead link

* update figures

* update

* fix

* update

* update

* update quick start

* update figures
2024-06-27 20:53:16 +08:00
lugimzzz
1182cd553e support flashmask (#8670)
* support flashmask

* support flashmask
2024-06-27 20:52:56 +08:00
lzydev
dae64cc8f5 【AutoParallel】Change benchmark config for llama2-7b (#8667)
* change benchmark config for llama2-7b

* change logging_steps
2024-06-27 20:12:58 +08:00
bukejiyu
69e04c0c04 support llama avx model inference (#8634) 2024-06-27 19:42:47 +08:00
gmm
c6c2cd8a10 [benchmark] fix benchmark script (#8648)
* add llama-7b_auto_dp2mp2pp2 benchmark sh

* add llama-7b_auto_dp2mp2pp2 benchmark script for cinn

* update llama-7b_auto_dp2mp2pp2 benchmark script

* Update run_benchmark.sh

* Update run_benchmark.sh

* fix llama-7b_auto_dp2mp2pp2/benchmark_common

* Update run_benchmark.sh

* Update prepare.sh

* Update prepare.sh

* Update prepare.sh

* Update prepare.sh

* Update prepare.sh

* fix benchmark script

* fix script path for transformer benchmark
2024-06-27 16:37:47 +08:00
Yuanle Liu
faabf870b5 inference support llama3(wint8|4/a8w8) (#8630)
* inference support llama3

* fix
2024-06-27 10:49:59 +08:00
lugimzzz
69be4dbaf8 fix (#8668)
Co-authored-by: zhangjunjun04 <zhangjunjun04@baidu.com>
2024-06-26 20:07:50 +08:00
LixinGuo
80e7ef55ef fix benchmark dir because of PR#8627 (#8649)
* remove tsinghua pypi

* modify gpt dateset addr for benchmark

* fix run_benchmark for llama2_70b in auto_parallel

* fix autotunner benchmark error and fix llama2 dy2st benchmark

* fix benchmark dir because of PR#8627

* Update run_benchmark.sh

Update run_benchmark.sh

* fix benchmark dir because of PR#8627

* add qwen N4C32

* fix etcd

* fix qwen N4C32 for per_device_type
2024-06-26 18:54:52 +08:00
DrownFish19
4e971f82b6 [DOC] Fix dead link (#8662)
* update dead link

* update dead links

* update dead links

* update dead links

* update dead links
2024-06-26 13:42:23 +08:00
Tian
8edb84e543 [LLM][NPU] fix on readme (#8659) 2024-06-26 10:40:36 +08:00
DrownFish19
381949da62 Fix different length for numpy>=1.24.x (#8655)
* fix different length for numpy>=1.24.x

* update numpy version
2024-06-25 20:49:16 +08:00
DrownFish19
7130c185a9 Add License (#8658) 2024-06-25 14:43:30 +08:00
zhengzhonghui
007b653544 fix fast_ln compile error (#8650) 2024-06-25 11:45:10 +08:00
Leo Chen
11a7fd38f5 align llama auto_parallel dataloader with manual_parallel (#8639) 2024-06-25 11:40:25 +08:00
Tian
25d21402d7 [NPU][LLM] add README & reformat llama scripts (#8642)
* [NPU][LLM] add README & reformat llama scripts

* [LLM][NPU] fix readme 0621

* [LLM][NPU] reformat npu scripts
2024-06-22 11:47:41 +08:00
Difer
65e721e788 [LLM] Add sequence_parallel support for qwen (#8558)
* add sequence_parallel for qwen

* add sequence_parallel in qwen pp
2024-06-21 11:13:11 +08:00
lugimzzz
498f709884 [LLM] change llm content (#8627)
* change llm

* fix

* fix

* fix ci

* fix

* fix

* fix

---------

Co-authored-by: zhangjunjun04 <zhangjunjun04@baidu.com>
2024-06-21 10:51:22 +08:00
gmm
34fcced27f 【benchmark】 fix model_zoo path (#8643)
* add llama-7b_auto_dp2mp2pp2 benchmark sh

* add llama-7b_auto_dp2mp2pp2 benchmark script for cinn

* update llama-7b_auto_dp2mp2pp2 benchmark script

* Update run_benchmark.sh

* Update run_benchmark.sh

* fix llama-7b_auto_dp2mp2pp2/benchmark_common

* Update run_benchmark.sh

* Update prepare.sh

* Update prepare.sh

* Update prepare.sh

* Update prepare.sh

* Update prepare.sh
2024-06-20 19:51:27 +08:00
XiangGao
5619cc3286 because PaddleNLP has changed path of model_zoo, we also changed in ci_case_auto.sh and ci_case_dy.sh (#8633) 2024-06-20 14:12:05 +08:00
DrownFish19
da8b9ac70e [LLM] Support prefix tuning and lora for qwen2 (#8601)
* add unittest for qwen2

* update for tie_word_embeddings

* update qwen2

* update for tokenizer set attr to null

* support prefix training

* fix llm unittest

* fix pipeline and sequence parallel

* add pretrain configs

* add lora, prefix tuning, sft config

* fix pp for lora and recompute
2024-06-20 11:47:03 +08:00
DrownFish19
6bfca91b9f [PaddleNLP 3.0] update dataset preprocess (#8629)
* update datasets preprocess

* add symbolic link 'preprocess' for ernie-1.0
2024-06-20 11:45:45 +08:00
Zhong Hui
7318273ada [PaddleNLP 3.0] Refactor/3 part3, move pipelines. (#8619)
* mv pipelines legacy.

* remove ppdiffusers.

* remove unused.

* refine ci.
2024-06-19 20:43:02 +08:00
zhink
347717b8d4 fix npu llama (#8628) 2024-06-19 20:41:50 +08:00
Ting
fde454c2f5 remove fast generation (#8625)
* remove fast generation

* fix ci
2024-06-19 20:17:45 +08:00
Guoxia Wang
9c59aad16f [LLM] support sparse attention for LLAMA (#8592)
* [LLM] support sparse attention for LLAMA

* fix modeling_pp.py and rename attn_mask_start_row_indices

* fix assert
2024-06-19 17:37:54 +08:00
sneaxiy
7dcd1fdc4d Update PaddleNLP to fix PPO (#8618)
* Update PaddleNLP to fix PPO

* fix lint
2024-06-19 17:06:19 +08:00
Zhong Hui
9361a4e510 Fix dead link (#8626) 2024-06-19 16:28:05 +08:00
Yiqun Liu
970b8680d2 Remove delay_scale_loss and release_grads for llama-2 13B's benchmark. (#8623) 2024-06-19 12:54:59 +08:00
gongel
4e16650ae6 [PaddleNLP 3.0] Refactor RLHF (#8617)
* refactor PPO & RM
2024-06-19 11:23:02 +08:00
Zhong Hui
a8d446c7d5 [PaddleNLP 3.0] Refactor, merge examples/language_model model_zoo to legacy/model_zoo (#8614)
* merge examples/language_model model_zoo to legacy/model_zoo
2024-06-19 11:13:28 +08:00
Ting
2f3af3b662 [PaddleNLP 3.0] Repo adjustment (#8605) 2024-06-19 11:11:25 +08:00
Zhong Hui
cd2a70e385 [PaddleNLP 3.0] Refactor/3 part1- remove fast tokenizer. (#8613)
* delete fast_tokenizer.

* delete deploy with fast_tokenizer.

* delete fast tokenizer in tests.
2024-06-18 18:49:32 +08:00
tianhaodongbd
cbd0ab3a09 Finetune support continue_training (#8615) 2024-06-18 16:11:30 +08:00
DrownFish19
307960cf25 [PaddleNLP 3.0] Refactor examples (#8609) 2024-06-18 11:14:21 +08:00
sneaxiy
c134a7f2ae to_json_string兼容性升级 (#8608)
* to_json_string兼容性升级

* fix lint format
2024-06-17 12:22:45 +08:00
Zhong Hui
0844a5b730 [Feature] Optimize config saving. (#8490)
* support not saving training config.

* fix print.

* add llm meta config to run pretrain.

* fix optionals.

* delete duplicate keys.

* tmp

* change tensor_parallel_output to default to true.

* move out fuse_attention_qkv, fuse_attention_ffn

* add to finetune.

* delete print.

* tensor_parallel_output =  true

* fix

* fix

* fix

* fix to dict.

* bug fix.

* add register_nonsaveable_keys.

* apply register_nonsaveable_keys.

* fix ci.

* fix qwen2

* fix all.

* fix.

* fix ci.
2024-06-14 17:31:41 +08:00
ShenLiang
7bf31a39a1 Add main process print (#8604) 2024-06-14 14:42:11 +08:00
yinwei
439f8f3395 [Bug Fix] fix sharding stage1 allgather overlap bug, which needs to forbiden pin memory (#8594)
* forbiden pin memory
2024-06-13 20:38:33 +08:00
zhink
2dc4d7bb0a [XPU] Open ir pass (#8598) 2024-06-13 20:27:55 +08:00
Zhong Hui
8e24341bf0 Fix dataset with empty char. (#8469)
* fix dataset with empty char.

* revert file links.
2024-06-13 17:11:44 +08:00
Guo Sheng
4bca376b24 Clean ppo main script (#8596) 2024-06-13 15:07:12 +08:00
NeroLoh
77a7693a58 [xpu] change xpu setup.py to paddlenlp_ops (#8595)
Co-authored-by: neroluo <neroluo@github.com>
2024-06-13 14:47:45 +08:00
Guo Sheng
bf6d4e70f6 Add Pipeline Parallel for PPO training and support generation with InferenceModel (#7953)
* Add Pipeline Parallel for PPO training.

* Move new_ppo_trainer.py to ppo_trainer.py

* Fix padding among batches of accumulation steps in _prepare_pipeline_inputs_func.

* Fix hcg using in TP generation

* Try to support generation in PP. And allow extra training args passed from main from_pratrined.

* Support PP generation.

* Fix PP eval by unify prediction_step

* Fix reward value showing error cased by BF16 dtype when eval

* fix all

* Make non-PipelineParallel models use the same loss layer with PipeModel to unify.

* add offload.

* Use create_loss to unify Pipe and non-Pipe usage.

* Add eval mode and offload level.

* merge

* support tp+pp

* fix data split.

* Fix position_ids in generation/eval/train.

* fix data group.

* add tp rank guard

* Support rollout label data both with target length or source+target length.

* Move metric calculation to rl_step to avoid comm.

* fix pad

* fix create group.

* no print

* Suppport inference model generation.

* fix compatible for no eval model.

* fix pp sync.

* remove debug info

* Refacor PPO training using StepTrainer.

* Open PolicyTrainer loss logging postprocess. More StepTrainer docs.

* more timer.

* fix bugs.

* Add EMA and PPOMetric

* add tests

* add unit test for rank guard.

* Fix reshard zero3 and reshard infer.

* Revert #7818 for llama and remove position_ids for gen/train/eval to align.

* Move reload/clean/data_group to comm_utils and use guard to decorate them.

* Offload sync and other data reuse fix.

* Clead code

* Update README

* Update ppo_trainer

* format code

* Fix make_position_ids by 4d causal mask.

* Fix nested_broadcast_tensor_with_empty import

* Update eval with make_attention_mask

---------

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
Co-authored-by: gongenlei <gongenlei@baidu.com>
2024-06-13 14:33:56 +08:00
zhink
3d777c1c27 [XPU] xpu devices support llama-7b basic mode inference (turn on BlockAttention) (#8588)
* xpu devices support llama-7b basic mode inference (turn on BlockAttention)
2024-06-13 11:10:51 +08:00
NeroLoh
5ba7a94d52 [xpu] add xpu custom ops support for llama2-7b (#8515) 2024-06-12 20:17:31 +08:00
Zhong Hui
2b557e2feb [CI] Enable test with re-try. (#8590) 2024-06-12 19:33:18 +08:00
Difer
525eef76f0 [CE] Fix autotuner resume case (#8259) 2024-06-12 16:14:03 +08:00
LixinGuo
ef84facad7 [CE] Fix autotunner benchmark error and fix llama2 dy2st benchmark (#8587)
* fix autotunner benchmark error and fix llama2 dy2st benchmark
2024-06-12 16:12:56 +08:00
DrownFish19
5bdf75105e [LLM] Fix Qwen2 (#8584)
* fix output_router_logits

* fix with __future__
2024-06-12 14:03:37 +08:00
DrownFish19
4609d07a54 [LLM] support Qwen2 (#8338)
* add Qwen2Moe

* update default config

* update QWen2Moe modeling

* update modeling

* update ckpt name

* support same prefix model name for auto modeling

* update qwen2moe testing

* update qwen2moe modeling and config

* update qwen2moe import

* fix mlp hidden_size

* update qkv bias convert

* update modeling init_weight

* update _get_name_mappings

* update _get_name_mappings and _init_weight

* add tokenizer

* update modeling

* update modeling

* update  tokenizer

* update modeling and tokenizer

* fix index_add_ error

* fix

* update comments

* update lora weights

* add todo

* update Copyright

* update Moe to MoE

* update comment

* update Copyright

* update readme and json

* update __init__.py

* add qwen-1.5

* update QWen to Qwen

* update Qwen2MoE to Qwen2Moe

* update readme

* update qwen2moe sft and lora json

* update qwen2moe base name

* update qwen2

* update

* update readme

* update readme

* update readme
2024-06-11 20:24:42 +08:00
lugimzzz
909be01bf9 add llama & qwen dpo (#8474)
* add llama&qwen dpo

* add

* add dpo

* fix bug

* add
2024-06-11 14:33:47 +08:00
ShenLiang
547d29c7e9 Add async save for optimizer (#8557) 2024-06-11 14:22:14 +08:00
Zhong Hui
eaf8cb13a4 [CI] Fix ci pyproject.toml (#8541)
* Update pyproject.toml
2024-06-11 11:48:08 +08:00
Zhong Hui
fe5b6fd900 fix test_long_sequence_strategies (#8568) 2024-06-11 11:11:19 +08:00
sneaxiy
bcacc6aa21 [Cherry pick] Sharding reshard function enhancement (#8544)
* fix bug of sharding format (#8483)

* Optimize the speed of set_state_dict (#8532)

* fix sharding reshard save (#8535)

* Fix ignore_data_skip bug when timer is enabled (#8536)

* Save parameter shape and dtype when using sharding reshard (#8543)

* save parameter shape and dtype

* refactor

* format pre-commit

---------

Co-authored-by: ShenLiang <2282912238@qq.com>
2024-06-11 10:23:28 +08:00
Ghost Screaming
162d8d31c8 [AutoParallel] Add benchmark for llama-7b-dy2st. (#8559)
* [AutoParallel] Add benchmark for llama-7b-dy2st.
2024-06-07 14:40:05 +08:00
Zhong Hui
f89c91d960 [FIX DDP] fix ddp (#8549)
* enable trainer tests.
2024-06-07 14:37:38 +08:00
Galaxy1458
4e3f60dbc5 Update llama_npu_opt_lora.sh (#8562) 2024-06-06 20:58:13 +08:00
ronnywang
8887ed5ed6 fix llama export (#8561) 2024-06-06 16:52:24 +08:00
lzy
0e0c9b4c92 Update generation_utils.py (#8502)
* Update generation_utils.py

* Update generation_utils.py
2024-06-06 15:18:13 +08:00
zhengzhonghui
d06b3279d4 add fuse_attention_ffn support for qwen (#8526) 2024-06-06 14:47:34 +08:00
Zhong Hui
79e8b6eefd Update modeling.py (#8548) 2024-06-06 14:45:30 +08:00
Siming Dai
66ad506a67 Update sequence_parallel for predict (#8551) 2024-06-06 13:10:26 +08:00
sneaxiy
5a6d0fa98e fix memory leak bug (#8546) 2024-06-06 11:21:47 +08:00
gmm
b0a8cdddc8 【benchmark】 add llama-7b_auto_dp2mp2pp2 benchmark script for cinn (#8423)
* add llama-7b_auto_dp2mp2pp2 benchmark sh

* add llama-7b_auto_dp2mp2pp2 benchmark script for cinn

* update llama-7b_auto_dp2mp2pp2 benchmark script

* Update run_benchmark.sh

* Update run_benchmark.sh

* fix llama-7b_auto_dp2mp2pp2/benchmark_common

* Update run_benchmark.sh
2024-06-06 11:12:38 +08:00
ronnywang
87edf28f9a support fused weights for export_model (#8554) 2024-06-06 09:58:50 +08:00
greycooker
d98d722de3 del codev (#8555) 2024-06-06 09:08:55 +08:00
zhangyuqin1998
4cb8b6d053 Add RingFlashAttention for context parallel (#8383)
* Add RingFlashAttention for context parallel

* update, using sep_group

* using sep group

* fix

* fix

* update

* fix
2024-06-05 22:01:40 +08:00
ShenLiang
91936bdaae [Cherry-pick] Add release grad & sharding format & decorate_exclude_layers (#8545)
* fix bug of sharding format (#8483)

* Add release grad for SD (#8478)

* add decorate_exclude_layers

---------

Co-authored-by: westfish <westfish@126.com>
2024-06-05 21:56:57 +08:00
Xuanang Chen
1cf780e4d7 add mteb evaluation (#8538)
* add mteb evaluation

* add mteb evaluation

* add mteb evaluation

* add mteb evaluation
2024-06-05 20:41:22 +08:00
Zhong Hui
3c21f0ae56 Update run_ci.sh (#8552) 2024-06-05 20:22:45 +08:00
Zhong Hui
f36ed75f4f update source. (#8540) 2024-06-04 20:48:24 +08:00
asr-sheep1
4c9a3f5ded fused_ln:Added implementation for the HIP platform (#8472) 2024-06-04 16:55:51 +08:00
tianhaodongbd
cb8a229794 [BugFix][NPU] fix llama attn_mask astype error (#8528) 2024-06-04 16:31:45 +08:00
Zhong Hui
f8cdd3dcb0 fix eval. (#8529)
* fix eval.

* fix
2024-06-04 11:30:39 +08:00
yinwei
0087c4a801 update code (#8519) 2024-06-03 13:34:39 +08:00
Zhong Hui
2286799c01 [Safetensors] Fix fast safe open slice. (#8512)
* fix more case.

* fix slice.

* fix error slice.
2024-06-03 11:19:01 +08:00
wawltor
fd2a39ee04 Update README.md (#8524) 2024-06-03 10:21:05 +08:00
Ferrebo
440c093867 [fix] Broadcast optimizer state using broadcast_dp without shard-reshard. (#8522) 2024-06-03 09:55:03 +08:00
yinwei
e71540bfc6 Add Sharding V1 broadcast and allgather overlap optimize (#8499)
* update

* update is_casual_mask to use_casual_mask

* update by environment

* add constraint

* add pretrain and finetune enviroment

* update

* update

* Update finetune_generation.py

update use_casual_mask env

* update

* lint code

---------

Co-authored-by: zhengzhonghui <zhengzhonghui@baidu.com>
Co-authored-by: lizhiyu <1528794076@qq.com>
2024-05-31 16:10:16 +08:00
Ferrebo
ac7145dae4 [fea] moe support (#8498)
Co-authored-by: kebo01 <kebo01@baidu.com>
2024-05-31 14:43:36 +08:00
Galaxy1458
60c661546b Update merge_lora_params.py (#8514)
* Update merge_lora_params.py

* Update merge_lora_params.py

* Update merge_lora_params.py
2024-05-31 11:05:25 +08:00
Zhong Hui
92aa9f1767 Update model_utils.py (#8509) 2024-05-30 11:31:27 +08:00
Tian
d8adc2b9d1 [LLM] disable part of MC2 in lora (#8505) 2024-05-29 13:18:33 +08:00
ming1753
c1cfe631df modify block_multihead_attention api (#8456)
* modify block_multihead_attention api

* add param to blha

* modify fused_transformer_layers

* fix bug
2024-05-28 18:52:56 +08:00
Ghost Screaming
85ba5735c3 [AutoParallel] Support qwen for auto_parallel (#8312)
* run 4096

* support 3d semi auto run of qwen model

* [AutoParallel] Add qwen auto parallel.

* Delete useless files.

* Fix code style problem.

* Fix problems.

* Polish code.

* Add CI-cases.

* Add bf16 ci testcase.

* Fix some problems.

---------

Co-authored-by: pangengzheng <pangengzheng@baidu.com>
Co-authored-by: pangengzheng <pangengzheng.baidu.com>
2024-05-28 10:12:39 +08:00
zhangyuqin1998
d4edd19194 Fix rng_state in llm models (#8396) 2024-05-27 14:30:23 +08:00
Zhong Hui
773497e2e6 quick fix from pretrained. (#8486) 2024-05-27 12:51:20 +08:00
lzydev
d8e1a6b2b6 【AutoParallel】Add split_backward for vpp (#8479)
* add split_backward for vpp

* polish

* add test cast

* polish

* update test case

* change the config

* polish
2024-05-27 10:54:27 +08:00
LixinGuo
a90f16353d fix run_benchmark for llama2_70b in auto_parallel (#8484)
* remove tsinghua pypi

* modify gpt dateset addr for benchmark

* fix run_benchmark for llama2_70b in auto_parallel
2024-05-24 16:51:23 +08:00
Tian
0cd8fe7ee5 Revert "Support Sharding Overlap (#8473)" (#8491)
This reverts commit 7aaa788069.
2024-05-24 15:28:09 +08:00
yinwei
7aaa788069 Support Sharding Overlap (#8473)
* update

* update is_casual_mask to use_casual_mask

* update by environment
2024-05-24 10:17:21 +08:00
yinfan98
c6f4159d9c [Ops] RoPE kernel support theta input (#8440)
* [RoPE] feat: support theta

* Update modeling.py

* [RoPE] feat: support theta for qwen
2024-05-23 11:26:21 +08:00
EnflameGCU
621118e487 fix rotary_emb for llama (#8470) 2024-05-22 20:44:25 +08:00
Lucas
70bffa8df3 [LLM] fix bug when loss is None in llama modeling.py (#8459) 2024-05-22 13:58:25 +08:00
ronnywang
87e4c4fa87 [NPU] support npu llama2-13B export & inference (#8442)
* [NPU] support npu llama2-13B export & inference

* move csrc_npu to csrc/npu
2024-05-20 22:15:10 +08:00
Zhong Hui
9064078e8d Fix CI tests. (#8471) 2024-05-20 19:29:07 +08:00
zhangbo9674
b36b6a01a6 Add llama2-70b for test_tipc (#8455) 2024-05-17 20:56:30 +08:00
Liujie0926
5d4ce560ef [benchmark]Add llama2 auto (#8424)
* fix ci requirements

* add llama2_auto benchmark

* fix

* update config

* Add ips log for per card
2024-05-17 16:12:49 +08:00
w5688414
9381e9fe78 [bugfix] fix erniedoc (#8393)
* fix erniedoc

* revert
2024-05-17 16:10:50 +08:00
EnflameGCU
d9dcd9a797 [GCU] Support llama for GCU (#8445) 2024-05-17 15:26:21 +08:00
Galaxy1458
7f13396332 update (#8448)
* update

* add llama-npu-opt-script

* Update dev_opt_lora.sh

* Update dev_opt_ppt.sh

* Update dev_opt_lora.sh

* Update dev_opt_ppt.sh

* Update dev_opt_sft.sh

* Rename dev_opt_lora.sh to llama_npu_opt_lora.sh

* Update dev_opt_ppt.sh

* Rename dev_opt_ppt.sh to llama_npu_opt_ppt.sh

* Update llama_npu_opt_lora.sh

* Update and rename dev_opt_sft.sh to llama_npu_opt_sft.sh

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* update

* Update fusion_ops.py

* update

* update
2024-05-17 12:52:56 +08:00
Zhong Hui
daf2f3ae6b fix load rng compatiblity. (#8450) 2024-05-17 11:15:39 +08:00
zhangbo9674
ebe397ea52 Support fused_attention_qkv for auto_parallel llama (#8432)
* add

* add

* add

* add

* add
2024-05-16 18:37:30 +08:00
Zhong Hui
562229c1da Fix/test gpu (#8452)
* fix safe open.

* fix online ci.
2024-05-16 17:15:33 +08:00
Zhong Hui
21eb6bdcac Fix CI bugs (#8430)
* fix bugs

* swith test to python 3.10

* skip test.

* update python version.

* fix bugs

* fix gradio

* test.

* fix all
2024-05-16 13:13:54 +08:00
NINGBENZHE
5170664dbf fix npu sft ckpt load bug and no FA bug (#8438)
Co-authored-by: NINGBENZHE <zhenwenqi@huawei.com>
2024-05-15 19:58:52 +08:00
Liujie0926
5da340e038 Add scripts for unittest (#8433) 2024-05-15 14:46:21 +08:00
Galaxy1458
11aba32ace Update llama_npu_opt_lora.sh (#8439) 2024-05-15 10:12:49 +08:00
Yuanle Liu
6902c3e179 delete csrc/generation/reset_need_stop_value.cc (#8413) 2024-05-14 21:09:15 +08:00
Galaxy1458
05acad574e [NPU]Custom fusion operator unification (#8431)
* update

* add llama-npu-opt-script

* Update dev_opt_lora.sh

* Update dev_opt_ppt.sh

* Update dev_opt_lora.sh

* Update dev_opt_ppt.sh

* Update dev_opt_sft.sh

* Rename dev_opt_lora.sh to llama_npu_opt_lora.sh

* Update dev_opt_ppt.sh

* Rename dev_opt_ppt.sh to llama_npu_opt_ppt.sh

* Update llama_npu_opt_lora.sh

* Update and rename dev_opt_sft.sh to llama_npu_opt_sft.sh

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* add funsion ops

* update

* Update fusion_ops.py

* update
2024-05-14 13:47:45 +08:00
Tian
53ad2da1a8 [LLM] add assertion for enable_stage1_overlap in lora mode (#8425) 2024-05-13 15:29:43 +08:00
Galaxy1458
17fb497af4 add npu-llama-opt0-script (#8401)
* update

* add llama-npu-opt-script

* Update dev_opt_lora.sh

* Update dev_opt_ppt.sh

* Update dev_opt_lora.sh

* Update dev_opt_ppt.sh

* Update dev_opt_sft.sh

* Rename dev_opt_lora.sh to llama_npu_opt_lora.sh

* Update dev_opt_ppt.sh

* Rename dev_opt_ppt.sh to llama_npu_opt_ppt.sh

* Update llama_npu_opt_lora.sh

* Update and rename dev_opt_sft.sh to llama_npu_opt_sft.sh
2024-05-13 13:59:53 +08:00
Zhong Hui
474aaaaf30 fix llama3 eot. (#8371) 2024-05-13 13:24:15 +08:00
zxcd
d9f555e85f Adapter new type promotion rule for Paddle 2.6 (#8421) 2024-05-13 11:15:44 +08:00
Zhong Hui
fe6277fa93 Fix safe open. (#8422) 2024-05-13 11:00:34 +08:00
Siming Dai
6bd2b0d9da fix distdataloader, fix eval with dp group (#8420) 2024-05-13 10:46:56 +08:00
Tian
f27fdb41a3 [LLM] relocate tensor_parallel_output to avoid conflict (#8419) 2024-05-11 17:22:39 +08:00
gongel
29d40e2da1 last ckpt should be model done when afs (#8402) 2024-05-11 14:30:44 +08:00
zxcd
99fbc418f2 Fix type promotion problem. (#8414)
* fix type promotion problem.
2024-05-11 11:42:30 +08:00
Tian
c6e5459703 [Distributed] metric calculation supports tp logits (#8370) 2024-05-10 21:47:40 +08:00
zhangbo9674
ac117a108d Refine position_ids for auto parallel training of llama (#8363)
* fix

* fix

* fix
2024-05-10 19:36:21 +08:00
wanghuancoder
16ef8f414c pre copy pinned data to gpu (#8386) 2024-05-10 16:09:53 +08:00
Zhong Hui
9146c1e492 fix compatible with npu. (#8409) 2024-05-09 21:16:23 +08:00
DrownFish19
2619f17029 [LLM] Fix fuse or split with same key (#8378)
* fix fuse or split with same key

* fix

* fix eps

* update format
2024-05-09 17:51:32 +08:00
Siming Dai
a13975886e [DistDataloader] Update implementation, add nested.py (#8380)
* Fix sharding overlap bug

* [DistDataloader] Update implementation, add nested.py

* Fix pipeline

* add first try

* update dataloader

---------

Co-authored-by: lugimzzz <zhenglujing@baidu.com>
2024-05-09 17:51:06 +08:00
Leo Chen
46f49dfa03 fit for llama3 for auto_parallel (#8395)
* fit for llama3

* add run scripts
2024-05-09 16:52:15 +08:00
w5688414
c02712e197 [bugfix] fix uie (#8379)
* fix uie

* fix windows bug
2024-05-09 14:24:42 +08:00
w5688414
eeafb21acf Fix fast tokenizer import error (#8367) 2024-05-09 14:21:11 +08:00
Galaxy1458
6b3875c0dd update (#8399) 2024-05-09 13:09:31 +08:00
Zhong Hui
d6ac1bd5da [Performance] Optimize unified checkpoint save/load speed. (#8204)
* opt unified checkpoint save/load speed.

* fix bug.

* add fast safe open API.

* mix file open and mmap.

* fix

* add test for read fast read tensors.

* fix

* fix tests.

* remove profile log.

* fix

* fix ci
2024-05-08 20:50:18 +08:00
Zhong Hui
2f3faff947 fix init (#8377)
Co-authored-by: lugimzzz <zhenglujing@baidu.com>
2024-05-08 20:14:35 +08:00
Zhong Hui
0f458750b9 Revert "update" (#8389)
* Revert "update (#8359)"

This reverts commit ae0bea9e85.

* Update modeling.py

* fix

---------

Co-authored-by: lugimzzz <zhenglujing@baidu.com>
2024-05-08 19:00:00 +08:00
Liujie0926
829e7f03a5 fix llama2 benchmark (#8376) 2024-05-08 15:11:35 +08:00
Kunbo Ding
a85a9a9a1c [BugFix] Update truncate in distributed training (#8362)
* Remove truncate

* update truncate

* update truncate
2024-05-08 15:08:01 +08:00
wanghuancoder
18e5cee909 refine benchmard bert ips stat (#8361)
* refine benchmard bert ips stat

* refine

* refine
2024-05-08 14:00:24 +08:00
w5688414
ae0450a63e [paddle-pipelines] Update offline ann (#8353)
* Update offline ann

* update offline_ann.py
2024-05-08 10:48:44 +08:00
Tian
9f3cf822c6 [LLM] fix lora target modules on llama (#8372) 2024-05-07 18:54:01 +08:00
Galaxy1458
ae0bea9e85 update (#8359)
* change llama/modeling.py to opt npu performence

* update

* update

* Update modeling.py

* add judge

* update

* update

---------

Co-authored-by: Wang Huan <wanghuan29@baidu.com>
2024-05-07 16:29:31 +08:00
Yiqun Liu
09a0ce7278 Disable eval and predict for llama-2 benchmark. (#8366) 2024-05-07 14:35:50 +08:00
Sijun He
fdcabf8e5f Update README.md 2024-05-06 12:09:11 +08:00
w5688414
3aa92ce269 Update llm docs requirements (#8336)
* Update llm docs

* Update requirements.txt

* try to fix
2024-04-30 15:01:15 +08:00
Galaxy1458
1c781d8e57 change llama/modeling.py to opt npu performence (#8342)
* change llama/modeling.py to opt npu performence

* update

* update

* Update modeling.py

* add judge

---------

Co-authored-by: Wang Huan <wanghuan29@baidu.com>
2024-04-30 14:33:37 +08:00
Leo Chen
e7de0fa5ca add eliminate_transpose arg (#8339) 2024-04-30 14:03:24 +08:00
Jianbang Yang
ba9d9bd53c [XPU] llama add xpu support (#8282)
* [XPU] llama add xpu support

* fix

* use try import

* fix

* refine

* refine

* refine

* refine
2024-04-29 16:20:11 +08:00
zhangbo9674
62b58a3f0c [Pre-Train] Add num_hidden_layer for pretraining (#8288) 2024-04-29 14:54:12 +08:00
zhangbo9674
db52319a0c fix bug (#8329) 2024-04-28 20:57:17 +08:00
Southpika
71cc40463b [Tokenizer]Add Chat template (#8226)
* add jinja template

* add in cfg

* add system

* add notes

* fix apply chat template

* add generation flag

* update jinja ut

* fix error

* add syntax error check

* fix syntax error

* refresh codev

* refresh codecov

* update special token map in render

* update save

* add multi round chat ut

* use new api

* rm pdb

* add split ut

* fix des

* fix ut
2024-04-28 19:46:22 +08:00
Siming Dai
7c3ab53193 Fix sharding overlap bug (#8333) 2024-04-28 16:37:56 +08:00
Zhong Hui
ea2926c105 [BugFix] Fix gpu ci (#8337)
* fix test_synced_gpus

* fix all ci
2024-04-28 10:12:07 +08:00
Xuanang Chen
cb9ba2d185 textfeature_queryinput (#8331) 2024-04-26 18:55:48 +08:00
w5688414
a37f53d6e0 cherry pick paddlenlp 2.8 (#8323)
* cherry pick paddlenlp 2.8

* Update README
2024-04-26 16:00:41 +08:00
Ruibiao Chen
ae06f0cb66 [DEV] Support sync params in tensor parallel config (#8311)
* [DEV] Support sync params in tensor parallel config

* Update code
2024-04-26 15:10:01 +08:00
w5688414
6ed54d8cdc fix try import (#8332) 2024-04-26 14:01:54 +08:00
Tian
de149078f8 [Distributed] fix lora (#8325) 2024-04-25 21:23:39 +08:00
DrownFish19
f29a7b905f [LLM] Support fuse attention q, k, v weights (#8202)
1. add use-interface & fuse action

1.1. modify 1., code order

2. switch to name_mapping

3. solve tp branch

3.2 follow hui, handel qkv separately

3.3 handle pdparams

3.4 from torch

3.5 abandon low_cpu_mem_usage

3.6 solve shard branch

* 3.6.1 solve shard branch after rebase develop

* code clean

* remove debug comment

* Redefine fuse and split functions

* Redefine fuse and split functions

* comment and fix

* update method

* update QKV fuse and split

* support fuse weights in multi-files

* add precision compare

* simplify function call

* support use_fast_ffn

* clean modeling and configuration

* add test for gpt and opt

* fix tp_actions get

* add fast_ffn test

* add Qwen2Moe

* Revert "add Qwen2Moe"

This reverts commit 113b8838a7.

* add test for split

* update doc

* update filter_dict_keys

---------

Co-authored-by: Zii <ziangqin.baidu@gmail.com>
2024-04-25 16:11:39 +08:00
zhangbo9674
1a73b76afa fix (#8321) 2024-04-24 20:59:01 +08:00
lzydev
af3041c2ff 【AutoParallel】Add llama2 UT for auto-parallel (#8300)
* add llama UT

* add llama UT

* update data

* instatll external ops

* update data

* update data
2024-04-24 19:24:51 +08:00
wanghuancoder
273c593fd5 benchmark llama worker=1 (#8305) 2024-04-24 17:28:49 +08:00
Liujie0926
277f45bfbe [dist CI]fix (#8283) 2024-04-24 15:42:01 +08:00
Liujie0926
d22bded11d [benchmark]update llama2_ips (#8322) 2024-04-24 15:41:42 +08:00
w5688414
1ffa290841 [paddle-pipelines] Update mkdocs (#8310)
* Update mkdocs

* Update mkdocs configuration

* migrate paths

* change root path

* try to fix

* revert

* Update memory.md

* restore agent.md path

* fix path error

* Add index.md

* Update README.md

* Update README.md
2024-04-24 11:27:59 +08:00
Yuang Liu
eaca5b29b0 bug fixer (#8314) 2024-04-24 10:35:17 +08:00
Tian
bc91dc620f [Distributed] [CustomDevices] Adapt SP on lora && polish MC2 APIs (#8303)
* [Distributed] adapt sequence parallel on LoRA (#8235)

* [Distributed] [CustomDevices] adapt lora sp && polish MC2 APIs
2024-04-23 23:18:11 +08:00
Zhong Hui
98588af263 Support llama-3 (#8307)
* support llama-3

* Add llama-3 tokenizer

* fix for llama3
2024-04-23 19:18:52 +08:00
w5688414
e67fd7881d [paddle-pipelines] Add pipelines documentation (#8308)
* Add pipelines documentation

* Update pipeline docs

* remove rss module

* Update docs

* Update site url
2024-04-23 11:06:29 +08:00
w5688414
40398976f6 [paddle-pipelines] faq semantic search question answering reamde (#8292)
* Update dense qa readme

* Update readme

* Update semantic search readme
2024-04-21 16:01:31 +08:00
Leo Chen
3bb4bb751e add a100 test ground truth (#8249)
* add a100 test ground truth

* add requirements

* cache is_a100 result

* update

* update

* update sp allclose

* fix check_result

* add ground truth for llm_gpt_dygraph
2024-04-18 19:38:20 +08:00
Yiqun Liu
909ff315d5 Add p2p_comm_overlap for Llama-2-70b benchmark. (#8276) 2024-04-18 16:21:21 +08:00
Tian
beb433a9ae [LLM] add memory stats to logger of trainer (#8269) 2024-04-17 10:22:44 +08:00
Southpika
c3ec984db7 [Bug Fix]Fix merge parameters in pp (#8239)
* update merge pp

* update des

* renew
2024-04-16 20:16:12 +08:00
Liujie0926
07908243ee update paddlenlp (#8267) 2024-04-16 16:48:53 +08:00
wanghuancoder
ee88c12457 use tensor.shape bug not paddle.shape(tensor) (#8260)
* use tensor.shape bug not paddle.shape(tensor)

* refine

* refine
2024-04-16 14:22:10 +08:00
sneaxiy
f658fa7a89 fix sharding <100 limitation (#8146) 2024-04-16 14:21:49 +08:00
zhangbo9674
1ef7503861 fix (#8265) 2024-04-15 15:43:23 +08:00
Sijun He
f4a8f4cb7e Update tests.yml (#8268) 2024-04-14 15:49:03 +08:00
Siming Dai
3566381385 [BugFix] Try except sequence parallel utils (#8189)
* try except sp

* fix sp import
2024-04-12 22:19:48 +08:00
Southpika
3515e32923 [LLM]Support Gemma model (#8082)
* add model

* add cfg&tokenizer

* update weight share

* rm useless notes

* rm pdb

* add cfg

* fix version

* fix

* fix des

* fix des

* update url

* fix some logic

* add it model

* update_cfg

* add modeling ut

* add link

* fix typing

* fix typing

* add init

* add tokenizer ut

* fix small bug

* add alibi

* add addedtoken str

* add special attr

* add tp ut

* merge

* apply api change

* rm hard code cfg

* fix ut

* fix ut

* add zero padding

* upload bf16 safetensors model

* fix

* add gemma in sft data convert

* add gemma in sft data convert

* add gemma tokenizer

* fix des

* rm fast tokenizer

* update sft cfg

* cherry-pick pp from develop

* add cfg
2024-04-12 16:04:20 +08:00
lugimzzz
0d055448c3 add scaling (#8256)
* add scaling

* add scaling

* add scaling

* format
2024-04-12 11:18:13 +08:00
Liujie0926
662feb1692 [dist]pip requirements-dev.txt (#8258)
* pip requirements-dev.txt

* fix
2024-04-11 21:07:18 +08:00
Kunbo Ding
62d5609c3d Fix timer for NPU&XPU (#8261)
* Fix timer for NPU&XPU

* Fix NPU/XPU timer
2024-04-11 19:05:31 +08:00
w5688414
84615ea086 Fix gpt download bug (#8253) 2024-04-11 14:06:34 +08:00
w5688414
814e9c4724 Add DeBERTa model (#8227)
* Add DeBERTa model

* trigger unitest

* Add hf mirror

* fix unitest

* Update deberta v2 model

* Update debertav2

* Update deberta config

* Update deberta docs

* Update docs

* support stabledropout

* refine tokenizer and comments

* fix tokenizer

* try to fix connection error

* Update deberta unitest

* Add deberta doc

* removev useless comments

* Add deberta contents.rst
2024-04-11 11:47:32 +08:00
yujun
9b89f45d6c [BUG] fix to_static (#8194)
* fix

* 限制huggingface hub版本
2024-04-11 11:17:32 +08:00
Lu Qi
2900f78002 [LLM] Optimize llm/GPT3 performance (#8172) 2024-04-11 11:15:18 +08:00
Ting
a6d3a2857b Pissa (#8250)
* single gpu pissa impl

* fix

* scale update

* raise error in mp

* update pissa config

* add pissa config
2024-04-11 11:00:45 +08:00
Tian
bd25e0cd62 [LLM] add decay steps option for finetuning (#8251) 2024-04-10 21:32:00 +08:00
liym27
98a4b84bdc [AutoParallel] support GPT for auto_parallel (#8160)
* add modeling_auto.py

* add run sh

add run_pretrain

modify llama test loss

* comment llama

comment llama

* update

* fix
2024-04-10 19:47:48 +08:00
tianhaodongbd
79cb8b6acd fix llama fa bug (#8237) 2024-04-09 18:40:32 +08:00
Yuang Liu
c1aad028c2 bug fix (#8238) 2024-04-09 17:34:48 +08:00
Zeyu Chen
70f4a6fcf8 Rename ernie-tiny to ernie-3.0-tiny 2024-04-09 15:35:47 +08:00
zhangbo9674
220d867d16 fix (#8234) 2024-04-09 15:29:35 +08:00
gongel
a5f69e4543 add checkpoint_done to last model (#8223) 2024-04-08 14:56:20 +08:00
NINGBENZHE
ae7dc15a62 add mc2 & finetune fused (#8139) 2024-04-03 20:20:24 +08:00
Tian
2273ee7812 [Distributed] Support pp non batch comm (#8097) (#8222)
* add disable_non_batch_p2p_comm to pipeline_parallel_config
2024-04-02 11:45:23 +08:00
zhangbo9674
7b493a8e8b Support sharding for auto_trainer (#8164)
* add

* fix

* refine code

* refine

* fix

* fix

* fix

* refine
2024-04-01 10:23:14 +08:00
w5688414
4d661bc34b remove ._static_mode for static model (#8214) 2024-03-29 18:05:46 +08:00
wuhuachaocoding
50b449104f update for npu. (#8210) 2024-03-29 16:26:58 +08:00
w5688414
57b22e7052 [Paddle-Pipelines] Add matryoshka representation learning (#8165)
* Add matryoshka training

* Update README.md

* Update modeling.py

* reformat trainer
2024-03-28 14:59:14 +08:00
lzydev
6b8f7f918a change the dtype of initializing the model (#8199) 2024-03-27 20:43:57 +08:00
yujun
acfa7f29b5 关闭从hf下载和aistudio下载的单测. (#8198) 2024-03-27 18:00:06 +08:00
lzydev
4d49a3e8a2 【AutoParallel】Change llama in auto-parallel (#8151)
* change llama in auto

* change ci

* polish
2024-03-26 20:42:57 +08:00
Zhong Hui
89bff208da save rng state not seed. (#8185) 2024-03-26 16:48:44 +08:00
WAI-clear
6b5099ada2 add long sequence strategies (#8076)
* test

* remove test.txt

* add long sequence strategies

* long sequence V1

* draft

* draft

* draft new

* add long sequence stratiges

* add long sequence strategies new

* fix format

* fix conflict

* fix format

* fix error

* fix error

* fix format

* fix format

* fix format

* fix format

* close @slow

* fix test

* fix error

* modify try_catch

* fix format

* fix format

* fix format

* add bloom_alibi

* fix error

* add dynamic_to_static

* add dynamic_to_static
2024-03-26 09:42:01 +08:00
wuhuachaocoding
a0457d14d5 adapt npu FA. (#8171) 2024-03-25 16:50:47 +08:00
Lu Qi
a5d87f5d1a [BugFix] Fix FusedLinearWithGradAdd usage (#8178) 2024-03-25 15:44:47 +08:00
Guoxia Wang
a33a4f341a fix read-data timer when ignore_data_skip=False and skip_profile_timer=False (#8177) 2024-03-25 14:56:22 +08:00
yujun
d577e19b5e [LoRA] add quick_lora (#8106)
* quick_lora

* add use_quick_lora

* update

* update

* update

* update

* When lora and use_quick_lora are enabled, recompute_use_reentrant must be set to True to prevent any potential errors from occurring.

* update code

* update
2024-03-25 13:56:58 +08:00
Haohongxiang
feb69cf7c2 add arg (#8168) 2024-03-22 17:02:31 +08:00
w5688414
f005084a87 [Paddle-pipelines] Add pytorch retrieval model tutorials (#8159)
* Add pytorch retrieval model tutorials

* Update doc

* fix unitests

* Update docs

* Update torch2paddle tutorial
2024-03-21 16:00:51 +08:00
gongel
4d35236aba Json parsers supports raise error (#8163) 2024-03-21 14:28:21 +08:00
yinwei
a092775a52 Replace Sequence Parallel to Paddle Sequence Parallel (#7966)
* sp support overlap
* add mixtral sp
2024-03-21 14:05:59 +08:00
wuhuachaocoding
8f2b19d9fd support mc2 for mp lora. (#8161) 2024-03-21 12:13:56 +08:00
Zhong Hui
ac57ad7c77 Squashed commit of the following: (#8157)
Merge remote-tracking branch 'origin/develop' into bugfix/sample_generate
    Update Makefile
    Update Makefile
    remove paddle as require.
    fix  https://github.com/PaddlePaddle/Paddle/issues/62860
    fix test_sample_generate bug.
2024-03-20 20:36:00 +08:00
Siming Dai
b6dcb4e19e [Unified Checkpoint] Fix tie_weights save and load (#8137)
* fix unified checkpoint tie_weight

* unify static2struct_name_mappings

* fix chatglm model

* fix trainer

* fix attr

* simplify code

* add single card config save
2024-03-19 21:54:33 +08:00
Liujie0926
99802de4ee add auto_pir case (#8144) 2024-03-19 17:39:37 +08:00
zxcd
d46a96e320 Adapter new type promotion rule for Paddle 2.6 (#8079) 2024-03-19 15:07:59 +08:00
Ting Liu
7370d72e5b add rslora & lora+ (#8111)
* add rslora & lora+

* remove print

* reformat

* update

* fix bug

* add rslora+ ci

* remove magic number

* update

* empty

---------

Co-authored-by: lugimzzz <zhenglujing@baidu.com>
2024-03-19 13:02:02 +08:00
lugimzzz
1cd270a155 text classification (#8110) 2024-03-18 14:26:33 +08:00
ShenLiang
57791863fc fix config bug (#8128) 2024-03-18 10:17:18 +08:00
Liujie0926
1b373a8ec7 [benchmark]add skip_memory_metrics for ce_gpt (#8132)
* add skip_memory_metrics

* add skip_memory_metrics for autotuner
2024-03-18 10:07:18 +08:00
zhengzhonghui
d83bd5ef3c [AutoParallel] unify llama model (#8127)
* [AutoParallel] unify llama model

* attention_mask can be None
2024-03-15 16:33:11 +08:00
lzydev
c406d90545 【AutoParallel】Add strategy with more options (#8114)
* add strategy

* polish
2024-03-14 16:53:21 +08:00
Ting Liu
880d2ea68d qwen init bug fix (#8120) 2024-03-14 14:47:22 +08:00
Zhong Hui
5fdc3c2126 Update trainer.py (#8117) 2024-03-14 13:56:44 +08:00
Siming Dai
0a39fbffd1 [Trainer] Change num_train_epochs default value (#8113)
* change num_train_epochs default value

* update docs
2024-03-13 20:38:31 +08:00
Liujie0926
e145bfc97a [dist benchmark]add llama2 with autotuner (#8108)
* benchmark scripts

* update case device

* test

* Revert "test"

This reverts commit 75bf72c7ee.

* update

* Update CE_meta-llama-Llama-2-7b_pretrain_bs32_bf16_autotuner.sh

* fix

* update

* add top1 case

* fix

* add 13b/70b autotuner

* update autoconfig

* remove enable_stage1_tensor_fusion

* update ips

* add top1 config
2024-03-13 14:10:33 +08:00
Liujie0926
8f9734df29 update llm_gpt_recompute_bs32_bf16_MP2-SD4-stage1 loss_base for Paddle#62500 (#8107) 2024-03-13 14:09:56 +08:00
骑马小猫
acacb470c2 [Bug fixes] convert min_new_token -> min_new_tokens (#7883)
* convert min_new_token -> min_new_tokens

* fix f-string linting

* update warning log testing
2024-03-12 20:02:28 +08:00
LOVE-YOURSELF-1
646a42919d Download----fix new bug (#8088)
* fix new bug

* resolve bug

* modified locks_path

* fix None bug

* Update bos_download.py

* Update tokenizer.py

* skip

---------

Co-authored-by: yujun <50394665+JunnYu@users.noreply.github.com>
Co-authored-by: yujun <573009727@qq.com>
2024-03-12 19:02:51 +08:00
PeiyuLau
196db7ee2f dist dataloader: add cuda compilation check (#8099) 2024-03-12 17:46:09 +08:00
ShenLiang
60b9755f70 [BugFix]Rm overlap limit in dp & pp (#8089)
* rm overlap in dp & pp

* fix bug in comm overlap
2024-03-11 18:51:59 +08:00
greycooker
6fd186da24 [BugFix] fix test tensorboard callback (#8066) 2024-03-11 16:17:00 +08:00
gongel
557c794655 add log (#8058)
Co-authored-by: gongel <gongel@qq.com>
2024-03-11 11:51:36 +08:00
ShenLiang
d48dc75f7c paddlenlp/trainer/training_args.py (#8051) 2024-03-11 10:43:39 +08:00
Sonder
67964cf583 [Distributed] Add dp_gradient_sync_after_accumulate (#8045)
* add dp_gradient_sync_after_accumulate

* recover run_pretrain_auto_static.sh

* recover

* use gradient_sync_after_accumulate

* change name under DP_OPTIMIZATION

* add doc for data_parallel_config

* update notes

* add note and recover codes

* add note
2024-03-08 17:36:35 +08:00
LOVE-YOURSELF-1
95c8b24f7c Download重构 (#8020)
* download

* modified file

* modified from_pretrained

* modified config

* modified download

* test_tokenizer

* Delete tests/transformers/from_pretrained/run.sh

* Update test_tokenizer.py

* Update tokenizer_utils_base.py

* test_model

* test_model

* test_model

* Remove comments

* Remove comments

* add requirements

* update bos download

* Update test_model.py

* clear unused import

* modified bug tokenizer_utils_base.py

* change safetensors

* modified load generation config

* add requestion

* 更新

* modified error

* fix bug

* add \n

* Update __init__.py

* add requestion

* modified download

* 重测

* Update test_tokenizer.py

* Update requirements-dev.txt

* Update requirements.txt

* delete from_pretrained

* make superior

* Update run_pretrain_trainer.py

---------

Co-authored-by: yujun <573009727@qq.com>
2024-03-08 16:41:40 +08:00
Ruibiao Chen
b504a7370c Support hybrid_parallel_topo_order for auto parallel Llama (#8011)
* Support hybrid_parallel_topo_order for auto parallel Llama

* Set order in hybrid_configs

* Update get_mesh_with_dim

* Update loss for CI baseline

* Fix CI errors

* Update loss

* Update loss

* Update loss

* Update loss

* Update loss
2024-03-08 11:48:18 +08:00
cyber-pioneer
93aa4bc9ca fit cinn and pir flag in predictor (#8071) 2024-03-07 17:07:11 +08:00
Siming Dai
e34cbe98e3 [Unified Checkpoint] Fix lora unittest (#8070) 2024-03-07 16:14:29 +08:00
liuzhenhai93
dd8a46c81d unify_criterion_inputs_dynamic_and_static (#8053)
* unify_criterion_inputs_dynamic_and_static

* polish

---------

Co-authored-by: liuzhenhai93 <liuzhenhai@baidu.com>
2024-03-07 10:54:28 +08:00
Liujie0926
972542b19b fix ci scripts (#8063) 2024-03-07 10:06:00 +08:00
zhang junjun
fb0ddb5252 Revert "Fit pir flag in predictor (#8048)" (#8065)
This reverts commit 5df6e7d1d4.
2024-03-06 20:58:19 +08:00
lugimzzz
67f31c6e55 update pp (#8059)
* update pp

* Update paddlenlp/transformers/model_utils.py

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>

---------

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2024-03-06 19:26:06 +08:00
cyber-pioneer
5df6e7d1d4 Fit pir flag in predictor (#8048)
* locate llama2 while

* fit pir flag

* fix code

* add cinn flag
2024-03-06 16:01:03 +08:00
greycooker
32d8b3f4a0 [BugFix] Fix Test wandb callback bug (#8056) 2024-03-06 13:17:11 +08:00
Yiqun Liu
092c84502c Optimize the log and enable to print the number of tokens each second. (#7853)
* Optimize the log and enable to print the number of tokens each second.

* Update the prompt message of logging.

* Add is_pretraining to switch whether calcaulating and printing in tokens.

* Add the interval_samples_per_second back.
2024-03-06 10:39:06 +08:00
Ruibiao Chen
e3cb5d239b Fit sharding optimization for auto parallel llama (#8021)
* Fit sharding optimization for auto parallel llama

* Add args enable_allreduce_avg_in_gradinent_scale

* Fix CI errors
2024-03-05 14:17:42 +08:00
wawltor
4b1c54b559 fix the index_dataset with old data format (#8049) 2024-03-04 19:38:59 +08:00
lzydev
17cc16964e 【AutoParallelism】fix dataloader bug and add ci for static (#8014)
* fix dataloader bug and add ci for static

* change dy2st ci

* disable fused_rms_norm

* disable pir-executor

* add loss on V100

* polish

* polish

* delete dy2st ci

* delete dy2st ci
2024-03-04 14:19:45 +08:00
co63oc
77a23d1275 Fix _cache_founf_inf (#7997)
* Fix

* Fix

* Fix
2024-03-04 10:36:02 +08:00
Ruibiao Chen
a5749005bc Add SwiGLU for auto Llama (#8038) 2024-03-02 18:36:59 +08:00
zhang junjun
b7bfb262a4 [CI] fix test ptuning (#8040) 2024-03-01 15:32:02 +08:00
Siming Dai
462ebaa9b3 [Mixtral] Add mixtral moe (#7803)
* Add mixtral moe

* fix mixtral moe

* add mixtral lora config

* fix load balancing loss

* add sft scripts

* add unittest
2024-03-01 14:13:00 +08:00
wawltor
0d564905dd support the loss mask for the pretrain (#8034) 2024-03-01 13:05:14 +08:00
lzydev
dff7dcc4ff init model using float32 (#8033) 2024-03-01 10:42:33 +08:00
DrownFish19
b72f35256c [DATA] Remove repeated chars during preprocessing (#7739)
* add remove_repeated_chars

* update max_repeated_len
2024-02-29 12:42:12 +08:00
Siming Dai
6f45e95cc4 [Unified Checkpoint] Support peft model (#7691)
* fix qwen merge tp concat

* support peft unified checkpoint

* add prefix numpy save

* add single node peft

* fix peft distributed load

* add single node optimizer load

* support peft tensor parallel for unified checkpoint

* add prefix from_pretrained from safetensors

* add lora and prefix safetensor name

* fix typo

* fix params that is not enough to save per worker

* fix lora pp tp split

* add peft uc tests

* fix master_weight is None

* add ptuning uc tests

* fix tensor copy blocking

* unify lora and ptuning

* fix load_best_model

* fix index json name

* remove ptuning unittest
2024-02-29 11:02:24 +08:00
Difer
37e85e695d add autotuner buffer check ce case (#7993)
* add autotuner buffer check ce case

* fix some errors

* fix some errors

* fix some typo error
2024-02-28 14:34:58 +08:00
SebastjanPrachovskij
5bab940a22 Add SearchApi integration (#7936) 2024-02-28 11:21:08 +08:00
Siming Dai
db490623ae [DOC] Add unified_checkpoint doc (#7961) 2024-02-26 14:43:24 +08:00
Liujie0926
28b9eb84c1 [AutoConfig]add N2C16 (#7915)
* add N2C16

* fix

* update N2C16_gbs to 16

* fix env

* fix

* fix

* update

* fix env set

* fix

* fix bug

* update
2024-02-26 14:11:39 +08:00
Difer
e8d6233c5c [AutoConfig]add N1C8_resume (#7950)
* add N1C8_resume

* fix some errors
2024-02-26 10:17:17 +08:00
Zhang Ting
6a6a9fe8d6 support GQA (#7906)
* fa and fuse rope support gqa/mqa

* add tests for llama with GQA

* rename test

* add test

* remove test

* remove comments

* fix dtype
2024-02-23 10:29:23 +08:00
yujun
9931d65cd1 fix (#7992) 2024-02-22 15:54:54 +08:00
yujun
2edcd08622 [Trainer] ignore_save_lr_and_optim (#7978)
* ignore_save_lr_and_optim

* 只对finetune的测试开启ignore_save_lr_and_optim
2024-02-22 11:36:59 +08:00
lzydev
b2be2fc191 【AutoParallel】Add semi autoparallel amp (#7985)
* add semi-autoparallel amp

* support amp in semi-auto

* change loss base

* polish
2024-02-21 16:05:04 +08:00
Haohongxiang
5c9c8d3cb4 [model_zoo/gpt-3] Fix bugs from PR-61236 which cleared paddle.jit.dy2static.utils_helper (#7989)
* fix bugs

* add try import to support develop and release
2024-02-20 20:30:11 +08:00
sneaxiy
4eb6f0a4dc add swiglu operator (#7967) 2024-02-20 17:50:25 +08:00
Siming Dai
7e643ada4c fix multi-node same output json written (#7977) 2024-02-19 11:41:14 +08:00
NINGBENZHE
394a3e2898 add npu fused and fix AICPU (#7976) 2024-02-07 11:10:09 +08:00
w5688414
7b9cb9bc9e Update text matching (#7973) 2024-02-06 14:37:40 +08:00
Siming Dai
b312959a77 [Unified checkpoint] Turn off unified checkpoint when using sharding stage3 (#7969)
* turn of uc when sharding stage3

* fix
2024-02-06 11:26:45 +08:00
Zhong Hui
a33ab3781f skip some trainer test. (#7949) 2024-02-05 18:05:11 +08:00
Leo Chen
8d6e81339a rename files and add readme for llama auto_parallel (#7944)
* rename files and add readme for llama auto_parallel

* rename files and add readme for llama auto_parallel

* fix ci
2024-02-01 13:10:41 +08:00
Yuang Liu
c0c64fa1e5 gqa fuse attention qkv (#7890)
* gqa fuse attention qkv

* add annotation for the fusion
2024-02-01 11:50:02 +08:00
Haohongxiang
3a704ea0bc [Auto Parallel] Support semi-auto trainer and fit Llama2 training (#7885)
* support semi-auto trainer and fit Llama2 training

* support shard_dataloader in dynamic semi-auto

* rewrite traning loop

* refactor traning loop

* refine args of auto trainer

* broadcast loss

* add auto ci cases
2024-01-31 18:51:57 +08:00
Kunbo Ding
44bfeb01f8 fix timer device (#7939)
fix timer device
2024-01-31 16:13:34 +08:00
greycooker
0d6fc1ecbf Trainer add wandb and tensorboard (#7863) 2024-01-31 15:01:09 +08:00
Kunbo Ding
6e0ac44080 RuntimeTimer for the toolkit (#7913)
* RuntimeTimer for the toolekit

* RuntimeTimer for the toolekit

* reformat

* fix timer and load checkpoints

* remove reset
2024-01-29 22:16:02 +08:00
Kunbo Ding
9a31322910 [Improvement] fix logger level (#7903)
* fix logger level

* fix training args logger level
2024-01-29 20:44:32 +08:00
Liujie0926
5951179b32 [CE]add gpt sharding_v2 case (#7914)
* add sharding_v2 case

* update run_mode to device_num

* fix

* fix
2024-01-29 16:33:51 +08:00
Zhong Hui
a86de1b546 trainer refactor (#7909) 2024-01-29 14:35:41 +08:00
Ting Liu
2a5e5a624b add qwen benchmark (#7758)
* add qwen benchmark

* update qwen benchmark scripts

* qwen 7b benchmark

* arg change

* fix wrong args

* fix args

* update
2024-01-29 11:05:58 +08:00
Zhong Hui
688adb81e3 [RELEASE] Update README.md (#7834) 2024-01-26 15:57:38 +08:00
Liujie0926
879a853d25 [AutoConfig]add benchmark scripts (#7897)
* add auto_tuner

* fix

* update log_file

* update json

* close eval/predict

* fix run_mode

* update

* fix

* Revert "fix"

This reverts commit e526c8680b.

* Revert "update"

This reverts commit 9cbd773e9b.

* update prepare

* Revert "Revert "update""

This reverts commit 811b6a4ff4.

* Revert "Revert "fix""

This reverts commit 32cc005265.

* update finetune prepare

* update

* add

* update sft/lora steps

* update json

* update

* add benchmark

* update years

* update a100
2024-01-26 15:42:59 +08:00
Tian
95c0dd4593 [LLM] fix llama precision on custom devices (#7895) 2024-01-26 15:34:53 +08:00
Tian
1f82403063 [CustomDevice] fix loading rng state on custom device (#7894) 2024-01-26 15:34:00 +08:00
Ernestina
cdfa8614ac [Hackathon 5th No.73] ToT (#7660)
* Hackathon TASK73 ToT

1. finish meta/llama2 version

* update readme tutorial

* modify according to Lint

* modify according Link

1. resolve one unused variable

* Delete LICENSE

* Update LICENSE

* black format

* isort format

* Update search_crosswords-dfs.ipynb

* update files formats

* Update LICENSE

* Update LICENSE

* Update LICENSE

* Update LICENSE

* delete test data

* delete some unnecessary files

1. delete some unnecessary files according to comments.

* add paddlenlp-llama2

1. add llama2 in paddlenlp

* fix one bug

* fix outputs bug

1. format data structure

* delete meta/llama2

* modify according to comments

1. add acknow into readme
2.change png into url in readme
3. add all the models supported by paddlenlp

* change according to comments

* Delete .gitignore

* Create .gitignore

* Move directory

* Add tree of thoughts scripts

* add first dir

* add note

* Update README.md

add test results of facebook/llama-2-7b-chat and llama-2-13b-chat

* Update requirements.txt

delete unnecessary packages

* Update demo.py

add Ernie

* Update .gitignore

delete pyproject.toml

* Update run.py

add Ernie

* Update __init__.py

add Ernie

* chat templates

* add Ernie

* Update llama.py

兼容Ernie

* Update bfs.py

兼容Ernie

* Update models.py

兼容Ernie

* Update run.py

* format style

* format style

* format style

* format style

* format style

* format style

* format style

* format style

* 删掉重复的“测试结果”

* 删除Ernie的token,设置环境变量解决

* format style

* format style

* 删除注释掉的代码

---------

Co-authored-by: root <root@tutu-win.localdomain>
2024-01-26 15:00:34 +08:00
Zii
3a42280eeb [CE] Add Qwen into CE process (#7887)
* add qwen & baichuan into CE

* add Qwen & Baichuan into CE, cleaned for PR

* add only Qwen into CE, cleaned for PR

* dd only Qwen into CE, open switch_ir_optim, cleaned for PR

* add only Qwen into CE, keep switch_ir_optim open, add ce script
2024-01-26 14:24:21 +08:00
Ruibin Cheung
13fd6555e8 [Bug Fix] fix allreduce tensor dtype (#7876)
* [Bug Fix] fix allreduce tensor dtype

Reason: some CCL not support bool dtype

* update int8 to int32
2024-01-25 10:59:22 +08:00
lzydev
ca7944418e support bf16 loss in static (#7874) 2024-01-24 20:37:31 +08:00
Lu Qi
eafa066020 update (#7882) 2024-01-24 13:00:27 +08:00
lzydev
b456110689 【AutoParallel】Support 'master_grad' in Llama in static auto-parallelism (#7658)
* add master_grad

* add llama_fp16_test

* polish

* merge develop
2024-01-24 11:13:48 +08:00
骑马小猫
b50db1ce70 [Bug Fixes] update chatglm1 tokenizer (#7870)
* update chatglm1 tokenizer

* update additional_special_token

* add is_training tag

* fix linting
2024-01-23 23:23:12 +08:00
Wu Chencan
2a8d1380fa [LLM]support QWenVL second part (#7808)
* add qwenvl second part

* improve code & add comments

* add qwenvl test

* update qwenvl tests

* remove print
2024-01-23 11:04:25 +08:00
RichardWooSJTU
4a9c76655e revert benchmark codes (#7871) 2024-01-22 20:50:55 +08:00
wawltor
2ac42ca498 Update ppo_main.py (#7881) 2024-01-22 20:03:59 +08:00
wawltor
7a5fbe7a5b Update reward_main.py (#7880) 2024-01-22 20:02:52 +08:00
Guo Sheng
d4de12c763 Add PPO training. (#7305)
* Add reward model and training.

* Make reward training runable

* Add eval in reward training.

* For result alignment.

* training setting.

* PPO alignment with Beaver

* Align training with Beaver.

* Clean ppo_trainer.py and debug print.

* Move score models from paddlenlp to example and add AutoModelForScore.

* Remove eval.py, eval_score.py.
Fix AutoModelForScore and update reward training usage.

* Update ppo_trainer.py after merge with develop.

* Make PPOTrainer support reference/reward Trainer optionally.

* Complete README.

* Add unittest test_load_from_custom_arch for AutoConfig

* Add test_synced_gpus.py for generation.

* Add more test cases in test_synced_gpus.py

* Support tensor parallel.

* Add require_gpu to test_synced_gpus.py.
2024-01-22 19:20:28 +08:00
Zhong Hui
e3fc63a250 cherry pick empty cache. (#7868) 2024-01-22 16:25:57 +08:00
yinwei
fcb532a43a [CE] Add CE for Hybrid Parallism (#7817) 2024-01-22 15:04:32 +08:00
骑马小猫
082dc52f20 [Improvement] fix ops improting in utils (#7865)
* fix ops improting in utils

* update the reset_stop_value importing

* update the error msg of import paddlenlp_ops

* rename error -> warning
2024-01-22 13:29:35 +08:00
greycooker
283c535a50 fix_trainer_argparser (#7860) 2024-01-22 12:24:54 +08:00
zhang junjun
c1ccafaca8 [CI] add ci approval pipelines (#7859)
* [CI] add ci approval pipelines

* update

* update

* update
2024-01-19 15:06:14 +08:00
Haohongxiang
16d3c49d2b [Auto Parallel] Support dynamic semi-auto training in Llama2 model (#7851)
* update

* add ci

---------

Co-authored-by: liuzhenhai93 <liuzhenhai93@outlook.com>
2024-01-18 16:31:59 +08:00
骑马小猫
915fa43712 [New Features]add ranks testing for test_predictor (#7800)
* add ranks testing

* update gpus testing
2024-01-18 15:33:11 +08:00
DrownFish19
48c1313da9 [unified checkpoint] fix checkpoint names (#7795)
* fix(unified checkpoint): add config save

* fix(unified checkpoint): name change

change master weigths name to model weigths name when SKIP_SAVE_MODEL_WEIGHT

* fix(unified checkpoint): model weights load

when skipping model weighs save and saving master weights as model weights, unified checkpoint needs choose the model weights to load into master weights.

* test(unified checkpoint): add test cases

To test file list and file name when skip_save_model_weight=1

* test(unified checkpoint): add enable_all_options

* fix(unified checkpoint): fix last ckpt save

* fix(unified checkpoint): unified config format
2024-01-17 17:17:26 +08:00
DrownFish19
5a01362b4a [unified checkpoint] Fix last checkpoint save (#7854)
* fix(unified checkpoint): fix last ckpt save

* fix(unified checkpoint): unified config format
2024-01-17 17:16:05 +08:00
周周周
cf907fc683 Support 5.2 bloom (#7846)
* initial commit

* remove debug code

* remove debug code

* modify predictor.py

* remove print

* remove rope_emb in bloom

* format

* add test
2024-01-17 10:33:10 +08:00
Zii
e4bd6c344e [LLM] fix Qwen-7b-Chat precision issue (#7823)
fix qwen-7b0chat model batch inference precision issue
add Qwen-7B-Chat to PaddleNLP unit test
2024-01-16 17:49:23 +08:00
ZeyuTeng96
c9d22dba87 [text_classification_retrieval_based] fix bug of evaluate.py (#7844) 2024-01-16 12:17:27 +08:00
ZeyuTeng96
04142e3ca8 [faq] fix bug of evaluate.py (#7840) 2024-01-12 23:07:46 +08:00
ZeyuTeng96
2a5dba9591 [semantic_indexing] fix bug of evaluate.py (#7843) 2024-01-12 23:06:47 +08:00
骑马小猫
b44f88857e [Bug fixes] update chatglm tokenizer (#7797)
* update chatglm tokenizer

* update chatglm2 tokenizer

* update chatglm2 tokenizer

* update max & src slider

* add chatglm2 tokenizer
2024-01-12 21:51:39 +08:00
Shenghe Wang
8bc06b0ce8 fix the bug of reading files (#7836) 2024-01-12 16:21:19 +08:00
ZeyuTeng96
a1d1aee6ff [neural search][fix bug of evaluate.py] (#7832)
* [fix][fix bug of evaluate.py]

* Update evaluate.py

* Update evaluate.py
2024-01-11 17:16:25 +08:00
Siming Dai
ee4b9dde93 [Pretrain] Fix eval during pretrain (#7827)
* add unified checkpoint training args doc

* fix eval during pretrain

* fix
2024-01-11 17:11:55 +08:00
liuzhenhai93
f039d097d3 fused rms spmd (#7830) 2024-01-11 16:44:22 +08:00
lugimzzz
4069f22c01 fix lora (#7824) 2024-01-11 11:06:22 +08:00
Ruibin Cheung
abb0d3c91f [Bug Fix] fix paddle multipy_fwd_func warning message (#7818) 2024-01-11 10:51:45 +08:00
RichardWooSJTU
c5d8d5bb2d [LLM] Support block_attention/cachekv quant for llama (#7649)
* support blha and cache kv quant

* lint

* fix unit test

* fix infer when blha is on

* code refine

* add docs and fix ops

* merge blha read res in predictor

* finish docs

* add docs and unittest

* add unittest

* migrate read res
2024-01-10 22:23:38 +08:00
greycooker
5a32534df2 Trainer support simultaneously parse JSON files and cmd arguments. (#7768)
* add parse_json_file_and_cmd_lines

* change unit test file path

* Change the way the JSON file is determined

* Merge parameter parsing judgment branches and add comments.

* remove the special handling of output_dir

* Add remaining_args warning
2024-01-10 15:15:48 +08:00
lugimzzz
5c2bf81130 [llm]support qlora pp (#7801)
* supprt qlora pp

* fix scale dtype
2024-01-10 11:48:17 +08:00
Yuanle Liu
75e898146a delete useless code for write_cache_kv.cu (#7812) 2024-01-10 10:43:37 +08:00
骑马小猫
3056226df1 fix br gradio (#7788) 2024-01-09 20:45:41 +08:00
Zhang Ting
d51edd0c1b pipeline parallel benchmark (#7759)
* pipeline parallel benchmark

* add seed setting

* fixed
2024-01-09 20:16:53 +08:00
Siming Dai
dab175b58b [Pretrain] Fix eval during pretrain (#7806)
* fix eval during pretrain
2024-01-09 15:56:38 +08:00
tianhaodongbd
fc6ab70e8e [CE] Add MP2-SP2-pp4-vpp2-SD2-stage1-mbs2-acc8 ce (#7774) 2024-01-09 15:08:18 +08:00
yinwei
393ac18789 [CE] Add CE for Distributed Hybrid Parallel (#7782) 2024-01-09 14:07:55 +08:00
Wu Chencan
37b4fe0285 [INFER][LLM] Support qwen in fined grained dybatch v1 (#7644)
* init qwen inference model

* fix name

* fix hidden dim

* fix dtype

* fix length

* fix attention_mask

* fix up & gate dtype bug

* fix ffn1 weight

* modify codes

* remote unused variable

* remove unused code

* add qwen weight only

* format with black

* format with isort

* fix dtype

* add qwen inference model in static graph

* add qwen unittest

* format with black

* print log

* remove print

* set safetensors usage False

* remove tests

* Empty-Commit
2024-01-09 11:16:52 +08:00
yujun
97f6158e76 slow (#7798) 2024-01-08 18:38:02 +08:00
DrownFish19
487428b399 Fix shared weights sync for PipelineLayer (#7772)
* fix shared weights sync

* fix typo
2024-01-08 15:59:12 +08:00
qingzhong1
ff1e91088a [Paddle-Pipelines] update faiss (#7793)
* update faiss

* update faiss

* update faiss
2024-01-08 15:48:09 +08:00
lugimzzz
079f0674b6 fix (#7781) 2024-01-08 11:45:02 +08:00
w5688414
17acf221b4 Update convert_files_to_dicts_splitter (#7748) 2024-01-05 17:26:13 +08:00
Siming Dai
4437198aa8 fix dist dataloader eval (#7777) 2024-01-04 22:16:41 +08:00
yujun
f93e7da733 [DONE] aistudio, hf hub, bos update download (#7608)
* try fix

* fix hf download bug ...

* update config download bug

* fix

* add subfolder

* update

* 优先级,先本地,再builtin,再aistudio,再hf hub,再bos

* 更新chattemplate文件检索路径

* update

* fix subfolder && add tests

* fix

* update

* fix tokenizer_config_file_dir_list

* subfolder test

* fix from_pretrained() load hf sharded model

* 更新逻辑

* update use_safetensors

* update

* fix resolve_weight_file_from_hf_hub

* 更新bos旧的下载方式

* update download from hf hubgit add .

* update logging

* update

* 关闭代理

* update

* update

* fix image process

---------

Co-authored-by: CrazyBoyM <ai-lab@foxmail.com>
Co-authored-by: Ke Bai <35400185+CrazyBoyM@users.noreply.github.com>
2024-01-04 20:00:22 +08:00
DrownFish19
7d789a8194 Fix unified_checkpoint bug (#7770)
* fix use_unified_checkpoint defined

* add n1c2 test into ci_case.sh

* move test_unified_checkpoint to tests

* add tests/trainer into testpaths

* remove unifiedcheckpoint case from ci_case.sh
2024-01-04 19:42:05 +08:00
骑马小猫
04dc6251fb [New Features] support dynamic src_length (#7740)
* support dynamic src_length

* revert max_position_embedding

* update doc

* update flask_server

* update max_length control

* update request flask_server

* fix max-position-embeddings

* update error message

* update predictor length init
2024-01-04 17:21:02 +08:00
JZ-LIANG
70c92e5c4e [AutoParallel] Add Sequence Parallel for Static LLaMA (#7746)
* sp for static llama

* sp for static llama1

* code style

* change script
2024-01-04 17:05:37 +08:00
Zhong Hui
5c7efcc3d2 [Release] Update release.yml to release tags (#7765)
* Update release.yml to release tags

* Update release.yml

* Update release.yml
2024-01-04 12:27:39 +08:00
Liujie0926
895a81635b [benchmark]close skip_memory_metrics for ips (#7732)
* update mem from B to MB

* fix ft

* fix pretrain

* Revert "update mem from B to MB"

This reverts commit 044a88c49a.
2024-01-03 19:38:11 +08:00
Zhong Hui
f7207940b3 Change version to 2.7.0 (#7764) 2024-01-03 12:02:53 +08:00
Zhong Hui
34b381ecd0 [DOC] Update trainer.md (#7761)
* Update trainer.md

---------

Co-authored-by: DrownFish19 <DrownFish19@gmail.com>
2024-01-02 21:12:01 +08:00
Zhong Hui
0a23bbbbb1 [CE] Delete gpt for sequence classification (#7757) 2024-01-02 19:55:23 +08:00
zhang junjun
a2e5cf5693 Add codecov check (#7760)
* [CI] set codecov status check

* update

* [CI] adjust codeocov target
2024-01-02 19:41:10 +08:00
zhaoyingli
38f792e0d9 [AutoParallel] Auto Trans PP to VPP (#7747)
* [AutoParallel] Auto Trans PP to VPP

* update pp scheduler config

* add comment
2024-01-02 17:52:33 +08:00
Siming Dai
5f5cb52e1b Add unified checkpoint training args doc (#7756) 2024-01-02 17:24:39 +08:00
lugimzzz
a6968b7692 [llm]support lora merge (#7733)
* support lora merge

* add finetune

* support bf16 and lora merge

* update

* add lora merge

* version adatpt

* update

* fix

---------

Co-authored-by: root <root@bddwd-inf-k8s-a100-a12ni6-0399.bddwd.baidu.com>
2024-01-02 16:15:41 +08:00
骑马小猫
1982091ba8 [Improvement] support system prompt in training dataset (#7667)
* update system prompt

* support system prompt

* add context system prompt docs

* update chat-template readme
2024-01-02 14:54:52 +08:00
Siming Dai
6ddb4b1ae4 [Pretrain] Fix llama max_seq_len settings # (#7745) 2024-01-02 14:51:32 +08:00
WAI-clear
48bee12c49 [BugFix] Fix qwen matrix alignment (#7473) 2024-01-02 11:35:01 +08:00
w5688414
fb8f2bec6a [bloom] Add kv cache support for flash attention & fix bugs (#7735)
* Add kv cache support for flash attention

* Update chatglm flash attention version check

* Add test for flash attention

* Fix unitest bug

* Add flash attention to predictor

* Add flash attention2

* Add flash attention unitests

* fix prefix decoder

* remove unused comments

* Update unitest

* Update unitest
2023-12-29 20:27:47 +08:00
liuzhenhai93
fda20a7e97 sharding reshard 兼容老版本 (#7734)
* polish

* polish

---------

Co-authored-by: liuzhenhai93 <liuzhenhai@baidu.com>
2023-12-29 16:39:12 +08:00
qingzhong1
6e9d46571a update processing (#7743)
* update processing

* modify pdf

* modify pdf

* modify pdf

* modify pdf

* update pdf
2023-12-29 14:51:06 +08:00
Chang Xu
b055be6f62 Support AWQ & GroupWiseQuant for LLMs (#7688)
* Support AWQ & GroupWiseQuant for LLMs

* add docs

* add docs

* upadte
2023-12-29 11:54:00 +08:00
啊biu
a55039cc16 Update Install_windows.md (#7707) 2023-12-28 22:35:13 +08:00
啊biu
d5c807b724 Update semantic_search.yaml (#7708) 2023-12-28 22:34:24 +08:00
sneaxiy
5de7e57211 Add mp delay_scale_loss function (#7713)
* add mp delay_scale_loss function

* remove useless codes
2023-12-28 20:29:47 +08:00
DrownFish19
1e9b5a876a [unified checkpoint] Update unified checkpoint (#7730)
* replace with unwrap_optimizer

* remove dist.barrier(group=tp_group) for distributed_gather

* add warning when loading model weights as master weights

* update paddle.cast

* Revert "replace with unwrap_optimizer"

This reverts commit 3fd6a58954.

* add unwrap_optimizer

* convert is_unified_checkpoint to is_unified_checkpoint

* update
2023-12-28 13:06:37 +08:00
qingzhong1
d1e51e2f40 modify pdf (#7738) 2023-12-28 11:47:19 +08:00
yujun
dca0575ef4 update fasttokenizer readme (#7684) 2023-12-27 20:58:43 +08:00
qingzhong1
29a94d397a [Paddle-pipelines] update pdf (#7737)
* update pdf

* update pdf

* update pdf

* update pdf

* update pdf

* update pdf
2023-12-27 20:00:57 +08:00
周周周
57504e7118 去掉内部关于tgt_attention_mask的一些修改 (#7696)
* commit

* 删掉一些东西
2023-12-27 13:20:20 +08:00
Zhong Hui
228bd14dc0 fix lr. (#7729) 2023-12-26 20:50:06 +08:00
DrownFish19
4f15ac0719 [Unified Checkpoint] Add unified checkpoint config (#7574) 2023-12-26 19:44:39 +08:00
骑马小猫
b3961f26db [Bug fixes] update input_spec for forward (#7648)
* update input_spec for forward

* update opt casting
2023-12-26 17:59:04 +08:00
Haohongxiang
942865f52b [Trainer] Support release gradients for develop branch (#7594)
* support release gradients for develop branch
2023-12-26 16:14:21 +08:00
pangengzheng
b541fc2563 Fix sep compatible (#7721)
* run 4096

* fix get sep attr if paddle do not support sep

* polish

---------

Co-authored-by: pangengzheng <pangengzheng.baidu.com>
2023-12-26 13:22:03 +08:00
骑马小猫
96d12d459e [Improvement]support base-port & flask-port (#7668)
* support base-port & flask-port

* update flask_port
2023-12-26 12:14:49 +08:00
骑马小猫
e5eefa7753 use singlthread to do prediction (#7720) 2023-12-26 11:40:50 +08:00
zhouzj
7640804279 fix lora from pretrained. (#7714)
* fix lora from pretrained.

* updates.

* fix comments.

* fix comments.
2023-12-26 11:11:42 +08:00
Zhong Hui
d97016ec84 [BugFix] Fix gpt (#7716) 2023-12-26 10:51:07 +08:00
Haohongxiang
79d1d5b42d [BugFix] Fix seed bugs (#7715) 2023-12-26 10:50:38 +08:00
xiaoxiaohehe001
28158b9735 fix_wint (#7692) 2023-12-25 20:53:38 +08:00
zhaoyingli
9b6138af24 remove chunkid annotation (#7703) 2023-12-25 19:06:33 +08:00
Zhong Hui
fe3485f58b delete model zoo gpt2. (#7702) 2023-12-25 17:48:39 +08:00
yujun
ebd6964c50 [BUG Fix] update IntervalStrategy, update lora conv2d init, update logger.warning (#7705)
* 强制关闭

* 更新初始化.

* update warn -> warning
2023-12-25 13:50:36 +08:00
yujun
d6e71605a2 [LLM PDC] merge some llm pdc code into develop (#7694)
* 自定义cuda kernel支持更多arch

* llm gradio添加subtile

* 更新trainer_callback

* 确保模型文件顺利保存,使用checkpoint_done进行判断

* 添加FLAG_LLM_PDC环境变量,兼容task_name_or_path和intokens参数

* 修改finetune pretrain文件

* update

* update

* update
2023-12-22 11:56:31 +08:00
yinwei
838c7ed938 [CE] Fix ce bug (#7686) 2023-12-22 11:13:42 +08:00
zhaoyingli
68abb819e2 mv refined recompute to run_pretrain_auto (#7701) 2023-12-22 10:41:28 +08:00
Zhong Hui
2da0237e5e [PreTraining] Unify pretraining scripts (#7700) 2023-12-21 20:49:49 +08:00
Ting Liu
f584cdb159 Support torch safetensors load (#7690)
* support torch safetensors load
* fix dtype bug
2023-12-21 19:03:11 +08:00
zxcd
0577cd298f fix dtype (#7697) 2023-12-21 16:13:59 +08:00
Zhong Hui
3ef9c78d10 [DOC] Add pretraining docs and report pretrain performance. (#7437) 2023-12-21 15:47:02 +08:00
liuzhenhai93
c9586cc28e Pp reshard develop (#7629)
* polish

* tested

* polish

* polish

* polish

* follow_comment

---------

Co-authored-by: liuzhenhai93 <liuzhenhai@baidu.com>
2023-12-21 10:24:12 +08:00
co63oc
b02c7162a1 Fix typos (#7687) 2023-12-20 20:37:35 +08:00
MayYouBeProsperous
47c9185fe1 fix bugs (#7673) 2023-12-20 19:49:42 +08:00
Liujie0926
d4b0e4d869 [CI]update for llm_gpt (#7631)
* fix

* update for llm_gpt

* fix

* fix

* fix

* fix

* fix

* fix

* update case

* fix

* update base

* add Flag

* update loss base

* fix cache
2023-12-20 16:26:03 +08:00
yujun
f54f272675 PEFT lora support Conv2D (#7680) 2023-12-20 11:55:29 +08:00
zhang junjun
0f437bd07c [CI] set codecov status check (#7647)
* [CI] set codecov status check

* update
2023-12-19 20:27:51 +08:00
pangengzheng
99e2dd1e71 Support sep (#6994)
* run 4096

* support sequence segment parallel

* polish

* format

* format

* format

* inplace reshape

* format

* run llama with sep

* llama sep

* run sh

* llama converge

* llama align first loss between dp and sep

* support non fuse_qkv and non flash attn to use sep, all align first loss with dp

* support rope emb

* align the first loss of dp and sep for modelzoo gpt3

* sep support local_seed for dropout

* support tp(with sequence parallel) and sep hybrid parallel

* run seq_len scalable test

* do not build attention mask in advance when use flash attention

* polish run

* run benchmark

* test gpt1.3B performance

* clean codes

* run gpt and llama

* code style

* add unittest

* enable test when gpu_num>1

* code style

* fix sep test

* fix test

* code style

* polish

* fix

* polish test

* check tp and sp

* run script

* check compatible

* rename

* fix test

* polish

* fix bug

* rename

---------

Co-authored-by: pangengzheng <pangengzheng.baidu.com>
2023-12-19 20:02:32 +08:00
tianhaodongbd
1fcde9d5ae [CE] Add ce sharding stage3 and ce mp sharding stage1 (#7639) 2023-12-19 16:23:01 +08:00
骑马小猫
9715b6af0d fix tokenizer decode-tokens (#7681) 2023-12-19 16:21:56 +08:00
Ting Liu
445638a4ab llm doc update (#7478)
* llm doc update

* pic update

* doc update

* update pic

* doc update

* requirement update

* doc update

* update

* update

* update

* update

* update

* update

* update

* add zero padding

* update

* update

---------

Co-authored-by: lugimzzz <zhenglujing@baidu.com>
2023-12-19 15:13:48 +08:00
lugimzzz
805350b5f6 [llm]Qlora fix (#7645)
* bug fix

* fix

* fix
2023-12-19 13:16:50 +08:00
Haohongxiang
e78007e2c4 [Llama2] Fix setting seeds of distributed training for Llama model with Auto Parallel (#7643)
* fix seeds of auto llama

* update loss of ci cases
2023-12-19 11:42:13 +08:00
yinwei
1757c5d52d [BugFix] Add CE for mp2-sp2-pp2-dp2 (#7678) 2023-12-19 11:33:25 +08:00
zhink
6299680263 fix cache kv len (#7679) 2023-12-19 10:31:43 +08:00
MayYouBeProsperous
dba73aa484 【Hackathon 5th No.64】PaddleNLP套件模型接入动转静训练功能 (#7576)
* fix

* add to_static for Trainer

* fix

* codestyle
2023-12-18 19:18:22 +08:00
MayYouBeProsperous
4c94b94c74 add --to_static (#7656) 2023-12-18 18:58:07 +08:00
xysheng-baidu
5c7d7b1c6a add ce_mp8 model (#7665) 2023-12-18 17:11:06 +08:00
Ruibiao Chen
5e69cfc1d4 Improve flash-attn mask calculation for auto llama (#7670) 2023-12-18 15:40:43 +08:00
Siming Dai
3c8e0b42bb [BugFix] Fix qwen merge tp concat (#7675) 2023-12-18 12:51:19 +08:00
yinwei
0568d98b22 [CE] Add ce for mp2-pp2-sp2-dp2 (#7664) 2023-12-15 16:43:18 +08:00
yinwei
e221595791 [CE] Add CE test for stage2 (#7544) 2023-12-15 15:43:01 +08:00
Sonder
5106809e5d [AutoParallel] add pipeline.auto_parallel_profiler to auto_config (#7343)
* update

* update

* Fix init weight for llama modeling auto

* update

* add support for Llama2

* recover codes

* remove training_args

* fix

* remove test config

* use guard

* change var name

* add import

* fix import error

* fix import error in run_pretrain_auto.py

---------

Co-authored-by: chenruibiao <chenruibiao@baidu.com>
2023-12-15 13:53:16 +08:00
zxcd
b90cf05930 fix dtype (#7619) 2023-12-14 15:36:33 +08:00
niuliling123
45afa73a5f update for seed (#7653)
* update for seed

* update
2023-12-14 14:13:03 +08:00
niuliling123
6235b8994a [Trainer] Update for seed (#7651) 2023-12-14 12:42:34 +08:00
zhaoyingli
a73a7bf15c [AutoParallel] add resume_from_checkpoint and vpp for llama (#7601)
* [AutoParallel] add resume_from_checkpoint and vpp for llama

* add clip

* polish modeling_auto.py

* polish code

* tiny fix

* add vpp ci for llama

* fix ci script

* update loss_base
2023-12-13 17:09:33 +08:00
骑马小猫
1bfe864587 disable chat-template in tipc (#7633) 2023-12-13 16:59:30 +08:00
zhang junjun
83acdd365c [CI] add coverage status checks (#7635)
* [CI] add coverage status checks

* update

* update

* update

* update

* fix
2023-12-13 14:36:08 +08:00
骑马小猫
d5a9dda0e8 fix chatglm2 training for chat-template (#7637) 2023-12-13 14:03:39 +08:00
DrownFish19
b51de6d774 [GPT] Support SharedLayer with different prefixes for pipeline parallel (#7598) 2023-12-12 20:52:11 +08:00
DrownFish19
24b6d70204 [FG] Fix fast generation (#7630)
* fix paddle header file path

* fix paddle header file path
2023-12-12 19:52:44 +08:00
niuliling123
9bff2a029b [Trainer] Remove args in set_seed function (#7592) 2023-12-12 19:42:45 +08:00
ShenLiang
e5175a7af5 [BugFix]Add local seed for gpt in flash_attn (#7626)
* add local seed for gpt

* add local seed for gpt

* add local seed

* fix bug seed in embedding
2023-12-12 17:58:34 +08:00
Haohongxiang
a4ed7ac6f5 fix grads acc in llama auto (#7625) 2023-12-12 10:53:15 +08:00
yinwei
0a58a1a5f8 [GPT] Bug Fix, to fix pp sp layernorm grad sync (#7613) 2023-12-12 10:50:47 +08:00
Siming Dai
ac7114f331 [Unified Checkpoint] Add dynamic load unified checkpoint (#7487)
* initial commit

* add merge tp for optimizer

* add sharded index for unified optimizer

* rename optimizer state dict key

* change param name

* optimize merge optimzer tp speed

* optimize save speed

* nested copy state dict

* fix bug

* fix filename

* add ckpt check, add dispatch table creationg

* fix sharding group index json

* remove dist_gather, use paddle.distributed's gather instead

* add dynamic load

* support dynamic load, not feasible currently

* add check_unified_optimizer

* add dynamic load optimizer

* fix loading optimizer with sharding group

* add unittest for n1c8 dynamic

* add unittest for n2c4 dynamic

* refine unittest, add dynamic convert test

* fix distributed_send_recv bug

* fix optimizer params
2023-12-12 10:33:23 +08:00
MayYouBeProsperous
e6acb0e5bc add to_static for electra (#7575)
* add --to_static for electra

* remove comment

* Update run_pretrain.py
2023-12-11 17:30:38 +08:00
Siming Dai
a866ae4337 [Qwen] Support Qwen flash attention 2 with attention mask (#7624)
Support qwen fa2 with attention_mask
2023-12-11 17:22:55 +08:00
Haohongxiang
675ee05c74 [LlaMA] Fix llama final norm in pp modeling (#7615) 2023-12-11 15:46:20 +08:00
Liujie0926
2c71b215b7 【benchmark】add max_mem_reserved for llm benchmark (#7538)
* 【benchmark】add max_mem_reserved for llm benchmark

* update

* add arg for case

* update gpt-3/moe/bert mem

* update mylog

* fix

* fix

* fix

* update for skip_memory_metrics

* update ce_gpt

* fix
2023-12-11 15:25:17 +08:00
骑马小猫
4f630fe6cc [Bug fixes]Refactor chat template intergration test (#7618)
* remote llama chat-template intergration test

* update qwen chat-template
2023-12-11 11:01:26 +08:00
Siming Dai
ae5c1a9c97 add auto_cast enable=False for paddle.outer (#7617) 2023-12-11 10:49:40 +08:00
Haohongxiang
dd6e4f146c [Llama2] Add uts for llama in semi-auto mode (#7588)
* Add uts for llama in semi-auto mode

* update uts

* update uts

* fix target paths

* update
2023-12-08 17:43:51 +08:00
tianhaodongbd
344f0029ab [CE] Add ce_gpt-gpt345_dp1 && dp8 && SD8_stage1 (#7484)
---------

Co-authored-by: niuliling123 <sdust_niull@163.com>
2023-12-08 17:09:17 +08:00
Zhong Hui
a8d0942e1e [Trainer] Add memory info in log (#7587) (#7607)
* add memory info
2023-12-08 14:13:03 +08:00
骑马小猫
e7d67410bc open ci testing (#7606) 2023-12-08 13:21:41 +08:00
Zhong Hui
9c279f7e10 [Trainer] Remove dp group with group_sharded_parallel checks. (#7507) 2023-12-08 11:46:57 +08:00
Ruibiao Chen
a74916d8b6 Fix post_init bug for run_pretrain_auto (#7604) 2023-12-08 11:13:26 +08:00
gmm
8aa96d27ec 【benchmark】add max_mem_reserved for benchmark (#7488)
* add max_mem_reserved for benchmark

* add max_mem_reserved for benchmark

* add max_mem_reserved for benchmark

* add max_mem_reserved for benchmark

* fix

* fix

* fix

* fix
2023-12-07 16:21:20 +08:00
zxcd
1fd95e5e56 [GPT] Fix dtype (#7595) 2023-12-07 11:25:43 +08:00
Haohongxiang
b05873629e [Auto Parallel] support arg for enabling fused_linear_param_grad_add pass (#7589) 2023-12-06 13:16:33 +08:00
骑马小猫
810edc2acc [Improvement] update eos-token-id (#7584)
* update eos-token-id

* complete the eos-token-id codes

* update streamer pre-tokens

* change streamer

* update predictor
2023-12-05 21:00:26 +08:00
Yuanle Liu
1e34cb0fa6 [LLM] inference model use new executor (#7467) 2023-12-05 20:20:32 +08:00
Ting Liu
0f1abea5b7 Chat gradio (#7581)
* chat gradio

* bug fix

* bug fix
2023-12-05 19:53:37 +08:00
Liujie0926
6a3efc33f5 [gpt-3]Fix dynamic_prepare for CI (#7550)
* fix data download

* fix auto_benchmark timeout
2023-12-05 15:26:26 +08:00
骑马小猫
9a0cbcd556 disable CUDA_DEVICE_MAX_CONNECTIONS for ce (#7586) 2023-12-05 12:04:50 +08:00
JZ-LIANG
aa44c6ed9f annotation update (#7486) 2023-12-05 11:38:58 +08:00
zxcd
6d41cbcd87 remove astype for probs, all dtype should same with scores. (#7577)
* dtype should same with scores.

* fix
2023-12-05 11:09:52 +08:00
niuliling123
f3607d5239 [Trainer] Update set_seed in trainer_utils.py (#7528) 2023-12-05 10:50:24 +08:00
Siming Dai
ca0e45bef6 [Dist Dataloader] Fix dist dataloader sampler (#7579)
* fix distdataloader sampler
2023-12-04 21:11:17 +08:00
xysheng-baidu
8ed33e9a42 [LLM] Fix mp parameter initialization (#7534) 2023-12-04 19:56:33 +08:00
Ruibiao Chen
7234321697 Set flash_attn mask to None in LlamaPretrainedModelAuto (#7566) 2023-12-04 18:51:43 +08:00
blueoom
74bb39b51b load_from read file with encoding utf8 (#7558) 2023-12-04 10:59:30 +08:00
骑马小猫
1a7e7d4572 [Bug fixes]fix intergration test (#7569)
* remove intergration test

* update llama2 chat-template
2023-12-04 10:58:02 +08:00
Leo Chen
f377693ebe init fp32 model and then cast to fp16 when use amp-o2 (#7546) 2023-12-04 10:57:42 +08:00
lugimzzz
d4a8d4ab15 fix qat (#7565) 2023-12-03 22:28:25 +08:00
xuzhang
2f21556a0f fix clip image processor (#7540)
* fix clip image processor

* support CLIPTextTransformer fp16

* revoke
2023-12-01 15:18:50 +08:00
lugimzzz
0faa701fb0 [PEFT]add qlora (#7416)
* add qlora(wip)

* add state convert

* add qlora

* update

* fix

* fix

* update

* update

* fix
2023-12-01 15:11:51 +08:00
lugimzzz
0dc4b48bd9 [llm]update data loading (#7557)
* update data

* update

* remove error raise

* fix
2023-12-01 13:55:07 +08:00
yujun
2bc6d8df77 确保静态图导出的时候使用的是1D tensor (#7555) 2023-12-01 07:31:27 +08:00
Ruibiao Chen
46d7534825 [AutoParallel] Fix init weight for llama modeling auto (#7491)
* Fix init weight for llama modeling auto

* remove _init_weights in LlamaPretrainedModelAuto
2023-11-30 19:38:46 +08:00
Wang Bojun
665731a40d add scale dtype test for weight quantize (#7552)
* add scale dtype test ofr weight quantize

* fix code style
2023-11-30 14:09:09 +08:00
yujun
5500d093d5 删除tipc中对于paddlemix的依赖 (#7543) 2023-11-30 10:15:12 +08:00
w5688414
057b429d15 Fix fp16 o1 bugs (#7548) 2023-11-29 08:02:39 -06:00
w5688414
5eb2eae1c7 [Paddle-pipelines] remove redundant requirements, upgrade to 0.6.2 (#7518)
* remove redundant requirements

* Upgrade to 0.6.2

* Update txt text processing

* fix ci error

* recover markdown
2023-11-29 01:15:35 -06:00
骑马小猫
be318c565a fix pyyaml installing under py310 (#7526) 2023-11-27 20:04:18 +08:00
Yiqun Liu
48bb1c05cb [Llama] Hotfix recompute in PP for benchmark. (#7479) 2023-11-27 15:01:09 +08:00
yujun
84ec87bf7f rm sd ldm benchmark (#7434) 2023-11-27 14:51:13 +08:00
lzydev
1b6e00782d add refined-recompute config (#7519) 2023-11-27 11:04:39 +08:00
Ting Liu
3081e2e35b remove useless import (#7517)
* remove useless import

* remove import
2023-11-27 09:19:41 +08:00
DrownFish19
e8d3b630ba [Unified checkpoint] Add unified optimizer loader (#7441)
Add unified optimizer loader

---------

Co-authored-by: DesmonDay <908660116@qq.com>
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2023-11-24 19:05:00 +08:00
骑马小猫
db1a79a69d [Bug fixes] remove qwen 14b-chat special token testing (#7514)
* fix chat_template qwen 14b-chat ci

* remove eos_token_id from ChatTemplate
2023-11-24 01:47:17 -06:00
Ting Liu
8d626c570c Gradio multi (#7508)
* code save

* rm sharememory, port exchange

* single gpu support

* code refinement

* gradio unittest
2023-11-24 01:29:09 -06:00
Siming Dai
be99faba2d [Trainer] Fix dist gather (#7513)
* remove dist_gather, use paddle.distributed's gather instead

* fix gather
2023-11-24 01:26:20 -06:00
zhouzj
7b36d571df Fix lora save (#7504)
* add method for saving scale in TP mode

* fix save mode in PP mode

* fix channel-wise's import

* fix bugs

* fix bugs

* fix bugs
2023-11-24 01:11:47 -06:00
骑马小猫
42764a5389 [Bug fixes]disable predictor testing (#7496)
* disable predictor testing

* disable inference-model testing

* disable gradio logit-compare
2023-11-23 20:25:37 +08:00
Siming Dai
f625c87717 Remove dist_gather, use paddle.distributed's gather instead (#7509) 2023-11-23 17:57:18 +08:00
w5688414
d181e352e5 Fix attention_score -nan bug (#7501) 2023-11-22 07:24:32 -06:00
Siming Dai
bf9d5bfa39 fix sharding index json (#7499) 2023-11-22 05:54:08 -06:00
Zhong Hui
14ab8d7b40 [Trainer] Fix pp config usage. (#7443) 2023-11-22 19:03:08 +08:00
骑马小猫
d4faef6d6a [Improvement] add context_data support for chat_template rendering (#7480)
* add context_data support for chat_template rendering

* update method name

* add chat_template_with_context_data file
2023-11-22 14:42:05 +08:00
tianhaodongbd
4645ddcf4a [Trainer] Support sharding stage 3 for main grad (#7319) 2023-11-22 10:50:56 +08:00
tianhaodongbd
628db887c9 [Trainer] Support dp for main_grad (#7293) 2023-11-22 10:49:58 +08:00
Zhong Hui
13b478606a [BugFix] Update trainer.py (#7492) 2023-11-21 18:26:16 +08:00
Siming Dai
d148cfee94 [Unified checkpoint] Add unified optimizer (#7373)
* initial commit

* temp commit

* add merge tp for optimizer

* add sharded index for unified optimizer

* rename optimizer state dict key

* change param name

* optimize merge optimzer tp speed

* optimize save speed

* nested copy state dict

* simplify code

* polish code

* fix bug

* fix filename
2023-11-21 01:23:06 -06:00
Zhong Hui
f136a4453c [Unified Ckpt] Add unittest for unified checkpoint. (#7392)
* init test for save/load

* fix warmup_steps.

* add unittest for unified checkpoint.

* reset script back.

* fix pp with sharding.

* remove some code.
2023-11-21 00:33:10 -06:00
Zhong Hui
c1b2fb35bc [LLM] Fix alibi in pipeline parallel for baichuan-13b (#7433) 2023-11-21 11:23:22 +08:00
JZ-LIANG
e56f928bcc [AutoParallel] Sequence Parallel Optimization Pass Config (#7409)
* annotation for sp

* hack of shard of

* remove redundent comm

* remove redundent comm

* add yaml

* sp default disenable

* bugfix

* sp optimization as default
2023-11-21 10:49:13 +08:00
DrownFish19
5477d46647 [GPT] Add sequence parallel for GPT (#7311)
* Add sequence parallel
2023-11-21 10:48:32 +08:00
Liujie0926
8e30689be5 [gpt-3]Add pir ci (#7471)
* add pir case

* update
2023-11-20 14:44:25 +08:00
zhaoyingli
d42afd342f update bsz for pretrain auto (#7474) 2023-11-20 10:10:56 +08:00
Haohongxiang
637fa55570 [Llama] Support hybrid strategy and recompute in llama auto version (#7458)
* support hybrid strategy and recompute in llama auto version

* remove redundancy codes
2023-11-17 16:40:45 +08:00
WAI-clear
de211d9ef6 Add load multi torch bin slices logic (#7445)
* test

* add load multi torch bin slices logit

* add safetensor/bin multi splices load

* add safetensors/bin multi slice files load
2023-11-17 16:37:56 +08:00
Ruibiao Chen
a36b70280a Log ips in auto Llama (#7459)
* Log ips in auto Llama

* Update code

* Update code
2023-11-17 14:51:14 +08:00
骑马小猫
757478946e use old_executor (#7464) 2023-11-17 14:04:00 +08:00
Yuanle Liu
0749e96550 [LLM] Inference use new executor and remove top_p_sampling custom op (#7432)
* inference use new executor

* delete custom op [top_p_sampling]

* update testing utils

* update chatglm2 config

* disable chatglm2 test temporarily

* update chatglm2 d2s

* test llama lora chat-template testing

---------

Co-authored-by: wj-Mcat <1435130236@qq.com>
2023-11-16 17:25:54 +08:00
Liujie0926
17a7f8ec44 [gpt-3]add new_exec_pp benchmark (#7457) 2023-11-16 16:55:59 +08:00
Liujie0926
2f5024a9e8 [CI]update gpt-3 scripts (#7350)
* update gpt-3 ci

* fix

* fix path

* fix

* fix

* update

* add case

* fix loss

* revert loss

* update

* fix

* update log_path

* fix

---------

Co-authored-by: PaddleCI <paddle_ci@example.com>
2023-11-16 16:29:39 +08:00
zhaoyingli
10d57f0b34 [AutoParallel] Support Llama (#7394)
* [AutoParallel] Support Llama

* Update training_args.py

* support dp

* revert modeling_auto

* support recompute

* rm comment

* rm print

* rm print
2023-11-16 11:02:14 +08:00
w5688414
10ff94a752 [retrieval benchmark] fix dynamic oom bug (#7449)
* fix dynamic oom bug

* Update benchmark

* Add comments

* remove max_length

* remove comments
2023-11-15 10:47:51 -06:00
骑马小猫
5202d5ba59 update chat-template readme (#7442) 2023-11-15 00:41:58 -06:00
w5688414
90ab47d86b remove tsinghua pip (#7435) 2023-11-14 23:37:21 -06:00
周周周
f01da97880 [llm] support GQA in chatglmv2 (#7412)
* support GQA in chatglmv2

* support new paddlenlp chatglmv2

* modify to test
2023-11-15 10:41:40 +08:00
骑马小猫
0731766c01 [New features] Add chat template for training (#7241)
* complete chat-template

* update chat-template

* fix lint

* update tokenizer

* update from_pretrained method

* update from_pretrained args

* update test

* encode chat-inputs

* add test_data testing code

* update chat_template

* update qwen conversation

* complete qwen finetune with chat-template

* update argument

* update chat-template

* support inference with chat-template in predictor.py

* update predictor

* update use_chat_template inference

* update chat-template pr

* update chatglm chat-template finetune

* update THUDM test_template

* add constrains between chat_template and eval_with_do_generation

* add position_ids to tokenized_result

* update chat-template

* update src_length

* update truncation

* update np.bool
2023-11-14 00:17:26 -06:00
zhang junjun
5524c5895b Add llm ci report (#7418)
* [CI] fix llm tests

* Add llm ci report

* update

* update

* update
2023-11-14 10:22:45 +08:00
w5688414
8d5abb607d [paddle-pipelines] Fix retrieval benchmarks (#7420)
* Fix retrieval benchmarks

* Update readme
2023-11-13 02:13:23 -06:00
骑马小猫
a16cbb3485 revert chatglm2 config (#7410) 2023-11-13 02:12:59 -06:00
RichardWooSJTU
e0643cc501 [LLM] Support ptq inference (#7224)
* re submit ptq inference

* add unittest

* fix readme and code refine

* fix ut name

* fix ut name

* fix wint8

* turn on auto tune flags in benchmark

* fix review

* fix review

* adapth quantization_config

* fix ci

* test
2023-11-13 16:11:52 +08:00
Ting Liu
92134e1847 add chatglm2 legacy checkpoints convert script (#7419) 2023-11-09 22:51:54 -06:00
Leo Chen
8d5fef01e2 support pir fuse pass (#7393) 2023-11-10 10:52:12 +08:00
w5688414
2cbf68d918 Update fa2 comments (#7415) 2023-11-09 09:30:10 -06:00
Siming Dai
76e92c12c4 fix bug (#7414) 2023-11-09 20:44:13 +08:00
Ting Liu
d45f7c4a3b convert chatglm2 to fuse qkv (#7379)
* chatglm2 remove fuse qkv

* fix lint
2023-11-09 05:48:10 -06:00
Sijun He
40c9c56e0f Update requirements.txt (#7408) 2023-11-08 23:45:42 -06:00
Siming Dai
e877ad1406 [Trainer] Fix dist dataloader with no mp group (#7407) 2023-11-09 13:11:28 +08:00
WAI-clear
0771a88328 fix qwen matrix dimmention alignment (#7402) 2023-11-09 10:36:50 +08:00
liuzhenhai93
111b381146 Develop sharding reshard (#7399)
* format

* tested

* format
2023-11-09 10:01:20 +08:00
Ting Liu
65ec3686b3 support torch safe tensor convert (#7383)
* support torch safe tensor convert

* code refinement

* if statement adjust

* skip clip & bart unitest

* skip clip & bart unitest

* close bart serialization save

* gradio-fix
2023-11-08 17:24:33 +08:00
lugimzzz
6db372605e add neft (#7382) 2023-11-07 20:39:53 -06:00
骑马小猫
254414e024 [Function optimization] update llama ce script (#7192)
* update llama ce script

* add bloom & chatglm ce testing

* add bloom/chatglm ptuning ce scripts

* update llama ce scripts

* update test_predictor

* code save

* fix typo

* remove testing model

* update config file

* remove testing model code

* disable chatglm testing

* merge, fix yaml

* update chatglm2

* add chatglm2

* lint fix

* add chatglm2 ce shell

* run_ce arg update

* add debug print

* update llama ce script

* update test_predictor

* reduce the src_length and max_length

* remove chatglm2 config

---------

Co-authored-by: wtmlon <wtmlon@foxmail.com>
2023-11-07 10:40:40 +08:00
JZ-LIANG
40fe6644c0 [Semi-Auto] Sequence Parallel for Auto Mode (#7301)
* annotation for sp

* hack of shard of

* remove redundent comm

* remove redundent comm

* add yaml

* sp default disenable

* bugfix
2023-11-06 20:55:28 +08:00
w5688414
7841869d4b [baichuan2 13b] Fix alibi bug (#7376)
* Fix alibi bug

* Fix alibi 2.5.2
2023-11-06 05:07:49 -06:00
lugimzzz
c5259814a8 [PEFT]add qatlora mp (#7288)
* add qatlora mp

* support qat lora tp
2023-11-06 01:34:37 -06:00
lugimzzz
dd41947ae2 add peft save_to_aistudio (#7364) 2023-11-03 03:22:09 -05:00
lzydev
c013ccb080 【AutoParallelism】add "refined_ops_patterns" in recompute strategy (#7349)
* add refined_ops_patterns in recompute strategy

* modify the yaml file

* add sr

* fix yaml file"
2023-11-02 20:25:20 +08:00
Ting Liu
fc2bf9cc6e Qwen support position_ids (#7359)
* qwen add position ids

* qwen add position ids

* bug fix

* bug fix
2023-11-02 20:02:30 +08:00
w5688414
5a50bdd212 [Fix llm bugs] Add use cache & version check (#7357)
* Add use cache

* Add version check

* Update flash attention

* Update warning msg

* Update use_cache
2023-11-02 11:51:26 +08:00
Haohongxiang
fd527884d6 support pure single-card modeling for auto_parallel (#7348) 2023-11-02 11:35:32 +08:00
Ting Liu
20a6afed9f freeze gradio version (#7355)
* freeze gradio version

* freeze gradio version
2023-11-02 10:01:10 +08:00
lugimzzz
b98b64b093 fix peft load_best_model_at_end & resume from checkpoint (#7360) 2023-11-01 10:01:05 -05:00
Leo Chen
849ebff85c add parallel seed control (#7347)
* add parallel seed control

* update
2023-11-01 20:33:48 +08:00
Zhong Hui
f15ca845d4 [Trainer] Support broadcast optimizer in dp group and fix unified checkpoints (#7256)
* add sharded save

* fix unified ckpt with dp.

* fix with load dp.

* fix bugs for pure pp. add miss keys check.

---------

Co-authored-by: DesmonDay <908660116@qq.com>
2023-10-31 21:15:28 +08:00
Ting Liu
4fb915b697 Add qwen baichuan ci (#7324)
* add qwen alibi-baichuan ci

* attention mask fix

* add tiktoken requirement

---------

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2023-10-31 16:16:47 +08:00
LokeZhou
0407095860 [Other]TopPProcess add bfloat16 input (#7337)
* TopPProcess add bfloat16 input

* fix sorted_indices cast
2023-10-31 16:12:55 +08:00
lugimzzz
f0566e8b47 [aistudio] add save to aistudio hub (#7338)
* add save to aistudiohub

* fix according to comments
2023-10-31 14:38:59 +08:00
Siming Dai
0c05adc015 [CI] Add qwen pretrain test (#7330)
* add qwen pretrain test

* rm model_type
2023-10-31 12:03:16 +08:00
xiaoxiaohehe001
13efd366ad [LLM] Support fuse_gpt wint8/4. (#7304)
* support_gpt_wint

* support_gpt_qkv_unfuse
2023-10-30 14:15:32 +08:00
lugimzzz
fe8cdf0d79 [quant] add QuantizationConfig (#7314)
* add

* add quantization config

* update

* fix

* fix

* add quantization_config
2023-10-27 18:06:24 +08:00
Chang Xu
e7b53f6d27 Support Fast PTQ (#7282) 2023-10-27 11:18:06 +08:00
Siming Dai
02c98858f0 Optimize qwen model with fused_rope, fused_rms_norm and core_attn recompute (#7307)
* add fused_rms_norm, fused_rope

* add core_attn
2023-10-27 10:39:59 +08:00
骑马小猫
bae323a940 [Bug fixes] update inference doc (#7299)
* update inference doc

* update table matri

* remove temp-doc
2023-10-27 08:23:58 +08:00
Ruibiao Chen
770bfacee0 Support setting allreduce_matmul_grad_overlapping and enable_send_recv_overlap in auto_config (#7297) 2023-10-26 13:08:44 +08:00
w5688414
5d2c290426 [llm benchmark] Add flash attention 2 (#7057)
* Add flash attention

* Add chatglm flash attention

* format llama

* Update flash attention

* Fix casual low precision bug

* Update finetune generation config

* Add seed config

* Update FA2

* Update attention

* update llama

* Update casual config

* Update alibi config

* rm is casual parameter

* Update bloomz config
2023-10-25 23:21:14 -05:00
lugimzzz
513f763ec7 fix recompute (#7235) 2023-10-25 17:22:51 +08:00
Zhong Hui
60fd6bec50 Support qwen pretrain. (#7275)
* Support qwen pretrain.

* add missing files.

* fix

* Support fuse rms norm

* add new config.

* refine

* fix

* auto model support from config.
2023-10-24 21:40:59 +08:00
Siming Dai
4b8600615b Modify dist dataloader (#7286) 2023-10-24 17:49:11 +08:00
wawltor
5359c0e2f9 Add qwen flash attention (#7289)
* support the flash attention for the qwen

* support the attention mask for the qwen

* fix the return softmax in fa

* update the use_flash_attention to use_flash_attn

* disable flash attn for the qwen test

* delte some unused code
2023-10-24 10:54:36 +08:00
骑马小猫
22d6bd5fe4 update inference doc (#7296) 2023-10-24 09:46:33 +08:00
lugimzzz
ddb60e5757 [llm]fix weight only quantization (#7252)
* fix quantization

* fix

* fix

* json
2023-10-23 06:46:54 -05:00
骑马小猫
7dd7f1739e [Bug fixes] disable ir_optim under bfloat16 (#7292)
* disable ir_optim under bfloat16

* delete pass

* update predictor

* trigger cic
2023-10-23 17:07:03 +08:00
骑马小猫
4476448af0 [New features] update llm docs (#7290)
* update llm docs

* update inference doc

* update inference

* update inference doc
2023-10-23 17:04:32 +08:00
Ting Liu
639215adaf readme update 14b (#7291)
* readme update 14b

* fix
2023-10-22 21:51:02 -05:00
Yichen Zhang
d9f260356b [GPT] Replace reshape with set_dynamic_shape api to set dynamic shape to a tensor (#7281) 2023-10-20 16:31:37 +08:00
Yiqun Liu
e398018e20 [Trainer] Polish the setting of dist_strategy. (#7214)
* Polish the setting of distributed strategy.

* Avoid redundant cast.

* Optimize benchmark command for better overlap.
2023-10-20 11:12:18 +08:00
xiaoxiaohehe001
2f2816753e [LLM] Support chatglm/bloom wint8/4. (#7207)
* chatglm_bloom_wint

* add_wint4_test

* delete_wint4_test

* update bloom wint8

---------

Co-authored-by: wj-Mcat <1435130236@qq.com>
2023-10-19 18:53:03 +08:00
周周周
9db7022c09 [llm]support chatglmv2 in fined FT (#7253)
* support chatglmv2 in fined FT

* support chatglmv2 in fined FT

* commit

* final commit

* final commit

* final commit

* comment ChatGLMForCausalLM
2023-10-19 18:39:39 +08:00
cyber-pioneer
f9021f8f7f [PIR][Prim] support PIR train (#7276)
* support PIR train

* polish code
2023-10-19 15:16:17 +08:00
Zhong Hui
f9d8e73f0c [Trainer] Add unified checkpoint for hybrid parallel. (#7238) 2023-10-18 18:40:23 +08:00
骑马小猫
d152fdb035 add docs for chat-template (#7270) 2023-10-18 04:56:34 -05:00
lzydev
90f44a97f3 fix error in dropout of hybrid_model (#7269) 2023-10-18 16:17:17 +08:00
zhaoyingli
af0d26ada3 update shard tensor for pp (#7167)
* update shard tensor for pp

* rm shard_op

* rm shard_op
2023-10-18 14:51:39 +08:00
骑马小猫
00ab0e1c4b [Bug fixes] update lru_cache usage (#7260)
* update lru_cache usage

* trigger cla
2023-10-18 14:09:48 +08:00
Leo Chen
27c4c89385 add flash attention for auto gpt3 (#7135)
* add flash attention for auto gpt3

* remove transpose
2023-10-18 11:51:02 +08:00
Siming Dai
faf3e3c90c Fix fp32 dist dataloader (#7261) 2023-10-18 11:32:14 +08:00
Siming Dai
86f24edb24 Support zero dataset splits for pre-training (#7259)
* support empty splits

* fix split

* fix dd

* modify func name
2023-10-18 10:40:52 +08:00
xiaoxiaohehe001
c39c6280fe fix_bloom_precache (#7249) 2023-10-17 21:06:24 +08:00
骑马小猫
671775be9d [New Features] add chat-template for inference (#7219)
* complete chat-template

* update chat-template

* fix lint

* update tokenizer

* update from_pretrained method

* update from_pretrained args

* update test

* add skip warning for chat-template file

* update chat-template by comment
2023-10-17 03:38:36 -05:00
周周周
9d9e60dca6 when < 11.6 (#7250) 2023-10-17 14:27:00 +08:00
Siming Dai
dd9bec075c Support fp32 dtype for dist dataloader (#7240)
* support fp32
* add todo
2023-10-16 16:57:08 +08:00
lugimzzz
edcd54d861 remove warning (#7234) 2023-10-15 22:21:13 -05:00
Sijun He
70e750c02c Fix subfolder default argument in model download (#7220)
* styles

* remove print
2023-10-13 05:43:23 -05:00
骑马小猫
25dcba99d1 [New Features] Add prefix allowed token (#7210)
* use model_type to control model-intialization

* add prefix_constrained logit processor
2023-10-13 01:45:07 -05:00
骑马小猫
6f03ec69fe [Bug fixes] Fix export model validate pdmodel (#7201)
* use model_type to control model-intialization

* update output_path for validate_pdmodel

* update export rank_index

* trigger cla
2023-10-13 11:16:03 +08:00
Siming Dai
b0fa9c42aa [Trainer] Support iterable dataset with dist dataloader (#7208) 2023-10-12 19:52:27 +08:00
Zhong Hui
6140ad2497 Update README.md (#7184) 2023-10-12 19:38:17 +08:00
Ting Liu
0a66a2e6a5 adjust gradio unittest assert (#7205) 2023-10-12 19:30:27 +08:00
xiaoxiaohehe001
43a6829740 bloom_precache (#7204) 2023-10-12 14:55:09 +08:00
DrownFish19
dc6e0d901c fix tokenizer decode (#7195) 2023-10-12 14:42:41 +08:00
Siming Dai
c9db29cecf fix_shard_size (#7202) 2023-10-12 14:40:49 +08:00
RichardWooSJTU
64f00f084f [LLM] Reconstruct fused transformer layers (#7186)
* reconstruct fused_transformer_layers

* delete origin class

* code refine
2023-10-12 14:07:53 +08:00
Ting Liu
d0c85dfa3c bloom chatglmv1/2 llm unittest (#7165)
* bloom chatglmv1/2 llm unittest

* resolve empty return
2023-10-12 14:06:22 +08:00
Sijun He
74eb855568 Update README.md 2023-10-11 08:06:56 -05:00
Siming Dai
1f708035ea Add max_shard_size arg (#6835)
* add max_shard_size arg

* rm max_shard_size

* move to 1024

---------

Co-authored-by: daisiming <daisiming@baidu.com>
2023-10-11 20:48:58 +08:00
骑马小猫
be39ed1abb use batch_size = 3 (#7191) 2023-10-11 05:22:14 -05:00
lugimzzz
11e7735f75 [PEFT]support pp + lora (#7198)
* support pp lora

* update
2023-10-11 04:47:28 -05:00
xiaoxiaohehe001
d1e060fa88 support_prealloc (#7194)
Co-authored-by: liuzichang01 <liuzichang01@baidu.com>
2023-10-11 01:56:10 -05:00
骑马小猫
cfd8d391da add opt __init__.py (#7193) 2023-10-11 14:27:24 +08:00
xiaoxiaohehe001
ddf845b7c3 [LLM] Fix error when config.bs is more than input bs. (#7187)
* bs_slice

* fix_bloom

* support_bloom

---------

Co-authored-by: yuanlehome <yuanlehome@163.com>
Co-authored-by: liuzichang01 <liuzichang01@baidu.com>
2023-10-10 22:02:54 -05:00
Kunbo Ding
dc32055c98 [README] fix README in model_zoo/ernie-1.0/preprocess (#7188)
* [README] fix README in model_zoo/ernie-1.0/preprocess

* [README] fix README in model_zoo/ernie-1.0/preprocess
2023-10-11 10:27:50 +08:00
Kunbo Ding
aafadd2581 Add share-folder for distributed training (#7068)
* add share_folder for data_cache_path

* remove pdb

* fix README

* fix share_folder

* update README

* update README
2023-10-10 20:55:53 +08:00
骑马小猫
2ce561bacc [New Features] add llama ce scripts (#7118)
* add llama ce scripts

* update llama ce-predictor

* update predictor

* update test_predictor

* update ce scripts

* update ratio

* update run_ce.sh scripts

* update ce scripts

* update llama ce scripts

* update prepare.sh script

* update convergence keyword

* revert requirements
2023-10-10 16:07:43 +08:00
Ting Liu
27d67d49c2 gradio ui support streaming (#7086)
* gradio ui support streaming

* update

* remove hard code values

* add gradio unitest

* add comment

* add pytest timeout requirement

* add requirement, enlarge port range

* enlarge port scan range

* port range adjust,

* add gradio requirement
2023-10-10 14:09:20 +08:00
骑马小猫
226c6c03fa [New features] Add precache predictor test (#7137)
* use model_type to control model-intialization

* add llama precaches predictor

* update pre-cache config

* remove print

* revert max_length
2023-10-09 21:40:22 -05:00
Sijun He
13502f9a46 Support AI Studio download (#7146)
* styles

* fix subfolder

* remove print
2023-10-09 08:05:49 -05:00
DrownFish19
674587652f [GPT-3] Fix attention and past_key_values (#7088) 2023-10-09 19:05:42 +08:00
骑马小猫
5fe0cfc344 [BugFix] fix readthedocs (#7175)
* fix readthedocs

* update recommonmark
2023-10-09 04:58:27 -05:00
骑马小猫
34e5744ef8 [Bug fixes] Fix experimental llama set_state_dict (#7142)
* use model_type to control model-intialization

* fix llama set_value dtype
2023-10-09 04:31:11 -05:00
Ruibiao Chen
26fdd47c39 Enabel FLAGS_new_executor_micro_batching in AutoEngine (#7168) 2023-10-09 14:28:23 +08:00
xiaoxiaohehe001
0ba34f68f4 support_chatglm_precache (#7109) 2023-10-09 14:16:46 +08:00
lugimzzz
16353f4172 [llm]support lora for quantizationlinear (#7138)
* support quantizationloralinear

* Version compatible

* add comment

* add mp quantization lora

* fix

* fix

* fix
2023-10-08 22:11:31 -05:00
Zhong Hui
68bb39dc90 [GPT] Fix bugs (#7141)
* fix gpt-3

* refine

* remove gpt-3.

* fix ci

* fix

* fix ci
2023-09-28 10:37:52 +08:00
lugimzzz
0db85f7d7f [llm]add quantization tensor parallelism (#7099)
* add quantization mp

* update

* follow comments

* fix

* fix shape

* update
2023-09-27 01:11:38 -05:00
wanly young
685d12bf1a [DistDataLoader]bgroup null judge fix (#7122)
* group null judge fix
* fix all
2023-09-27 11:16:26 +08:00
Siming Dai
6c11dea23e [BugFix] Fix tp load and gpt pp model (#7129)
* fix gpt pp model
* fix tp load
2023-09-26 13:11:52 +08:00
骑马小猫
3cf31e8b29 [New Features] Add test predictor for llm (#7115)
* use model_type to control model-intialization

* add test_predictor

* update inference  & no inference

* update comment

* update test_assert
2023-09-25 22:26:47 -05:00
Zhong Hui
0b73e12232 remove load state as np. (#7120) 2023-09-25 22:26:11 -05:00
Zhong Hui
c1157e5a2a Update trainer.py (#7123) 2023-09-25 02:10:59 -05:00
Zeyu Chen
9c3f8a4256 Update README.md 2023-09-24 11:12:42 -05:00
Zeyu Chen
cc293601a9 Update README.md 2023-09-23 21:22:27 -05:00
Zhong Hui
51835e8ead [LLM] Unify pipeline model with PretrainModelPipe (#7095)
* unify pipeline model with PretrainModelPipe.
2023-09-22 17:58:19 +08:00
zhang junjun
cdc7382c1a [CI] fix llm tests (#7117) 2023-09-22 17:30:05 +08:00
Tian Zheng
060fbf2ff0 [NVIDIA] Add stage2 NCCL kernel overlap (#7092)
* add stage2 comm overlap

* Make stage2 overlap optional
2023-09-22 17:22:56 +08:00
ZZK
73a20bd663 fix benchmark compute statistics (#7098)
* fix args.benchmark and compute statistics

* revert warmup times

* fix cachekv shape and force to use fleet exectuor

* fix merge conflict

* update total_max_length

* add enable memory optim

* fix multi predictor in fleet runner

---------

Co-authored-by: xiaoxiaohehe001 <hiteezsf@163.com>
Co-authored-by: wj-Mcat <1435130236@qq.com>
2023-09-22 16:02:11 +08:00
Yuang Liu
a99cc55960 [Trainer] Support master grad for sharding stage 2. (#7075) 2023-09-22 10:49:15 +08:00
Yiqun Liu
748e69d162 Polish the benchmark scripts and add test for N4C32. (#7105)
* Polish the benchmark scripts and add test for N4C32.

* Update the setteing of pipeline_parallel_config.

* Add the missing comma and rename all the benchmark filename.
2023-09-22 09:30:47 +08:00
骑马小猫
48596fee6b [Bug fixes]fix chatglm2 d2s (#7110)
* fix chatglm2 d2s

* open chatglm2 d2s
2023-09-21 07:12:06 -05:00
w5688414
bcf4427ef9 [Paddle-Pipelines] Add top_k support (#7103)
* Add top_k support

* Update prompts
2023-09-21 03:57:42 -05:00
周周周
17a3d34d6e support opt-2.7 (#7010)
* first commit

* first commit

* remove somen redunant code

* commit

* commi all

* remove my useless code

* make paddlenlp/transformers/opt/modeling.py revert origin

* uopdate # Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.

* remove some unsed symobl in experimental/transformers/opt/modeling.py

* commit

* commit

* fix a bug in generation_utils

* add model_kwargs[past_kv_length]

* add opt in predict.py

* support more batch

* use state_dict.pop && encoder_max_seq &&

* remove ids_remove_padding

* remove self.past_key_value_length

* remove repeate self.hidden_size = config.hidden_size

* do not use past_kv_length

* remove encoder_max_seq
2023-09-21 14:41:40 +08:00
Yuanle Liu
af28006018 [LLM] Support gpt3 fine grained dybatch v1 (#7080)
* support batch_size=1

* support batch_size > 1

* update

* support to_static

* add benchmark for dybatch_preprocess

* fix code style

* fix code style

* fix comment

* update
2023-09-20 20:51:12 +08:00
w5688414
d3c2e4c9c0 Fix function log reptition bug (#7097) 2023-09-20 05:46:08 -05:00
qingzhong1
8a11e7e330 [Paddle-pipelines] Add HNSW support for BES (#7021)
* add hnsw

* update elasticsearch

* update elasticsearch

* update es
2023-09-20 05:30:39 -05:00
w5688414
633db301e6 [Paddle-Pipelines] Add stream output (#7087)
* Add stream output

* Update

* Fix chat bug

* revert

* Add free chat stream support

* Update prompts

* Reformat function calling logic
2023-09-20 05:28:32 -05:00
骑马小猫
a150627577 [New Features] add llm pretrain & lora & sft & prefix_tuning testing scripts (#7056)
* add chatglm finetune

* add llm ci scripts

* add llama llm testing

* update llm testing

* revert chatglm sft-arguments

* revert chatglm sft-arguments

* update llm testing
2023-09-20 04:57:00 -05:00
Chang Xu
d2524ab9ab Support WikiText & Lambada (#7079)
* Support WikiText & Lambada

* Support WikiText & Lambada

* update
2023-09-20 10:56:00 +08:00
Wennie396
f18dcc8868 align config between dy/st and add memory profiler for dy (#6982)
* align config between dy and st

* add memory profiler for dy

* comment tiny fix

* delete config 'vocab_size_divisible_unit' when get_model
2023-09-20 10:50:57 +08:00
lugimzzz
c6e0f7862f [llm]add quantize (#7027)
* add quantize

* fix bug

* bug fix

* fix saving

* bug fix

* fix and add unitest

* update paddle version

* update following comments

* support prefix

* Update paddlenlp/transformers/model_utils.py

* update

* fix

---------

Co-authored-by: DesmonDay <908660116@qq.com>
Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-09-19 21:41:48 -05:00
Sijun He
06b25e3933 limit to 1 function call per round (#7084) 2023-09-19 21:09:32 +08:00
Shijie
5748b69242 [LLM] Fix synchronized memcpy in GPT (#7008) 2023-09-19 16:53:49 +08:00
Zhong Hui
a435f30770 [README] Update OpenWebText2.md (#7078) 2023-09-19 16:53:14 +08:00
Wennie396
321faf3052 add if-else use_new_executor branch (#6897)
* add if-else use_new_executor branch

* no pre-commit reformat

* add () for use_new_executor

* align old executor and new executor loss

* fix outs[loss].shape == () can't get value by outs[loss][-1]

* tiny format fix

* restore the way loss is calculated by new exe

* old executor doesn't have to / accumulate_steps

* dataloader_from_generator add param num_workers=1
2023-09-19 15:40:41 +08:00
Zhong Hui
27e25e6c59 [README] Update llama readme and add tool_helpers as requirement (#7069) 2023-09-19 14:16:28 +08:00
Sijun He
98fbee3074 changes (#7070) 2023-09-18 21:57:27 -05:00
骑马小猫
06764efe6c update paddlenlp_ops (#7071) 2023-09-18 21:57:06 -05:00
zhang junjun
bd3ce88429 [CI] fix-llm-tests (#7066)
* [CI] fix-llm-tests

* update

* Update ci_case.sh
2023-09-19 10:06:00 +08:00
骑马小猫
9c1fe1cfc3 update layername of chatglm (#7073) 2023-09-18 08:36:14 -05:00
Sijun He
40011aed35 Update README.md (#7072) 2023-09-18 07:31:23 -05:00
lugimzzz
da02adde36 [llm]fix bloom tensor parallelism (#7065)
* fix bloom tp

* add comment
2023-09-18 07:16:07 -05:00
Yuang Liu
3bd4bc3daf fuse rope udpate (#6957)
* fuse rope udpate

* remove full level rope

* update

* change to bool value

* update

* update name
2023-09-18 18:10:45 +08:00
Zhong Hui
223909073c [SetUp] Fix set up with pip install -e (#7062)
* fix pip install -e

* fix time
2023-09-18 16:58:23 +08:00
Sijun He
5db3d2a992 Support decode_token for stream generation (#7063)
* styles

* comments
2023-09-18 03:51:17 -05:00
zhang junjun
b732896390 [CI] add_llm_ci_ipipe (#7050)
* [CI] add_llm_ci_ipipe

* update
2023-09-18 16:49:42 +08:00
骑马小猫
7f09a411e9 update inference-model generation-utils (#7059) 2023-09-18 03:02:44 -05:00
w5688414
de6953debb [Paddle-Pipelines] Add function calling examples (#7051)
* Add function calling examples

* changes

* add log console

* update fnction_calling

* update fnction_calling

* update fnction_calling again

* reformat

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-09-18 02:55:56 -05:00
骑马小猫
d7c39ae2da fix hard-code model-prefix (#7048) 2023-09-15 09:06:29 -05:00
Zhong Hui
11dfdac938 [Trainer] Support show paddlenlp commit id (#7047)
* support install with git commit
* support trainer for paddlenlp commit id.
2023-09-15 17:55:38 +08:00
骑马小猫
c4242f3d94 [New features] refactor llm ci testing (#7046)
* add llm ci testing

* update pretrain testing

* convert slow -> default
2023-09-15 17:13:27 +08:00
Sijun He
dee37d8983 raise error if TP > 2 for ChatGLM2 (#7041)
* raise error for tp > 2

* lint
2023-09-15 02:37:33 -05:00
Ting Liu
26255bb4da fix beam search topk bug (#7044)
* fix beam search topk bug

* topk fix

* comment add
2023-09-15 02:31:00 -05:00
qingzhong1
4ac1c3f0eb add BAAI/bge-small-zh-v1.5 model (#7036)
* add BAAI/bge-small-zh-v1.5

* update parallel_retriever.py

* add bge
2023-09-15 02:03:42 -05:00
骑马小猫
9a80fec89b [Bug fixes] Fix typo (#7039)
* use model_type to control model-intialization

* fix typo
2023-09-14 07:22:39 -05:00
骑马小猫
998a041665 [Bug fixes] Fix generate d2s (#6971)
* use model_type to control model-intialization

* fix generation d2s

* enable llama d2s testing

* update generate d2s

* update is_encoder_decoder

* max_length -> max_new_tokens
2023-09-14 04:28:48 -05:00
Ting Liu
fe71c6801f fix cache select bug (#7026)
* fix cache select bug

* update

* lint fix

* fix bug
2023-09-14 00:53:21 -05:00
Sijun He
fd2bed541f changes (#7029) 2023-09-13 22:53:21 -05:00
骑马小猫
7e09afcc0c [Benchmark]change N2C16 -> gbs=64 (#6902)
* change N2C16 -> gbs=64

* update gbs=64 configuration

* update gbs field

* update sharding_degree -> ssharding_parallel_degree

* update llama scripts

* update llama benchmark scripts

* update llama N2C16 scripts

* change N2C16 script name

* update N1C8

* update N1C8 script

* update llama benchmark training strategy

* update N2C16 scripts

* update llama new benchmark training strategy

* update run_benchmark

* update max_step -> max_steps

* update tensor_parallel_config

* update benchmark script

* update base_batch_size

* update training_args

* change order or split

* update default tensor_parllel_config value

* change fp16 -> bf16

* revert requ-dev.txt

* update requirements-dev.txt
2023-09-14 11:31:38 +08:00
Siming Dai
1ef5b94a18 [TensorParallel] Support naive split for lazy safetensors (#7018) 2023-09-14 10:41:19 +08:00
w5688414
6e6301e544 Add embed_documents for ParallelRetriever (#7025) 2023-09-13 08:51:42 -05:00
Ting Liu
405b64c608 fix chatglmv1/2 beam search bug (#7017)
* fix chatglmv1/2 beam search bug

* group beam search fix bug
2023-09-13 07:06:44 -05:00
zhang junjun
97b22f3e6d [CI] add_llm_unittest (#6913)
* [CI] add_llm_unittest

* fix lint

* update

* update

* update

* fix lint

* update

* fix finetune output

* fix lint

* fix predict

* update
2023-09-13 17:44:45 +08:00
lugimzzz
dcad8b0e3d [llm]update tipc setting (#6990)
* update setting

* delete

---------

Co-authored-by: DesmonDay <908660116@qq.com>
2023-09-13 03:15:27 -05:00
qingzhong1
fc0e7e16bd add mulprocessing (#7019) 2023-09-13 16:04:24 +08:00
骑马小猫
83e0b4703a [Bug fixes] fix inference dybatch d2s (#6998)
* fix inference dybatch d2s

* remove encoder-output
2023-09-13 01:53:09 -05:00
laixinyi
a43138bb4b fix T5 readme (#6659)
Support megatron dataset for T5
2023-09-13 11:17:26 +08:00
DrownFish19
d9f1b76773 [GPT-3] fix gpt3 config (#7006)
* fix gpt3 config

* update

* update

* update
2023-09-13 10:39:46 +08:00
ZZK
4a7665dbd1 Fix benchmark bug (#7002)
* fix bug

* fix wint4 convert
2023-09-12 08:21:49 -05:00
xiaoxiaohehe001
f5607336ca [LLM] support bloom dybatch (#7003)
* support_llama

* support_llama

* delete_loss
2023-09-12 08:20:48 -05:00
Sijun He
e49842c816 chatglm2 beam search fix (#7012)
* chatglm2 beam search fix

* changes

---------

Co-authored-by: 刘汀 <wtmlon@foxmail.com>
2023-09-12 07:02:56 -05:00
WangZhen
45d4ee804f Fix bert error in SOT (#6942)
* Fix bert error in SOT

* Format code

* Format code
2023-09-12 19:23:44 +08:00
DrownFish19
d83032de04 [GPT-3]fix fluid for stride_check (#6999)
* fix fluid for gpt

* fix

* update FG CMakeLists.txt

* fix

* update FasterTransformer link
2023-09-12 19:19:44 +08:00
Sijun He
07902f6bd6 Add new models to LLaMA README.md (#6985)
* Update README.md

* changes

---------

Co-authored-by: 刘汀 <wtmlon@foxmail.com>
2023-09-12 06:12:24 -05:00
w5688414
834213c8e6 [Paddle-Pipelines] Update chatpaper UI for fitting aistudio (#7011)
* Update chatpaper UI

* remove unused comments

* remove unused comments
2023-09-12 06:06:12 -05:00
zhaoyingli
b6ad73037f add fusedpass config in yaml (#6986) 2023-09-12 17:33:06 +08:00
w5688414
be61dcefc1 [Paddle-pipelines] remove ui requirements (#6992)
* remove ui requirements

* restore typing_extensions==4.5

* Update requirements

* remove st-annotated-text

* Add ui requirements to readme

* Update
2023-09-12 01:37:33 -05:00
ZZK
264de97e23 Fix fluid to base (#6989)
* fix fluid to base

* revert generation utils

* remove inspect
2023-09-12 10:12:40 +08:00
Siming Dai
77673c19f4 [BugFix] Fix load shard state_dict log (#6991) 2023-09-11 22:50:43 +08:00
liuzhenhai93
660185439a [GPT-3] ppfleetx sep support (#6962)
Co-authored-by: liuzhenhai93 <liuzhenhai@baidu.com>
2023-09-11 19:51:27 +08:00
DrownFish19
60df8dfcf0 Support megatron dataset for ernie-1.0 (#6653)
* fix modeling_pp error

* enable recompute for GPTDecoderLayerPipe

* add data impl for ernie-1.0

* support load megatron dataset for ernie

* fix doc_idx

* update

* format code

* fix

* formated

* fix

* update README.md

* update README.md and train bash

* add import in paddlenlp/data

* update

* update README.md

* update

* update readme

* update

* update

* update data download links
2023-09-11 19:04:44 +08:00
骑马小猫
6e82c908cc [Bug fixes] Fix gradio br newline display (#6980)
* use model_type to control model-intialization

* fix newline in gradio-ui display
2023-09-11 03:09:48 -05:00
Sijun He
033d859b1f max_new_token -> max_new_tokens (#6984)
* max_new_tokens

* default max new tokens
2023-09-11 03:09:20 -05:00
xiaoxiaohehe001
d758792e31 [LLM] support llama precache. (#6975)
* llama_precache

* update predictor

---------

Co-authored-by: wj-Mcat <1435130236@qq.com>
2023-09-11 02:48:55 -05:00
Chenghao Liu
5e250ee158 [Minor Fix] Urgent compatibility fix for “model_zoo/gpt-3” as “paddle.fluid” is already deprecated in Paddle upstream (#6964) 2023-09-11 10:36:34 +08:00
ZZK
fa0ea00bbf Support Weightonly in LLM Inference (#6799)
* add dyquant transformer

* add dyquant modeling

* add quant config

* Remove quant utils

* add arguments for quant type

* Refine arguments

* refine

* fix weight attr

* fix attr

* fix random seed attribute

* fix dy2static error

* remove redundant print

* merge weightonly layer to fused_transformer_layer

* merge dyquant modeling in naive llama modeling

* refine predictor

* fix bug

* Add weightonly support

* remove redundant code

* fix format

* revert stop_generation_multi_ends.cu

* Set InferenceModel use safetensors as False

* fix lint

* fix input dtype

---------

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2023-09-10 15:18:26 +08:00
qingzhong1
bed6fe1428 update chat_table (#6973) 2023-09-08 19:48:22 +08:00
w5688414
ea18e6983a Update llm scripts (#6974) 2023-09-08 19:48:05 +08:00
w5688414
c1e4028103 Add chatglm run_mode with recompute (#6972) 2023-09-08 05:44:08 -05:00
qingzhong1
5c7ba6fb59 [Paddle-pipelines] update chatpaper.py (#6968)
* add translation

* add translation

* add translation

* add translation
2023-09-08 18:32:15 +08:00
骑马小猫
d06252bb62 [Function optimization] refactor predictor & add unittest (#6955)
* refactor predictor & add unittest

* fix force-eos test

* update predictor unittest

* update parameters

* remove hard-code pad-token-id
2023-09-08 03:19:23 -05:00
Zhong Hui
af64a72b0c [Trainer] Fix save model for sharding stage3. (#6966) 2023-09-08 15:53:12 +08:00
w5688414
7a6c68af1d Upgrade pipelines to 0.6.1 (#6969) 2023-09-08 02:52:42 -05:00
Yuang Liu
e77ae17c52 [Trainer] Support master grad for sharding stage1 (#6916) 2023-09-08 14:49:42 +08:00
骑马小猫
490c5d46a9 fix force-eos unittest (#6958) 2023-09-08 13:49:23 +08:00
骑马小猫
4401d2893c [Function optimization] update predictor & inference model (#6951)
* update predictor & inference model

* add force-decoding-eos token logit processor

* update generation __init__
2023-09-07 08:15:42 -05:00
qingzhong1
a6e3ec7c0e [Paddle-pipelines] modify chatpaper.py (#6949)
* update ui

* update ui_1
2023-09-07 17:57:17 +08:00
lugimzzz
694c0bc9b4 add quant save (#6937) 2023-09-07 03:11:08 -05:00
Ting Liu
a7754b01f2 opt support multi gpu (#6943)
* opt support multi gpu

* remove low mem flag

* bug fix, lm_head initialization
2023-09-07 03:10:23 -05:00
liuzhenhai93
cdba8526a0 [Trainer] Support segment parallel group. (#6946) 2023-09-07 15:32:37 +08:00
w5688414
adee5a5251 Add intokens support for chatglm2 (#6941) 2023-09-07 01:24:20 -05:00
Zhong Hui
deeeb13bf0 change .numpy to cpu().numpy() (#6940) 2023-09-07 11:38:32 +08:00
w5688414
22d69688fc Add llama bloomz benchmark (#6911)
* Add llama bloomz benchmark

* restore prepare.sh

* rename bloom

* rename bloomz

* Add requirements

* rename bloomz chatglm scripts

* Update mode to recompute

---------

Co-authored-by: qingzhong1 <zhongq1234@126.com>
2023-09-06 22:22:27 -05:00
周周周
294df07ea6 [Paddle Inference]support miniGPT4's second part dy2st (#6905)
* support miniGPT4

* remove some useless code

* move some function to modeling.py
commit

* 1->self.config.bos_token_id

* remove useless comment

* huifu

* move prepare_input_ids_for_generation to modeling

* LlamaForMiniGPT4InferenceModel

* use model_type
2023-09-07 10:05:33 +08:00
qingzhong1
579d1f947a modify chatpaper (#6935)
* modify chatpaper_1

* modify history
2023-09-06 20:13:49 +08:00
骑马小猫
c59f161920 [New features] Add no bad words logit processor (#6932)
* use model_type to control model-intialization

* add no-bad-words
2023-09-06 04:46:17 -05:00
Ruibin Cheung
ba2a788cff [Feature] profiler utils add record_shapes option (#6871) 2023-09-06 17:11:22 +08:00
qingzhong1
5fec2f4d4a [Paddle-pipelines] update chat_paper.py (#6925)
* update ui

* modify chat_paper.py

* modify chat_paper.py

* modify chat_paper_1.py
2023-09-06 03:05:26 -05:00
lugimzzz
3aca6d500a [llm]rename tipc (#6931)
* rename tipc

* update run_mode
2023-09-06 01:49:56 -05:00
Sijun He
e234892a42 Add _pad to qwen tokenizer (#6930)
* qwen _pad

* styles

---------

Co-authored-by: qingzhong1 <zhongq1234@126.com>
2023-09-06 14:23:56 +08:00
Ting Liu
b34420e4b3 fix empty list indices (#6927)
* fix empty list indices

* code refinement
2023-09-05 23:09:07 -05:00
Ting Liu
e183825ca7 pretrainedModel add gconfig (#6915)
* pretrainedModel add gconfig

* max/min_new_token, bug fix

* deprecate generation_utils

* code refinement

* code refinement
2023-09-05 08:05:12 -05:00
Ruibin Cheung
5fe97bd248 [Typo] fix script and docs typo (#6879) 2023-09-05 08:02:01 -05:00
Yuang Liu
63f654bebc for pp_recompute_interval (#6922) 2023-09-05 07:51:32 -05:00
lugimzzz
b97138aca0 [llm]fix generation evaluation (#6924)
* fix generation

* update

* fix
2023-09-05 07:51:03 -05:00
骑马小猫
8a844d2a21 use model_type to control model-intialization (#6923) 2023-09-05 19:40:39 +08:00
w5688414
116c71ca9c Add llama alibi intokens support (#6921)
* Fix llama alibi attention mask

* Add Baichuan
2023-09-05 04:52:08 -05:00
DrownFish19
0283a6b7c1 [FG] Update FG for latest paddle and cuda (#6812)
* fix FG for new paddle and cuda env
2023-09-05 17:41:26 +08:00
骑马小猫
3a9d41b0db fix next-tokens after update_model_kwargs_for_generation (#6919) 2023-09-05 17:11:07 +08:00
ZZK
19a9207b64 Add LLM benchmark scripts (#6906)
* add benchmark

* fix decode length bug and update stop generate custom ops

* refine comment

* remove annotation
2023-09-05 15:00:35 +08:00
lugimzzz
77443ffc1c [llm]support get last checkpoint (#6914)
* add find last checkpoint

* add intro

* fix quant

* delete overwrite
2023-09-04 22:19:15 +08:00
Yuang Liu
30716e892e add flag (#6910) 2023-09-04 03:00:18 -05:00
Sijun He
59b2bd0e1e remove triage issue workflow (#6907) 2023-09-04 01:34:14 -05:00
DrownFish19
88e90ef8da [GPT3 & LLaMA] Fix collate_data (#6869)
* fix collate_data
2023-09-04 14:22:02 +08:00
西瓜
c765bb2ef7 GenerationConfig, logits_process unittests, streamer(unittests) (#6855)
* GenerationConfig, logits_process unittests

* lisence, comment

* use stopping_criteria in generate

* docstring, hint, code adjustment

* group bs bug fix

* d2s unittest close, bug fix

* cpu dtype matching fix

* disable warning temporary
2023-09-03 23:28:05 -05:00
Sijun He
f0fcd896e7 move import to the top (#6904) 2023-09-03 23:10:01 -05:00
lugimzzz
1b616f5b82 add training (#6899) 2023-09-03 22:36:16 -05:00
qingzhong1
19a6e5da10 [Paddle-pipelines] upgrade to ernie bot sdk for chatpaper (#6898)
* Update chatfile

* Update chatfile

* modify chat_paper

* modify readme
2023-09-04 11:35:18 +08:00
w5688414
2f3eac3e29 [Paddle-pipelines] Add index data parallel support (#6886)
* Add multi thread support

* Update chatpaper index

* Set fixed number_of_shards
2023-09-03 20:23:00 +08:00
Sijun He
7588a216ab styles (#6896) 2023-09-01 18:37:39 +08:00
骑马小猫
4d590ebb48 [Bug fixes] support multi-gpus for gradio_ui (#6893)
* init dist_env before creating model

* add custom warning
2023-09-01 17:48:36 +08:00
lugimzzz
40918aa8e0 fix llama pp (#6894) 2023-09-01 17:47:51 +08:00
lugimzzz
354e85d9dd [llm]support iteratordataset (#6895)
* support paddlenlp2.6

* support lazy
2023-09-01 17:27:42 +08:00
Sijun He
a488002f6b styles (#6892) 2023-09-01 16:36:02 +08:00
lugimzzz
96de1779f5 support paddlenlp2.6 (#6891) 2023-09-01 15:41:11 +08:00
西瓜
78583b2f37 llama beam search fix (#6882)
* llama beam search fix

* close chatglm2 beam search tests temporary

* group beam search fix

* fix group beam search

* add comments
2023-09-01 12:09:32 +08:00
Sijun He
f443bae5c5 Support PyLayer version of Recompute (#6885)
* recompute

* all models
2023-08-31 15:20:10 +08:00
lugimzzz
1426169291 [LLM]add ft benchmark (#6792)
* add ft benchmark

* update

* fix

* fix

* fix

* fix

* rename

* fix

* change batch size

* fix

* run longer

* fix
2023-08-31 14:52:45 +08:00
骑马小猫
a5626f02cd add decode_strategy field (#6868) 2023-08-31 14:07:10 +08:00
Sijun He
f143685fe5 Update .readthedocs.yaml (#6883) 2023-08-31 14:03:23 +08:00
Siming Dai
3b41581502 fix code (#6880) 2023-08-31 10:57:17 +08:00
骑马小猫
4c4ef6147f [Function optimization] Update llama benchmark (#6856)
* update llama scripts

* update llama prepare.sh scripts

* remove train_data_size

* update data_cache

* update N2C16 parameters

* update llama N2C16 config

* update N1C8 scripts
2023-08-31 10:35:06 +08:00
Liujie0926
5623c1a1d5 [gpt-3]update auto benchmark (#6849) 2023-08-31 10:33:26 +08:00
w5688414
2c0b40351c revert llama flash attention (#6876)
* revert llama

* remove proxy
2023-08-30 18:52:10 +08:00
ZZK
43d7b872c8 fix format (#6865) 2023-08-30 14:33:43 +08:00
zhaoyingli
36ebbf5e29 update auto_engine use iterable dataloader (#6862)
* fix auto engine with iterable dataloader in new executor

* fix dataloder batch_size
2023-08-30 14:19:27 +08:00
Siming Dai
3655108a18 fix llm predict (#6870) 2023-08-30 12:18:33 +08:00
w5688414
2aa58d83a6 [Paddle-pipelines] Add hierarchical search examples (#6829)
* Add hierarchical search examples

* Add ranker
2023-08-29 19:49:48 +08:00
lugimzzz
6b617b17f2 support paddlenlp2.6 (#6842) 2023-08-29 19:31:00 +08:00
Siming Dai
df6a5d7a42 [Pretrain BugFix] Fix load file (#6861) 2023-08-29 19:01:39 +08:00
gongenlei
159a96c807 [LLM] Add gradio title and more args (#6859)
* llm supports advertisegen

* add more args for gradio
2023-08-29 17:36:39 +08:00
DrownFish19
facaf0ee06 fix for sharding satge3 (#6858) 2023-08-29 17:35:19 +08:00
Siming Dai
82bc1c64b9 fix llama pretrain (#6854) 2023-08-29 16:35:47 +08:00
Zhong Hui
12a4326ca3 [Trainer] Fix load opt, since load opt to cpu tensor many leak mem. (#6850) 2023-08-29 16:07:54 +08:00
Sijun He
d1433dbf34 Add .skip() API to IterDataset, use .skip() API in LLM finetune (#6845)
* styles

* try to fix readthedocs

* styles
2023-08-29 16:03:30 +08:00
DrownFish19
ac8fb319df [GPT-3] Unify the implementation of gpt (#6705) 2023-08-29 15:33:18 +08:00
Siming Dai
d6815b38de [PreTrain] Add distributed dataloader (#6775)
* add dist data looader

* remove iterable dataset use dist_dataloader

* fix dist dataloader

* change args and add barrier

* fix dataset load

* add dist dataloader for eval

* fix bug

* fix eval bug

* simplify code

* bugfix

* broadcast data keys
2023-08-29 12:57:51 +08:00
Sijun He
4a79dcef4a styles (#6846) 2023-08-29 11:09:47 +08:00
w5688414
c5b78ba373 [llm benchmark] Add llama flash attentions & GPT3 (#6603)
* Add chatglm flash attentions

* remove proxy

* Update benchmark

* Update bloom to flash attention

* Update bloom attention_mas

* remove comments

* remove proxy and unused comments

* Add gpt3 support

* Add sharding3 support for gpt3

* Update gpt3

* Update flash attention

* Update chatglm, bloom flash attention

* remove lm shift labels

* Update bloom attention

* Update chatglm attention

* Update bloom flash attention

* Reformat llama flash attention

* Add gpt3 impl

* Update flash attention & intokens results

* Update bloom impl

* rm gpt config

* revert chatglm bloom

* Update llam

* revert bloom distributed results

* Update llama

* remove position ids

* remove proxy

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-08-29 11:08:40 +08:00
xiaoxiaohehe001
7903bcc80f Support chatglm fine grained dybatch v1. (#6798)
* support_chatglm_fine

* unify_fused_layer

* fix_utils

* delete_model_type

* delete_set_state_dict_external

* fix_useless_log

* add_update_kwags_self

---------

Co-authored-by: zhengzekang <>
2023-08-28 19:17:41 +08:00
Sijun He
71354f8db6 Support Multiple train/dev files in LLM (#6837)
* styles

* changes

* update read the docs

* changes

* fix read the docs
2023-08-28 19:09:46 +08:00
lugimzzz
06c5b71f10 support d2s for rope (#6840) 2023-08-28 19:09:21 +08:00
yujun
3b2b2ba452 [Trainer] Fix timer _git_commit__ (#6833) 2023-08-28 16:44:05 +08:00
qingzhong1
aee044f41c [Paddle-pipelines] update ChatTable (#6813)
* update chattable

* update README

* modify chattable

* modify create_inedex.py

* update chat_table.py

* modify chat_table
2023-08-28 13:39:15 +08:00
zhang junjun
dabcdc064c [CI] fix ernie 1.0 (#6828)
* [CI] Disabled_FG

* fix ernie-1.0

* update
2023-08-28 10:18:00 +08:00
Kunbo Ding
1a69081ed4 [Megatron dataset] Support loading megatron dataset (#6489)
* Adapt to Megatron

* fix_print_dataset

* fix BlendableDataset

* fix BlendableDataset

* fix skip_warmup

* fix

* fix

* fix

* fix

* fix

* fix

* cache fix

* make new dataset

* fix loss mask

* fix model_zoo/gpt

* fix model_zoo/gpt

* fix model_zoo/gpt

* fix gpt test

* fix legacy

* fix legacy

* hf_model

* remove legacy

* merge develop gpt

* fix model_zoo/gpt for megatron

* merge develop

* resolve conflict

* fix check_rank_flag for data_cache_path

* fix check_rank_flag for data_cache_path

* remove hcg

* fix model_zoo/gpt eval
2023-08-25 19:05:13 +08:00
Ruibin Cheung
d012c87065 fix: profiler export path (#6825) 2023-08-25 18:20:26 +08:00
lugimzzz
c9e34e7d2d fix (#6827) 2023-08-25 18:17:54 +08:00
lugimzzz
211e158f48 support iterdataset (#6826) 2023-08-25 18:17:13 +08:00
骑马小猫
5c55a80f7a [Bug fixes] fix fused-transformer nexo rotary params (#6805)
* fix fused-transformer nexo rotary params

* update boundary length

* update max_length & max_batch_size

* remove pdb

* update max-batch-size comment
2023-08-25 15:13:57 +08:00
littsk
ebe8b43e28 set llama pp_recompute_interval default value to 1 (#6823) 2023-08-25 13:38:05 +08:00
骑马小猫
95bfa81ea5 [Llama benchmark]add llama benchmark scripts (#6721)
* add llama benchmark scripts

* update paddle N1C8 N2C16 benchmark scripts

* update n2c16 config

* update scripts

* update model_item

* rename script file name

* update llama benchmark scripts

* update llama pretrain scripts

* rename llama name

* remove trainer nccl init

* update llama benchmark

* fix pretrain bug

* update 2-server config

* rename script name

* add N1C8

* increate value of timeout
2023-08-25 13:27:44 +08:00
w5688414
0cea4d9dd1 [Paddle-Pipelines] Add ernie retriever (#6814)
* Add ernie retriever

* Update comments

* rename example files

* remove redundable parameters

* Add embedding retriever
2023-08-25 13:16:31 +08:00
Ruibin Cheung
1f098e77de [Trainer] Use paddle.device.synchornize to replace paddle.device.cuda.synchornize (#6811) 2023-08-25 10:47:42 +08:00
DrownFish19
b808eb33c4 [Trainer] Fix trainer during saving checkpoints (#6725) 2023-08-25 10:46:20 +08:00
DrownFish19
beb895435b [GPT] Fix seed get error (#6694) 2023-08-25 10:44:28 +08:00
lugimzzz
3fe62a16a9 [LLM]add qwen in readme (#6822)
* add qwen in readme

* add

* update

* fix
2023-08-24 21:34:32 +08:00
Sijun He
704846a090 remove (#6821) 2023-08-24 21:19:31 +08:00
littsk
af59325f7c fix bug for recompute in llm finetuning (#6806)
* fix bug for recompute in llm finetuning

* code refactoring

* fix precition bug

* convert pylayer recompute to hook recompute
2023-08-24 21:05:57 +08:00
Sijun He
bdac333711 Update intokens_dataset.py (#6820) 2023-08-24 20:20:11 +08:00
lugimzzz
39302ed546 [LLM]supoort pp intokens (#6810)
* supoort pp intokens

* unify max_length
2023-08-24 19:59:06 +08:00
西瓜
b701996c66 support qwen in llm module (#6804)
* support qwen in llm module

* add prefix argument
2023-08-24 19:58:00 +08:00
QingshuChen
0c8385c125 replace int64 size with float for xpu (#6819) 2023-08-24 19:51:22 +08:00
zhaoyingli
899c32fb7f update AutoEngine with low api (#6703)
* align AutoEngine to EagerEngine

* tiny fix

* fix validate

* align AutoEngine/GPTModuleAuto to EagerEngine/GPTModule

* align AutoEngine to EagerEngine and fix bugs
fix eval_losses bug
fix pp running error bug
fix valid_data_loader exits abnormally problem
add nvprof
add GPU memory log

* fix train_losses bug in func train_one_epoch and other tiny fix

* increase the eval_freq value otherwise sharding in eval mode has problem

* rm sh

* update logger

* update format

* update format

---------

Co-authored-by: Wennie396 <wn295448@buaa.edu.cn>
2023-08-24 19:18:21 +08:00
zhang junjun
d475b0418b [CI] Disabled_FG (#6809) 2023-08-24 12:33:59 +08:00
Ghost Screaming
7165840bfd Add config for mp_asycn_allreduce. (#6777)
* Add config for mp_asycn_allreduce.

* Polish code.
2023-08-24 11:27:52 +08:00
lugimzzz
5dd0f5d5e5 fix warning (#6801) 2023-08-23 18:42:27 +08:00
Kai Song
e485ebdf3f [TIPC]update tipc configs (#6803) 2023-08-23 16:43:41 +08:00
Siming Dai
271bcd001c [Trainer] Support load sharded ckpt (#6787) 2023-08-23 14:37:39 +08:00
w5688414
0491fb23f0 [Paddle-pipelines] Update pipelines (#6790)
* Update pipelines

* Update chatpaper ui

* remove pooling_mode parameter
2023-08-23 13:33:01 +08:00
Zhong Hui
d1c50ee4b3 fix tp split to all. (#6797) 2023-08-23 00:20:16 +08:00
西瓜
253c1ebd33 qwen init.py (#6794) 2023-08-22 19:35:20 +08:00
lugimzzz
e9b27f3cb4 fix (#6793) 2023-08-22 18:52:41 +08:00
西瓜
306f0e3db2 add QWen (#6719)
* add QWen

* add QWen tokenizer, add generative unittest

* generative unittest dtype unmatch on cpu platform

* add qwen multi-gpu

* remove type id, position id, attention mask standardize

* remove redundant print

* remove pad token hardcode

* model prefix name change

* code refinement: dtype, reshape
2023-08-22 16:05:24 +08:00
zhang junjun
52b88632bc [CI] fix fast gpt (#6783)
* [ci]fix llama

* update

* [CI] update gpt

* [CI] fix fast gpt

* update
2023-08-22 12:03:50 +08:00
lugimzzz
fdf6980dca [LLM]fix peft in trainer & llm readme (#6785)
* fix

* update image

* merge lora & pt code

* update readmeA

* fix intokens
2023-08-22 11:38:25 +08:00
lzy
b3b650c857 supports llama-dybatch-V1 (#6676)
* supports DyBatch-V1

* update dybatch llama

* complete predictor

* complete multi-gpus checking

* complete predictor

* remove experiment fils

* update parallel_matmul y_distributed

---------

Co-authored-by: wj-Mcat <1435130236@qq.com>
2023-08-22 10:06:50 +08:00
haoyuying
c8b930578c [fix bug] argsort does not support bfloat16 (#6746)
* [fix bug] argsort does not support bfloat16

* [fix bug] argsort does not support bfloat16

* [fix bug] argsort does not support bfloat16

* fix bug of TopPProcess

* code style test

* -

* fix code style

* -

* fix code style
2023-08-22 09:52:42 +08:00
lugimzzz
071b26e11d add Llama RoPE scaling (#6743)
* add rotary scale

* update

* fix
2023-08-21 19:10:32 +08:00
Zhong Hui
e0a9f4eb00 [Trainer] Add hybrid_parallel_topo_order options. (#6782) 2023-08-21 13:20:21 +08:00
w5688414
8febfc2455 Update pipelines to 0.6.0 (#6779) 2023-08-21 11:31:14 +08:00
littsk
3bf3e02d3c Add recompute for llama (#6635)
* Add support for more granular recomputation For LLAMA

* Use a dictionary to store computed outputs

* change do_recompute to layerwise_recompute

* code refactoring
2023-08-21 11:30:37 +08:00
qingzhong1
928c59e23c [PaddlePipelines] upload ChatTable (#6768)
* upload chat_sql.py

* upload ChatTable

* upload ChatTable

* upload readme.md

* upload readme.md
2023-08-19 19:23:11 +08:00
骑马小猫
74e3d071ac [Bug fixes] fix llama/bloom/opt/chatglm/chatglmv2 d2s (#6696)
* fix llama d2s

* update llm export

* open llama to_static test

* update path checking

* disable gpu

* complete model d2s

* update arguemnt for predictor & update readme

* update tokenizer attribute

* prevent max_length overflow

* update predictor

* update predictor

* update predictor

* update llm d2s

* update boos-token-id

* update bos_token_id config

* disable chatglm d2s testing
2023-08-18 16:06:12 +08:00
w5688414
3d423c6619 [Paddle-pipelines] Add logging error (#6729)
* Add logging error

* change p_m to num_process
2023-08-18 15:42:40 +08:00
w5688414
de9abfd8d9 [Paddle-pipelines] Update chatpaper&m3e README & debug option (#6769)
* Update chatpaper&m3e README

* Update readme

* Add debug options
2023-08-18 14:59:55 +08:00
zhang junjun
1f5fd52869 [CI] Update gpt2 (#6767) 2023-08-18 14:11:27 +08:00
qingzhong1
6bd7ed8b01 [Paddle-pipelines] update chat_paper.py (#6760)
* update chat_paper.py

* modify chat_paper.py

* modify create_index

* modify create_index_2
2023-08-18 13:28:56 +08:00
xiezheng-XD
2a12b0e50a Update README_en.md to fix a series of spell errors (#6764)
* Update README_en.md

* Update README_en.md

* Update README_en.md

* Update README_en.md
2023-08-18 13:05:59 +08:00
Zhong Hui
00fc1c4449 [LLM] remove llama config in configuration.py (#6765) 2023-08-18 13:04:48 +08:00
lugimzzz
3f0ab8d244 fix (#6756) 2023-08-17 16:26:25 +08:00
qingzhong1
f588966762 [Paddle-pipelines] upload chatfile2.py (#6685)
* Upload  chatfile2

* Upload  chatfile2

* modify chatpaper2.py_1

* modify chatpaper2.py_1

* modify chatpaper2.py_1

* modify chatpaper2.py_1

* update chatpaper q

* update chatpaper

* modify chatpaper

* modify chat_paper

* modify chat_paper_1
2023-08-17 11:33:02 +08:00
Kai Song
d031e49190 [TIPC]update xpu tipc script (#6753) 2023-08-17 10:53:46 +08:00
Liujie0926
d75741bbfa nccl to 2.15,del flag (#6738) 2023-08-16 15:35:05 +08:00
Sijun He
3a5773cbfe Update README.md 2023-08-15 21:27:31 +08:00
qingzhong1
f06e571c62 [Paddle-pipelines] Add ERNIE-Bot-turbo support (#6737)
* modify ernie_bot

* modify ernie_bot again
2023-08-15 21:13:08 +08:00
Sijun He
4353b6447e Update readme for release 2.6 (#6742)
* wip

* update readme for 2.6

* address comments
2023-08-15 21:01:33 +08:00
Sijun He
e8ee455228 release 2.6 (#6739) 2023-08-15 20:39:04 +08:00
骑马小猫
18da50a8ba fix d2s generation bug (#6740) 2023-08-15 20:38:35 +08:00
lugimzzz
98bfddd75f [llm]fix bug in ChatGLM merge tp params and prefix model generation (#6730)
* fix

* fix prefix generation

* fix chatglm tp
2023-08-15 17:15:21 +08:00
Guo Sheng
8c01eebfba Make FG adapt to latest paddle (#6727) 2023-08-15 11:57:11 +08:00
w5688414
71b4c5314d [Paddle-pipelines] Update pipelines examples & update markdown splitters (#6717)
* Update pipelines examples

* Update splitter
2023-08-15 11:32:28 +08:00
zhang junjun
bc8df6ef87 [CI] fix llama (#6720)
* [ci]fix llama

* update
2023-08-14 21:33:00 +08:00
Sijun He
4dfec25bb3 Update README.md 2023-08-14 21:32:27 +08:00
lugimzzz
3272992567 [llm]update LLM readme & add pp sft (#6709)
* update readme acoording to comments

* add pp & delete unused files

* tiny fix

* not support ernie 3.5

* update gpt

* delete unused pad

* add support param

* add opt

* fix chatglm unitest
2023-08-14 21:31:35 +08:00
Zhong Hui
b071870d0a [LLM] Add merge script for merge tp and pp. (#6713) 2023-08-14 17:20:50 +08:00
wanghuancoder
d2c228500e Support stride dy2st (#6712) 2023-08-14 17:17:35 +08:00
Guo Sheng
09329bd614 Fix paddle.no_grad in moe example. (#6715) 2023-08-14 17:09:39 +08:00
Ruibin Cheung
fe262daf73 fix(llama): add pretrained_init_configuration to LlamaConfig (#6710) 2023-08-14 16:37:09 +08:00
yujun
ae777fdd6e rm benchmark args (#6708) 2023-08-14 16:07:06 +08:00
Zhong Hui
e62f3ee670 add safetensors as requirements. (#6704) 2023-08-14 13:07:23 +08:00
lugimzzz
2334b4d07e [LLM]add unify llm (#6695)
* add unify llm

* add

* tiny fix

* delete unused files

* add quant

* add quant

* add json

* pp not yet support

* update according to comments

* add 4d explaination

* fix

* tiny

* update

* tiny

* tiny
2023-08-14 00:28:36 +08:00
Sijun He
46e55512d4 Implement InTokens data stream for ChatGLM (#6701)
* fix styles

* to list

* benchmarks

* ready for PR
2023-08-13 22:16:59 +08:00
Sijun He
262b23a7fb fix intokens (#6700) 2023-08-12 15:56:44 +08:00
Meiyim
ac6f9b7e3a fix loop (#6698) 2023-08-12 01:47:45 +08:00
pangengzheng
870cf8e501 [Trainer] Support reshard save/load for sharding stage1 (#6633) 2023-08-11 21:01:55 +08:00
ShenLiang
f5f47ad00a [Trainer] Fix try import (#6691) 2023-08-11 20:29:07 +08:00
Meiyim
90403785ee [Trainer] Update trainer for more timer info 2023-08-11 17:38:34 +08:00
Sijun He
48db6d42e2 Move LLaMA tipc benchmark (#6689)
* changes

* add tokens and label shift

* styles

* move benchmark
2023-08-11 15:42:28 +08:00
Zhong Hui
dad7b3b801 [Trainer] Fix for compatibility (#6687)
* fix

* fix
2023-08-11 14:34:26 +08:00
lugimzzz
a2b205924c support load_best_model_at_end (#6688) 2023-08-11 14:28:15 +08:00
ShenLiang
e7bfd49807 [Cherry-Pick](#6509) (#6504) (#6684)
* support pp delay_scale_loss and dp_comm_overlap

* [Distributed]Add dp/sharding overlap for pipeline (#6504)

* [Distributed]Support pipelineparallel in accumulation_steps (#6509)

* fix trainer

---------

Co-authored-by: haohongxiang <haohongxiang@baidu.com>
2023-08-11 11:50:02 +08:00
Siming Dai
4728fc645c Remove fluid for llm/gpt3 and model_zoo/gpt (#6664)
* remove fluid

* delete non-trainer gpt

* fix readme
2023-08-11 01:16:04 +08:00
Sijun He
ea89a5d8d4 Fix unwanted fields in InTokens and peft benchmark (#6682)
* changes

* add tokens and label shift

* styles
2023-08-10 21:51:50 +08:00
lugimzzz
d45c7ee7b3 fix chatglm2 pt (#6683) 2023-08-10 17:47:51 +08:00
西瓜
a140e9b802 causallm module support opt (#6680)
* causallm module support opt

* lora target module

* lora target modules modification
2023-08-10 17:36:12 +08:00
Guo Sheng
3133d6ab1a Remove contents in ppdiffusers (#6663) 2023-08-10 16:34:16 +08:00
lugimzzz
8398a5f74a merge peft params (#6678)
Co-authored-by: DesmonDay <908660116@qq.com>
2023-08-10 14:06:12 +08:00
Sijun He
f59274ac8f Remove shift_lm_labels attributes from all models and scripts (#6675)
* test 2.5.1

* turn off more tests

* turn off taskflow tests

* changes

* changes

* changes
2023-08-10 14:04:18 +08:00
Ghost Screaming
40bbcb797e [Trainer] Add time statistics for nccl-connection. (#6673) 2023-08-10 11:42:06 +08:00
西瓜
31a5ff2cbe bloom prefix past-key-value adjustment (#6667)
* bloom prefix past-key-value adjustment

* bloom prefix past kv comment

* remove redundant transpose
2023-08-09 21:48:22 +08:00
陶泽伟
383a219eec eliminate transpose in sequence parallel for llama (#6574)
* Eliminate transpose operation in sequence parallel for LLAMA

* Update configuration.py code refactoring
2023-08-09 20:03:06 +08:00
Sijun He
e7ba623d68 Add position_ids to LLaMA RoPE implementation; Add LLaMA generation unit tests (#6616)
* wip

* add position_ids to RoPE

* debug recompute

* changes

* add dtype
2023-08-09 19:09:46 +08:00
西瓜
c647f74ec5 Chatglm attention mask v1 (#6648)
* Standardize chatglm attention mask

* try add generative unittest

* add generative test, fix bug

* fix dtype unmatch on cpu, remove pdb, print

* chatglm tokenizer test

* data py attention mask

* only support 4D attn mask, unittest adjustment
2023-08-09 17:32:58 +08:00
Leo Chen
25c25cfabe add pp config for auto gpt (#6640) 2023-08-09 15:35:48 +08:00
Siming Dai
50cd55e273 Add ernie-3.5-se export model (#6655)
* add paddleocr stable version

* add export model

* add readme

* add comment

* fix bias
2023-08-09 14:47:05 +08:00
骑马小猫
dcc5f2b1b5 [New Features] update llama2 weight list (#6494)
* update llama2 weight list

* update llama2 model weight list

* Update README.md

---------

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2023-08-09 14:45:38 +08:00
Guo Sheng
3b60bfd657 Remove fluid usage in paddlenlp package. (#6660) 2023-08-09 14:42:35 +08:00
wanghuancoder
ff33e1bbb1 paddle support stride, fix dy2st (#6590)
* paddle support stride, fix dy2st
2023-08-09 11:30:52 +08:00
qingzhong1
31ea95f57a [pipelines benchmark] add T2Ranking_test.py (#6638)
* add T2Ranking_test.py

* add T2Ranking_test.py again

* add T2Ranking_test.py again

* modify T2Ranking_test.py

* add Retrieval_benchmarks.py

* add Retrieval_benchmarks.py

* modify Retrieval_benchmarks.py
2023-08-09 11:08:04 +08:00
w5688414
356811e31b [blip2] Update blip2 to support fp16 (#6597)
* Update blip2 to support fp16

* Update
2023-08-08 21:07:08 +08:00
Zhong Hui
f14efe9782 [LLM] Support llama2 70b (#6622)
* [Llama2] Add support for Llama 2

Co-authored-by: wj-Mcat <1435130236@qq.com>
2023-08-08 20:10:19 +08:00
西瓜
c3946404bc Chatglmv2 attention mask (#6634)
* standardize chatglmv2 attention mask

* benchmark add chatglm2 branch, remove print

* remove pad function in prefix model
2023-08-08 20:00:08 +08:00
Guo Sheng
a732077301 Remove most of fluid usage (#6636)
* Remove fluid usage.

* Fix paddle.nn.Layer doc URL
2023-08-08 19:32:53 +08:00
Sijun He
9680e35cb2 Upgrade GitHub CI to Paddle 2.5.1 (#6642)
* test 2.5.1

* turn off more tests

* turn off taskflow tests
2023-08-08 16:10:59 +08:00
qingzhong1
fc9dae4bfc [Paddle-pipelines] Fix debug logger slow speed bug (#6629)
* modify debug

* modify parallel_retriever

* add config.pbtxt
2023-08-08 13:19:23 +08:00
Yuang Liu
991a9d6fbb [Trainer] Support pp sharding stage 1 overlap (#6643)
* support pp sharding stage 1 overlap

* remove hack prepare_training
2023-08-08 12:52:05 +08:00
lugimzzz
331bf7d67f fix (#6632) 2023-08-08 12:15:23 +08:00
DrownFish19
62b6e8ba57 [LLM] Fix GPT modeling_pp error (#6628) 2023-08-08 11:15:15 +08:00
yujun
8b927a5ece update clip clipseg (#6627)
* update clip clipeg

* cast int32

* update

* fix

* remove attention_mask

* update
2023-08-08 00:27:26 +08:00
lugimzzz
919264a8fc support chatglm2 (#6639) 2023-08-07 22:32:21 +08:00
Sijun He
e3e92afb27 Fix pad token in funetune_generation.py (#6637)
* Update finetune_generation.py

* Update finetune_generation.py

* Update finetune_generation.py
2023-08-07 21:39:18 +08:00
西瓜
c4b102de00 Bloom generative test (#6630)
* bloom add generative test

* fix cache shape bug

* fix dtype unmatch bug
2023-08-07 18:49:58 +08:00
Sijun He
64f97979a6 Update README.md 2023-08-05 17:43:56 +08:00
qingzhong1
4111acdd9e [Paddle-pipelines] Update m3e_retriever (#6613)
* Update m3e_retriever

* Update README_M3E

* modify ParallelRetriever

* add ParallelRetriever

* rename README_m3e.md

* modify parallel_retriever.py

* modify parallel_retriever.py

* modify parallel_retriever.py

* modify parallel_retriever.py
2023-08-05 09:17:59 +08:00
gongenlei
8df1ae8952 [LLM] Add cache perfix for pretraining dataset (#6621)
* llm supports advertisegen

* add cache for megatron dataset

* fix gpt3 GPTPretrainingCriterion

* update name
2023-08-04 18:49:09 +08:00
西瓜
375a5ffcc2 add peft document (#6559)
* add peft document

* update peft.md

* update peft.md

* delete peft.png

* update peft.md

* update peft.md

* update peft.md

* update peft.md

* update peft.md
2023-08-04 16:32:55 +08:00
yujun
ae8b709d8d [benchmark] add proxy when git clone paddlemix (#6615)
* add proxy git clone paddlemix

* add einops
2023-08-04 15:33:38 +08:00
Zhong Hui
722acfdf44 [LLM] Add new tp split merge func. (#6611) 2023-08-04 15:25:46 +08:00
DrownFish19
edef99f338 [LLM] Fix eval error for llm/gpt-3 (#6607) 2023-08-04 14:50:11 +08:00
gongenlei
28375855c5 [LLM] Support parsing json arguments (#6614) 2023-08-04 12:18:21 +08:00
Kunbo Ding
3866817e13 [Megatron dataset] Support creating megatron dataset (#6512)
* create_megatron

* fix & add file

* fix README

* fix docs

* fix README

* fix README

* fix README

* fix --chinese in README

* Abandon paddle.to_tensor
2023-08-04 12:01:53 +08:00
gongenlei
395852a63f Fix ERNIE-1.0 static save (#6612)
* llm supports advertisegen

* fix ernie static training
2023-08-04 11:37:22 +08:00
w5688414
d358d9ac1e [paddle-pipelines] Update document store (#6599)
* Update document store

* Reformat

* Update comments

* Add examples

* Update
2023-08-04 11:27:44 +08:00
Sijun He
dd237db7db bloom (#6610) 2023-08-04 11:25:53 +08:00
Zhong Hui
a657763ad4 [TRAINER] Update trainer.py (#6606)
delete c_embedding
2023-08-03 19:35:55 +08:00
西瓜
6886dbb944 Standardize Bloom attention mask (#6579)
* Standardize Bloom attention mask

* where call optimize

* reshape code optimize

* func name _expand_mask ==> _expand_2d_mask
2023-08-03 19:35:35 +08:00
Sijun He
6f6abf53c7 Implement prefix attention mask for intokens (#6608)
* prefix tuning intokens

* test prefix

* remove prints
2023-08-03 19:33:24 +08:00
Yuang Liu
0c54167480 [LLAMA] Fit paddle framework api update (#6602) 2023-08-03 16:19:34 +08:00
DrownFish19
435cb4f286 [LLM] Optimization for llm/gpt-3 (#6570) 2023-08-03 16:16:48 +08:00
zhaoyingli
69bc66ddf8 fix lr_scheduler useincrement (#6431) 2023-08-03 15:08:13 +08:00
lugimzzz
e5aad866bd add server & ui (#6601) 2023-08-03 14:42:43 +08:00
Sijun He
13249985a9 Add InTokens to llm; Improve InTokens data efficiency (#6552)
* changes

* revert llm

* remove llm-related stuff

* speedup

* eval intokens

* changes
2023-08-03 13:30:00 +08:00
wanghuancoder
c7c65c545c paddle support stride, fix dy2st (#6539)
* paddle support stride, fix dy2st

* refine

* refine
2023-08-03 12:06:29 +08:00
Siming Dai
2ca6938974 Add eb-3.5-se tensor mapping (#6587)
* add tensor mapping for parallel transformer
* change config
2023-08-03 10:48:33 +08:00
Siming Dai
38a2be0287 fix (#6588) 2023-08-02 21:42:15 +08:00
Liujie0926
caaf09d6ce update auto_base for PaddleNLP#6431 (#6589) 2023-08-02 19:50:10 +08:00
Siming Dai
e6b60ba8ae add paddleocr stable version (#6593) 2023-08-02 18:43:18 +08:00
Sijun He
c255d75528 Standardize LLaMA attention mask (#6564)
* changes

* ready for commit

* changes

* changes

* float attention mask

* fix tests

* changes

* move to float mask

* update mask dtype

* changes
2023-08-02 18:20:29 +08:00
lugimzzz
4af5576831 add (#6594) 2023-08-02 18:05:44 +08:00
Chang Xu
af54864a8a Add WeightOnlyPTQ and GPTQ (#6572)
* Add WeightOnlyPTQ and GPTQ

* update

* update
2023-08-02 17:32:12 +08:00
yujun
f91716f052 # fix https://github.com/huggingface/transformers/pull/16946 (#6582) 2023-08-02 16:29:48 +08:00
Siming Dai
6e770820d0 fix fuse linear (#6567) 2023-08-01 14:19:06 +08:00
w5688414
018755fe99 [llm benchmark] Update benchmark (#6529)
* Add sharding stage 3 results

* Update results

* Update results

* Fix tokenizer
2023-08-01 13:36:49 +08:00
gongenlei
df042c403b llm supports advertisegen (#6565) 2023-08-01 11:26:35 +08:00
yujun
3bf38e4c42 disable sd t5 (#6566) 2023-08-01 11:15:00 +08:00
lugimzzz
e8a03e47a5 change (#6562) 2023-08-01 08:27:49 +08:00
Zeyu Chen
918b77fb39 Update README.md 2023-07-31 22:35:43 +08:00
Sijun He
5ac5803d9c revert (#6561) 2023-07-31 20:51:57 +08:00
lugimzzz
6cb0d3a641 fix causallm shell (#6560)
* fix causallm shell

* fix
2023-07-31 20:48:04 +08:00
Siming Dai
921b32d0fc Add ernie-3.5-se (#6556)
* add ernie-3.5-se

* polish readme and code

* fix

* fix optimizer warm start
2023-07-31 19:44:00 +08:00
Zeyu Chen
5693005d79 Update README.md 2023-07-31 19:43:30 +08:00
西瓜
fad2266422 remove is_tp if branchs (#6555) 2023-07-31 14:07:10 +08:00
Liujie0926
a7ba7562f4 [gpt-3]update auto_base (#6531)
* fix auto

* fix moe data_tools

* update ci auto_base

* update auto loss_base for Paddle#55516

* update gpt_auto_pass_o2 loss_base for Paddle ae2d8b..f9e1b2
2023-07-31 12:02:32 +08:00
Sijun He
4ee34d5fc6 Update model_utils.py (#6551) 2023-07-31 11:55:19 +08:00
Lei Xiaopeng
8f137a5474 Update README.md (#6537)
* Update README.md

dev的预测代码
已经支持通过from paddlenlp.transformers import AutoModelForCausalLM, AutoTokenizer 导入
并通过model名字来识别对应的模型导入

* Update llm/llama/README.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-07-31 11:54:05 +08:00
lugimzzz
1030283b44 [llm]causallm shell add test (#6540)
* add test

* add data error
2023-07-28 21:57:57 +08:00
w5688414
c117c2dec2 [llm benchmark] Update intokens results (#6548)
* Update intokens results

* Update parameters
2023-07-28 21:56:34 +08:00
w5688414
26c1df128f Fix ccircle import error (#6545) 2023-07-28 21:55:44 +08:00
lugimzzz
4c997586c1 [llm]gpt3 add lora (#6532)
* add lora

* add readme
2023-07-28 17:22:31 +08:00
西瓜
c93dc9bdc9 add RowParallelLoRALinear (#6528)
* add RowParallelLoRALinear

* forward add allreduce

* fix mapping wrong module name

* remove reduntant comments

* remove x c_indentity
2023-07-28 16:56:16 +08:00
Zhong Hui
2fbfd57c71 [BugFix] Update trainer.py (#6526) 2023-07-28 16:29:40 +08:00
Ruibin Cheung
69ab3c1908 [TRAINER] trainer memory tracker (#6536) 2023-07-28 12:49:30 +08:00
w5688414
7f3c07d415 Update convert_files_to_dicts_splitter (#6533) 2023-07-28 11:43:14 +08:00
Sijun He
9f53cfaf54 changes (#6534) 2023-07-27 22:02:19 +08:00
lugimzzz
5f9cbebc94 [llm]fix unify causal shell (#6527)
* fix llama

* fix
2023-07-27 19:40:57 +08:00
Yuang Liu
237b88d7bf [LLM] Fused grad add for llama (#6484) 2023-07-27 14:27:18 +08:00
w5688414
537665a0af [llm benchmark] Add intokens (#6436)
* Add intokens

* Fix token calculations

* Update effective tokens per second

* Add unitest for intokens

* Update intokens_length

* Add intokens unitest

* remove unused comments

* Reformat intokens implementation

* Remove unused comments

* Update test unitest

* Add intokens for chatglm, bloom,llama

* Fix unitest

* Update comments

* Fix attention_mask

* remove unused comments

* Update tokenizer

* fix bloom tokenizer
2023-07-27 11:09:55 +08:00
Sijun He
bb63581f8d Fix LlamaTokenizer's pad_token; Fix eos_token_id logic (#6520)
* fix styles

* remove prints

* pad token

* add condition

* revert back to unk token
2023-07-27 10:58:03 +08:00
w5688414
4a756ecd2d fix pooling_mode (#6521) 2023-07-27 10:50:51 +08:00
zhang junjun
7fc45f4c07 [CI] fix llama pretrained model (#6519)
* [CI] fix llama pretrained model

* update
2023-07-26 21:24:38 +08:00
lugimzzz
fa4deb371b fix causallm shell (#6514)
* fix

* fix
2023-07-26 18:53:11 +08:00
zhang junjun
4b0d9f8878 [CI] fix paddle conflict (#6518) 2023-07-26 18:28:52 +08:00
Siming Dai
3bf6a9b39e [Hybrid parallel] Add sequence parallel (#6405)
* add sequence parallel

* fix bug

* simplify code

* refine code

* fix seq_len

* support sp with pp

* add sp scripts

* fix bug

* fix sp in pp

* fix sp

* close enable_partial_send_recv under sp

* delete sp args in training args

* delete sh

* fix weight init

* fix llama recompute with alibi
2023-07-26 17:56:53 +08:00
西瓜
108eeb0d15 fix llama recompute bug (#6516) 2023-07-26 17:53:26 +08:00
lugimzzz
49828ebfc5 support chatglmv2 (#6513) 2023-07-26 15:28:17 +08:00
Lei Xiaopeng
98ea040e3a taskflow中text2text_generation支持通过指定model=THUDM/chatglm2-6b使用chatglm2 (#6506) 2023-07-26 14:47:06 +08:00
陶泽伟
d1050f43ef Add fused linear for the LLAMA MLP block and multi-head attention block (#6425)
* Add fused linear for the LLAMA MLP block and multi-head attention block

* Refactor the config name 'fuse_attn_qkv' to 'fuse_attention_qkv' for improved readability and consistency.

* Added a switch for fuse_mlp_linear and improved the organization of the fused linear implementation.

* add tensor parallel mappings for fused linears
2023-07-26 13:31:44 +08:00
Yuang Liu
61c3208aac rope fusion for llama (#6363)
* use rope fusion if avaliable

* add gpu check

* update rope fusion

* update

* update default value
2023-07-26 13:27:39 +08:00
zhang junjun
a6583d818a [CI] check refactor-traing-loop branch (#6463)
* check refactor-training-loop

* [CI] check refactor_training_loop branch
2023-07-26 10:59:13 +08:00
w5688414
7d06fae12d Update multi recall example (#6502) 2023-07-25 20:55:10 +08:00
西瓜
24dd7b35f1 add Baichuan 7B/13B-base/13B-chat (#6500)
* add Baichuan 7B/13B-base/13B-chat

* README.md update

* Remove redundant code
2023-07-25 20:54:26 +08:00
lugimzzz
e32e972528 Unify finetune_generation (#6433)
* unify finetune_generation

* wip

* update

* wip

* add llama

* update

* bloom

* add predict

* rm

* rm
2023-07-25 20:53:58 +08:00
lugimzzz
365d12124c fix bloom (#6496) 2023-07-25 19:20:08 +08:00
Lei Xiaopeng
2a74edcd4a Update predict_generation.py (#6491)
for chatglm2
2023-07-25 19:19:26 +08:00
Yuang Liu
9e4466b3d1 update sharding config (#6457)
* update sharding config

* fix

* fix typo
2023-07-25 16:42:27 +08:00
lugimzzz
d4ac513a56 [tipc]fix llama benchmark (#6487)
* fix

* fix

* fix

* fix
2023-07-25 16:15:47 +08:00
Sijun He
9eb3cd7004 Disable GenerationD2STest (#6477)
* move github actions to paddle 2.5

* fix import

* wj-Mcat

* fix ray tune version

* Update requirements-dev.txt
2023-07-25 12:41:59 +08:00
Guo Sheng
18f0bc0a71 Update PPDiffusers news to redirect to PaddleMIX (#6483)
* Update PPDiffusers news to redirect to PaddleMIX.

* Fix format
2023-07-25 12:08:01 +08:00
duanyanhui
c295a58cde update python version config of npu tipc (#6474) 2023-07-25 10:57:22 +08:00
wawltor
f506d84470 Update README.md (#6480) 2023-07-24 16:59:22 +08:00
wawltor
3fd1834cc6 Add llm gpt3 (#6455)
* add support the gpt-3

* romove the gpt-3 directory

* addd the readme document for llm gpt

* update the infer script

* update the code for the trainer

* update the predict script
2023-07-24 16:11:17 +08:00
Sijun He
d9e1d5f407 fix styles (#6472) 2023-07-24 15:30:54 +08:00
qingzhong1
e803dd132c update sparse.py (#6471) 2023-07-24 13:31:57 +08:00
pangengzheng
588e6b2233 Fix running model with shard group stage3 (#6466)
* run 4096

* implement lm_head with nn.Layer

* polish

* format

* polish

* Update paddlenlp/transformers/bloom/modeling.py

---------

Co-authored-by: pangengzheng <pangengzheng.baidu.com>
Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-07-24 12:38:00 +08:00
骑马小猫
ad85aade42 update llama2 weight list (#6469) 2023-07-23 23:02:45 +08:00
骑马小猫
1796815e81 [New Features] add llama2 weight list (#6468)
* add llama2 weight list in readme

* update model list
2023-07-23 22:50:48 +08:00
Zeyu Chen
45cb0729aa Update README.md 2023-07-23 01:58:45 +08:00
Zeyu Chen
cb0ef02a3b Update README.md 2023-07-23 00:39:12 +08:00
cyk
697fa8f927 fix README.md (#6465) 2023-07-21 18:50:48 +08:00
lugimzzz
b4a2edbb7d fix llama data padding (#6458)
* fix llama

* fix bloom
2023-07-21 17:10:41 +08:00
Sijun He
7c76976f94 Consolidate Recompute usage (#6403)
* fix recompute

* fix examples

* changes

* changes

* commit

* changes

* changes

* address comments
2023-07-21 15:11:51 +08:00
Sijun He
ce8ae28778 Update lint.yml
fetch all commits
2023-07-21 12:08:37 +08:00
yujun
2e32b5ec3e Rename self.dtype -> self.default_dtype (#6423)
* rename self.dtype  self.default_dtype

* rename self.dtype  self.default_dtype
2023-07-21 12:06:31 +08:00
cyk
ee443ad277 fix prompt in README.md (#6447)
'translate Japanese to Python: \n'
2023-07-21 10:53:55 +08:00
lugimzzz
3db52258e0 rm fp16_opt_level (#6450) 2023-07-21 10:39:27 +08:00
Sijun He
a7a5d644ac Add C-Eval scripts (#6453)
* changes

* Update README.md
2023-07-21 10:35:19 +08:00
duanyanhui
3884ba6bde [NPU TIPC] udpate npu tipc configs (#6452)
* udpate npu tipc configs

* fix dist config for npu/xpu
2023-07-21 10:34:34 +08:00
zhang junjun
d3e67b98d4 check refactor-training-loop (#6399) 2023-07-20 19:11:20 +08:00
liuzhenhai93
106ee7c6ca [LLM] Upgrade sharding stage1 for new develop paddle (#6360) 2023-07-20 15:28:38 +08:00
Yuang Liu
eb9c51ab21 Tensor fusion for sharding stage 1 (#6411)
* support sharding stage 1 overlap

* compatibel

* update args

* rename config
2023-07-20 14:05:28 +08:00
Sijun He
7056806190 Update tokenizer.py (#6448) 2023-07-20 12:54:40 +08:00
zhang junjun
7d88b33692 Fix onnx build (#6438)
* fix onnx build

* fix onnx build
2023-07-20 10:49:08 +08:00
lugimzzz
55efa3d3be [chatglm] rename chatglm to causallm (#6444)
* change AutoModelForCalsalLM

* update
2023-07-20 10:48:01 +08:00
qingzhong1
7a3e379737 update Readme.md again (#6442) 2023-07-19 21:17:26 +08:00
qingzhong1
fd5739da76 [paddle-pipelines] Update chatbot again (#6434)
* Update chatfile to piplines

* Update chatfile to piplines and modify retriever

* deleted offline_ann_chatfile.py
2023-07-19 18:53:46 +08:00
lugimzzz
8e27802346 remove old data collator (#6439) 2023-07-19 18:26:56 +08:00
Siming Dai
8dd0f6c368 support more argument settings for scheduler (#6435) 2023-07-19 16:23:01 +08:00
wawltor
125a126359 create the llm directory and remove the example llm model to the llm directory (#6426)
* update the link for the llm

* add the main readme
2023-07-19 14:30:11 +08:00
西瓜
6c6e72bab2 falcon tokenizer Chinese support. (#6414)
* falcon tokenizer Chinese support.

* keyword name modification

* Add OpenBuddy-falcon-7b
2023-07-19 14:26:25 +08:00
wawltor
b5ca5bc767 fix the bloom model evaluation (#6400) 2023-07-19 13:12:32 +08:00
Sijun He
acfd537f3c Support ChatGLM2 Training (FT, LoRA and Prefix) (#6402)
* remove non MQA

* wip

* changes

* changes

* fix unit test; add comments for assign_kv_heads

* address comments

* fix ids int32 -> int64

* wip

* wip

* wip

* ready for PR

* remove lm shift logits

* changes
2023-07-19 10:45:51 +08:00
lugimzzz
08a4393ffa fix llama tipc benchmark (#6432)
* fix benchmark

* fix fp16
2023-07-19 10:37:55 +08:00
Zhong Hui
7c6772b953 [LLM] Llama extend RotaryEmbedding context(Adaptive NTK) (#6312)
* llama extend context.
2023-07-18 16:15:02 +08:00
yujun
f4d2868292 Revert "fp16o1 with custom black list (#6343)" (#6422)
This reverts commit 629d201e1e.
2023-07-18 15:33:31 +08:00
gongenlei
5b96cdc0dd support json parse (#6415) 2023-07-17 18:13:31 +08:00
Zhong Hui
b22b6f8763 [LLM] Fix miss matched size for tie weights. (#6394)
* fix miss matched size for tie weights.

* fix tp

* hack load cpu for zero copy.

* fix paddlenlp load cpu hack

* fix
2023-07-17 16:02:54 +08:00
xuzhang
82ad13d525 【PPDiffuers】super resolution & image2image (#6286)
* add mixture_tiling

* deploy add mixture

* add fd

* add clip_guided_images_mixing_stable_diffusion

* clip_guided_images_mixing_stable_diffusion done

* sd image_variation done

* trim

* compatitable infer add

* code style

* code style

* add no_unet_key

* := ci solved
2023-07-17 14:44:36 +08:00
gongenlei
278102fcea Fix ERNIE-Code import error (#6408)
* fix ernie code import

* update docs
2023-07-17 10:49:32 +08:00
Sijun He
dd44d6f4fc fix log (#6410) 2023-07-17 10:40:54 +08:00
Kunbo Ding
d5ef5482db Add Ernie-Code predict (#6166)
* fix convbert pretrain

* fix convbert pretrain

* fix convbert pretrain

* add ernie-code

* fix

* update

* Some bug

* bugs

* fix

* fix

* fix

* fix

* fix

* fix

* fix

* Update README.md

* Create README.zh.md

* Update README.md

* fix

* fix

---------

Co-authored-by: cyk <13767887+cyk1337@users.noreply.github.com>
2023-07-14 18:44:06 +08:00
Leo Chen
cfbe700a6d change numpy.bool to numpy.bool_ (#6401) 2023-07-14 18:04:11 +08:00
yujun
5a0ac7ef4f [PPDiffusers] add sd train benchmark (#6375)
* add sd train benchmark

* 更新训练

* update default resolution 256

* update

* support snr_gamma and input_perturbation

* 如果训练text encoder可以设置不同的学习率

* update learning rate

* train lr
2023-07-14 17:46:56 +08:00
yujun
14031e839e [PPDiffusers] Update fid clip (#6396)
* 更新clip fid的计算

* update

* upda te
2023-07-14 14:55:00 +08:00
yujun
859a21c34f [PPDiffuers] update vae training (#6320)
* update

* on_train_batch_end

* update

* update ema

* update

* update

* update

* up

* update ema

* update ema

* update ema
2023-07-14 14:50:57 +08:00
Sijun He
62d2c8fa54 Fix Lint in Github Actions (#6374)
* debug ci

* 1

* 2

* 3

* 3

* stuff

* stuff

* commits

* Update get_modified_files.py

* debug
2023-07-14 14:18:38 +08:00
zhang junjun
f498bbe0cd update llms (#6391) 2023-07-14 13:03:56 +08:00
lugimzzz
d3327b585f add cast (#6392) 2023-07-13 20:45:38 +08:00
Sijun He
583e9c058e Support multi-gpu for ChatGLM-v2 (#6373)
* remove non MQA

* wip

* changes

* changes

* fix unit test; add comments for assign_kv_heads

* address comments

* fix ids int32 -> int64
2023-07-13 20:21:30 +08:00
Zhong Hui
818e1a1240 [LLM] Fix tensor parallel merge (#6383)
* fix tensor parallel merge

* fix merge tp.
2023-07-13 14:12:46 +08:00
w5688414
0646056801 [llm benchmark] Add qlora benchmark (#6376)
* Add qlora and fix length benchmark

* Remove fix length benchmark

* Update readme

* remove proxy
2023-07-13 13:49:47 +08:00
西瓜
07e5560f19 Add Falcon single-gpu (#6345)
* Add Falcon single-gpu

* ADD Falcon single-gpu: fix-bug

* ADD Falcon single-gpu: add multi-query arg

* ADD Falcon single-gpu: add parallel_attn arg

* Add Falcon single-gpu: modify some comments

* shift labels, LISENCE, code refinement

* Remove redundant code, adjust unsqueeze

* add falcon-7b-instruct config, remove redundant code

* Code style optimization
2023-07-13 11:24:35 +08:00
lugimzzz
84af93fd85 [llm]fix shift label (#6369)
* fix shift label

* fix lora_path

* update data preprocess

* remove pdb
2023-07-12 21:24:51 +08:00
qingzhong1
9771e733b1 [ernie vil2.0] updata ernie2.0 (#6368)
* updata ernie2.0

* updata ernie2.0 by remove csv

* updata ernie2.0 by remove csv

* updata ernie2.0 by remove csv again
2023-07-12 18:59:07 +08:00
yujun
629d201e1e fp16o1 with custom black list (#6343) 2023-07-12 18:55:08 +08:00
zhang junjun
5e9849a018 fix protobuf confilct (#6365)
* fix protobuf confilct

* update
2023-07-12 17:12:11 +08:00
yujun
833ac42818 添加torch推理测试代码 (#6298) 2023-07-12 11:37:09 +08:00
Leo Chen
c86cb84762 fix python include path (#6347) 2023-07-11 19:46:20 +08:00
Zhong Hui
cbcb362b0f fix tensor parallel merge (#6361) 2023-07-11 18:56:15 +08:00
骑马小猫
6f1c0bcc69 fix attention_mask for chatglm (#6362) 2023-07-11 16:32:35 +08:00
lugimzzz
c33b59ee92 [llm]update llama & bloom &chatglm example (#6329)
* update llama example

* update example
2023-07-11 16:17:58 +08:00
lugimzzz
c2c30e38c2 [llama]fix tensor parallel output (#6344)
* fix tensor parallel

* update
2023-07-11 15:30:09 +08:00
w5688414
6267e9b8df Add bloom detail results (#6336) 2023-07-11 14:49:50 +08:00
zhang junjun
9e6d499255 Fix protobuf conflict (#6351)
* [CI] fix examples api names bug

* fix protobuf confict

* fix protubuf confilct

* fix protobuf conflict

* update

* update
2023-07-11 14:31:38 +08:00
QinghuiWang
9796bbc5fe [BugFix] fix unfinished flag for sampling (#6203)
* fix unfinished flag for sampling

* fix unfinished flag for sampling
2023-07-11 10:47:32 +08:00
Sijun He
a2e45f6558 Update requirements.txt (#6349) 2023-07-10 22:02:57 +08:00
骑马小猫
3c883dfb6c [NewFeature] shift-label features (#6328)
* shift-label features

* enable shift-labels

* improve chatglm convert_example

* update model shift labels

* update shiftlabels
2023-07-10 20:29:38 +08:00
qingzhong1
877c2b2f61 [Paddle-pipelines] update docx and markdown preprocessing (#6334)
* Update docx and markdown again

* modify  docx and markdown

* modify docx and markdown again

* modify docx and markdown again

* add docxtest

* modify test_pdf.py

* modify chat_markdown_example.py

* modify chat_markdown_example.py

* modify pipelines/requirements.txt

* modify tests/requirements.txt

* add test_docx.py
2023-07-10 20:08:38 +08:00
w5688414
4a71e539e9 simplify benchmark parameter (#6333) 2023-07-10 16:40:39 +08:00
duanyanhui
10c8e30e8d [Trainer] Fix rng_state for custom_device (#6332) 2023-07-10 12:07:44 +08:00
zhang junjun
64d7b6949b Fix bos version (#6335)
* [CI] fix examples api names bug

* fix ci
2023-07-10 10:32:21 +08:00
Sijun He
7ddda7bcd4 Update README.md 2023-07-07 12:16:47 +08:00
gongenlei
f3a4055fc3 fix dataset (#6322) 2023-07-07 11:36:29 +08:00
Sijun He
ccc7947c61 Add ChatGLM-v2 single-gpu (#6290)
* wip

* remove redundant tests

* wip

* changes

* remove print

* changes

* new way of slicing swiglu

* add predict examples

* remove load numpy
2023-07-06 21:32:51 +08:00
lugimzzz
04f04fd072 change init (#6321) 2023-07-06 20:57:12 +08:00
w5688414
8f0d2ad32f [llm benchmark] Add inference benchmark (#6257)
* Add inference benchmark

* Update profiler

* Update paddle benchmark

* Update chatglm traningi config

* Add comma

* Update llama results

* Update readme

* Update chatglm and bloomz results

* Fix recompute

* Remove http proxy
2023-07-06 20:07:59 +08:00
duanyanhui
877400821f [npu] fix arange dtype for npu (#6313)
* fix arange dtype for npu

* update
2023-07-06 20:04:04 +08:00
gongenlei
30ce962068 add attention mask (#6318) 2023-07-06 19:43:07 +08:00
QinghuiWang
5d70e83c7d [Minigpt4] Add Split Function for Generate (#6126)
1. Add Split Function for generate into two parts: image encoder and language model, the purpose show as follows:
Matching the work processing with inference.
2. support the scenario that encoding image once and predicting with language many times, such as multi-dialogue scenario.
3. fix bugs, such as paddle.ones_like.
2023-07-06 16:06:51 +08:00
QinghuiWang
83043e3e10 [New Feature] add VisualGLM Model (#6237)
* add visualglm, vit-ready version

* add visualglm, vit-ready version

* add visualglm

* [Bugfix] fix confiuration and drop history in processing
2023-07-06 11:19:12 +08:00
Ruibin Cheung
c90c624964 fix(docs): README.md (#6307) 2023-07-06 11:18:16 +08:00
lugimzzz
5617ffc0bb [qatlora]add qatlora to chatglm (#6284)
* add qatlora to chatglm

* set merge weight True

* set merge_weight True
2023-07-06 11:10:38 +08:00
lugimzzz
1fc5578c9c [LoRAModel]add training parameter (#6305)
* add trainig

* keep training to True when model.quantize
2023-07-06 11:08:43 +08:00
骑马小猫
b9fed028a0 [New Features] add ui demo for llama (#6275)
* add-ui-for llama

* update readme & use_fuse_topp_sampling

* remove init_distributed_env method

* add llama dependency package

* update ci_case scripts

* update ci_case tab
2023-07-05 14:25:54 +08:00
qingzhong1
dbdcf01aec [taskflow]Update SentenceeExtraction-m3e (#6294)
* Add m3e-base model

* Add m3e-base model

* Add m3e-base model

* Update taskflow.md

* Update taskflow.md again

* Update piplines-semantic-search

* Update piplines-semantic-search
2023-07-05 13:13:08 +08:00
w5688414
b34c74f2fb Update llama datacollator (#6301) 2023-07-05 11:01:28 +08:00
Zhong Hui
9b993b25da [LLM] fix low cpu mem device. (#6300) 2023-07-04 22:47:33 +08:00
yujun
aa4a62c0d5 【PPDiffusers】增加FD ControlNet text2img, img2img, inpaint_legacy, hiresfix pipeline (#6234)
* 增加fd contorlnet img2img text2img inpainting pipeline, hiresfix fd pipleine

* update

* update controlnet

* update readme

* update rm

* update fd

* update gpu

* add lpw fix preconfig bug in img2img etc

* 默认使用LPW

* fix inpainting

* 使用老版本的_load_pretrained_model_old
2023-07-04 14:24:09 +08:00
zhang junjun
b69063d5e9 Fix llama (#6291)
* [CI] fix examples api names bug

* fix llama
2023-07-03 17:14:11 +08:00
Sijun He
380b5e71c5 Update README.md 2023-07-03 14:13:32 +08:00
lugimzzz
ca15d6230e [GLUE ]update qat lora (#6278)
* update qat lora

* Update examples/benchmark/glue/run_glue_trainer.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update examples/benchmark/glue/run_glue_trainer.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-06-30 17:39:46 +08:00
lugimzzz
7af4ee3c5d [PEFT]add error raise & fix quanter save (#6283)
* add error raise & fix quanter save

* add test
2023-06-30 17:25:51 +08:00
Zhong Hui
43f4f75a6b fix tp split. (#6279) 2023-06-30 10:35:51 +08:00
lugimzzz
e5023f7c77 fix save (#6271) 2023-06-28 18:54:37 +08:00
骑马小猫
e5331b9b36 fix min-length d2s (#6270) 2023-06-28 18:53:07 +08:00
zhaoyingli
24ac0d7865 add schedule_mode config for pipeline (#6267) 2023-06-28 17:51:04 +08:00
zhang junjun
afadc605f2 Disabled faster transformer& faster generation (#6264)
* [CI] fix examples api names bug

* disabled FT&FG

* update

* update
2023-06-28 17:24:06 +08:00
Linjie Chen
dfa5a968a7 add micro random llama (#6253)
* add micro random llama

* rename

* update model size

* update tests
2023-06-28 17:07:44 +08:00
lugimzzz
d83c99f13f support bit length & dtype (#6268) 2023-06-28 16:33:32 +08:00
qingzhong1
44e5f843cd [ERNIE vil2.0] Update image text retrieval data preprocessing (#6251)
* Update image text retrieval data preprocessing

* Update image text retrieval data preprocessing

* Update image text retrieval data preprocessing

* Update image text retrieval data preprocessing

* Update image text retrieval data preprocessing
2023-06-28 12:03:08 +08:00
Zhong Hui
5ae97dcec2 [LLM] Upgrade from_pretrained/save_pretrained and support shared checkpoint for LLM (#6181)
* tmp

* tmp, should revert.

* tmp fix

* fix import

* init version for save/load shard ckpt.

* fix

* fix tmp.

* add bos_community.

* add tests.

* fix ci

* unify some names

* fix some ci

* fix load bug.

* fix

* fix same bugs.

* support pre split for tensor parallel

* tmp

* fix

* fix tp save

* fix for hybrid parallel model checkpoint.

* add use_safetensors.

* optimize convert dtype.

* fix warnings filter.

* fix load error messages.

* fix as comments.

* fix 0-d 1-d

* support  keep_in_fp32_modules

* fix low cpu mem useage.
2023-06-27 20:36:13 +08:00
lugimzzz
f72aaa169a add glue trainer (#6254)
* add glue trainer

* add qat
2023-06-27 19:34:49 +08:00
lugimzzz
aac1204b38 remove prefix projection (#6261) 2023-06-27 19:31:54 +08:00
Sijun He
fda38e4e52 Update README.md 2023-06-27 15:06:51 +08:00
西瓜
5520ad0f29 [NeZha] fix wrong if statement (#6258) 2023-06-27 14:28:27 +08:00
Sijun He
fe6d9b37e2 .numpy().item() -> .item() (#6232) 2023-06-27 12:52:50 +08:00
Sijun He
31de51c0c1 Update LLaMA benchmarks with distributed training results (#6236)
* update

* update

* add stage 2 config
2023-06-27 11:00:12 +08:00
lugimzzz
d2c83de1cc [QATLora]save quant state_dict & remove merge lora linear (#6247)
* save quant state_dict & remove merge lora linear

* update
2023-06-27 10:50:33 +08:00
骑马小猫
5cc37c118c [Performance optimization] add to_static feature for all generative model (#6186)
* add return_scores flag

* fix generation utils

* improve warning message

* trigger lint ci

* remove expected_ids

* update generation config
2023-06-27 10:49:50 +08:00
Linjie Chen
2577834911 fix uie-x text input (#6252) 2023-06-27 10:45:11 +08:00
yujun
be11bf39b5 [TIPC] attrtdict 替换为 easydict (#6245)
* 使用easydict

* update

* add easydict ci

* use paddlenlp logger

* add

* update
2023-06-26 17:41:56 +08:00
Zhong Hui
b6be897866 [BugFix] Fix warnings filter (#6246)
* Update taskflow.py

* Update taskflow.py

* Update taskflow.py
2023-06-26 17:30:52 +08:00
Zhong Hui
bd4f3e8a5c Update Llama README.md (#6167) 2023-06-26 17:30:12 +08:00
lugimzzz
eac0662557 add merge weight to lora quant (#6243) 2023-06-26 13:52:00 +08:00
骑马小猫
a0142fa879 fix bfloat16 weight loading (#6242) 2023-06-25 15:52:48 +08:00
Sijun He
a7ac8cb035 [PEFT] Implement QuantedLoRALinear (#6214)
* style

* add lora dropout

* address comments

* expand tests

* fix ci paddle version

* fix quant_weight

* fix unit tests

* changes
2023-06-25 15:47:43 +08:00
gongenlei
71d38aa06a [Trainer] Add custom_black/white_list (#6032)
* add custom_black/white_list

* update docstring

* add docs

* update max_evaluate_steps

* rm recompute_granularity

* add amp_white/black list

* update
2023-06-21 17:36:02 +08:00
Sijun He
20c94a2c47 Move GitHub Actions to PaddlePaddle 2.5rc and fix unit tests (#6226)
* fix unit tests

* fix generation utils

* fix tests

* fix tests

* fix einsum

* address comments in test_verbalizer
2023-06-21 16:19:33 +08:00
Liujie0926
905099f329 [gpt-3]fix for nccl&ci (#6230) 2023-06-21 11:39:34 +08:00
xuzhang
56d295dc68 doc refine (#6225) 2023-06-20 21:44:13 +08:00
duanyanhui
873ce025c2 [Trainer] Support chatglm for npu (#6176) 2023-06-20 20:34:46 +08:00
w5688414
0c8055b9d7 [Paddle-pipelines] Release 0.5.3 for pipelines (#6216)
* Release 0.6.0 for piplines

* change to 0.5.3

* Fix unitests

* Remove extra spaces
2023-06-20 15:24:13 +08:00
yujun
225a59ff85 【PPDiffusers】upgrade 0161 (#5908)
* upgrade 0161

* update AttnProcessor and resnet_pre_temb_non_linearity

* add pipelines

* merge from #5908

* update

* update pipeline_cycle_diffusion.py

* add text_to_video_zero

* upgrade pipelines

* upgrade pipelines

* add audioldm and spectrogram_diffusion

* update spectrogram_diffusion

* scheduler done!

* piplines upgrade done!

* upgrade done

* update tests dir

* make tests/others unitest passe

* make pass

* [bugfix] fix tensor typo

* make test pass

* make scheduler passed

* fix set_grad_enabled bug

* pipelines add annotate

* update deepif

* update init.py

* update

* update audioldm

* spectrogram update

* text_to_video_zero_update

* pipelines tests update and pass

* dit pass

* pipelines pass paint_by_example

* update

* t5 with _keep_in_fp32_modules

* update

* ppdiffusers

* resolve conflicts

* update

* update dtype

* fix fp16 upscaler4x bug

* fix paddle.concat

* Add deepfloyd_if unitests 1

* 修复resnet_pre_temb_non_linearity 和 resnet_skip_time_act 同时设置的bug, resnet_pre_temb_non_linearity只有导出的时候才会起作用.

* Add depfloyd unitests

* update dtype place

* Add audioldm spectrogram

* spectrogram

* update fd pipelines

* is_scheduler_support_step_index

* support onnx model

* update fastdeploy pipelines

* update melgan download, support math scaled dot

* rename TokenizerFast->Tokenizer

* Add unitests for audioldm, spectrogram

* Add elise_format0.mid

* Update pipeline_utils

* update audioldm clap pipeline use int32

* Update ModuleUtilsMixin

* Remove unused comments

* tests upgrating

* support bos download fp16 variant

* use ppnlp no_init_weights

* str2bool

* update tome

* add test video

* slow all pass

* remove

* update examples and update lora layer

* fix bug

* update

* update attention processor

* fix bug, make tests passed

* update

* fix fd bug

* update requirements and fix img2img

* 注意 img2img的输入图片需要是0~1, 因此别do_normalize了..

* _save mehtod missing merge_tensor_parallel

* remove fp16 infer test

* add text_to_audio-autdio_ldm

* update spectrogram

* text_to_video_generation-synth

* add text2video zero

* use imageio

* 修复preprocess图片,img2img的时候需要do_normalize! 当前单测可能不过

* add stable_diffusion_controlnet_img2img

* update img2img fast tests

* make img2img passed

* add adapter example

* update download file mapping

* add image_to_image_text_guided_generation-deepfloyd_if

* add text_guided_image_inpainting-deepfloyd_if

* make sure has same dtype

* update reference only's patch attention

* support int

* update from_ckpt download method

* update FeatureExtractionMixin download

* update dep

* 修改webui sd代码,支持controlnet

* update

* update clip model

* update

* update name

* add hf clip model

* 注意下paddle concat的bug....

* refine inference and readme

* add sharp

* detail open

* doc

* readme done

* make it center

* make it center

* modify

* fix versatile bug

* 620

* 删除clap的integration单测

---------

Co-authored-by: westfish <westfish@126.com>
Co-authored-by: Milen <1649759610@qq.com>
Co-authored-by: w5688414 <w5688414@gmail.com>
Co-authored-by: zhangxu44 <zhangxu44@baidu.com>
2023-06-20 14:46:19 +08:00
Sijun He
ff3a938c23 Update README.md 2023-06-20 12:12:49 +08:00
w5688414
ac1419ed8c [Paddle-pipelines]Add BES support for pipelines (#6209)
* Add BES support for pipelines

* Add similarity checks
2023-06-20 11:29:02 +08:00
rogerserper
b57f8bc7b2 [Paddle-Pipelines] Serper.dev search engine provider (Google Search API) (#6192)
* Added Serper.dev search engine provider (Google Search API)

* Added Serper.dev search engine provider (Google Search API)
2023-06-20 10:43:42 +08:00
Sijun He
015c178937 Update Tuning benchmarks with Llama numbers and TODOs (#6208)
* changes

* updates

* undo renaming

* peft dependency

* sync preprocess_fn

* update new llama numbers and TODOs

* edit README
2023-06-19 21:20:25 +08:00
Linjie Chen
eaacaad464 [LLM] Update finetune generation (#6160)
* reorganize code

* delete token_type_ids
2023-06-19 20:57:35 +08:00
yujun
fd0d554020 [BUG Fix] Fix resize embeddings (#6196)
* fix

* update

* feature_extract and image processing support subfolder from bos

* update t5

* update
2023-06-19 20:12:45 +08:00
zhang junjun
9c484e6059 Fix protobuf conflict (#6204)
* [CI] fix examples api names bug

* fix protobuf confict

* fix protubuf confilct
2023-06-19 17:19:24 +08:00
Sijun He
25c65788ec remove config print (#6195) 2023-06-16 17:47:04 +08:00
Noel
90c7813b5a [utc] fix taskflow inference in batch (#6178)
* [utc] fix taskflow inference in batch

* [utc] fix for single-label
2023-06-16 14:10:29 +08:00
Sijun He
8fcedfd8d3 Update PEFT benchmarks (#6187)
* update

* updates

* update

* update

* commit

* wip

* updates
2023-06-15 21:31:06 +08:00
Meiyim
94892fe3c2 [Trainer] Add optimizer-step and read data hooks (#6179)
* add `on-optimizer-step` & `on-read-data` hooks

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2023-06-15 16:50:14 +08:00
Haohongxiang
b9d07da91f [LLM] Fix gpt3 finetune (#6188) 2023-06-15 16:18:20 +08:00
Noel
b73bbbb05c [config] fix unexpected num_choices error for ForMutipleChoice (#6175) 2023-06-15 11:30:36 +08:00
Sijun He
466872bd72 Update Peft benchmarks with distributed training results (#6168)
* update

* updates

* update

* update
2023-06-14 20:20:54 +08:00
Yuang Liu
f687e0d853 [GPT-3] Use paddle's mix precision layer (#6169) 2023-06-14 11:35:26 +08:00
骑马小猫
dc985af6ee [New Features] sync model_utils & generation_utils (#6150)
* sync model_utils & generation_utils

* update generation_utils

* update get_scale by dtype

* update beam_score

* update beam_score

* update beam_search params

* fix client

* fix conflict
2023-06-13 21:25:14 +08:00
Sijun He
15643e3401 Initial PEFT benchmarks (#6147)
* first commit of benchmarks

* move to examples; add argparse

* train and dev file argparse

* add accelerate

* add readme

* add readme

* torch

* fix readme
2023-06-13 19:06:03 +08:00
Sijun He
b94fa44ef1 fix common ancester problem (#6162) 2023-06-13 16:21:11 +08:00
Zhong Hui
817b34a2e2 [Trainer] Update trainer.py (#6153)
* [Trainer] Update trainer.py

* add trainer doc

* fix stage3
2023-06-13 16:20:07 +08:00
lugimzzz
5f5e798244 [bug fix]fix merged lora linear (#6141)
* fix merged lora linear

* fix lora merge linear
2023-06-13 15:05:07 +08:00
Sijun He
89e2f57e7d update README for v2.6.0rc (#6154)
* update README

* update

* 模型并行 -> 张量并行
2023-06-12 17:50:19 +08:00
Linjie Chen
c7ac7d0700 Fix dtype for uie data distill (#6148)
* fix dtype

* update
2023-06-12 17:39:29 +08:00
Sijun He
8ddd9a82e4 Release 2.6.0rc (#6128)
* release 2.5.3

* v2.6rc
2023-06-12 10:50:04 +08:00
w5688414
546fca684c [Paddle-pipelines] Add ReAct zh examples (#6095)
* Add ReAct zh examples

* refactor chatglm

* Add chatgpt agents example

* Add Chinese prompts

* Fix agents dead loop bug

* Add semantic search for ReAct

* Update ReAct_example_cn

* Add ernie_bot invocation

* Add unitests
2023-06-12 10:46:30 +08:00
Noel
c3b921b9ae [chatglm] Formalize tokenizer (#6122)
* [chatglm] Formalize tokenizer

* [chatglm] add missing attributes
2023-06-12 10:42:38 +08:00
Noel
976f8c58b4 Optimize ChatGLM performance (#6104)
* [speed] use cache for rotary embeddings

* [speed] remove repetitive computation

* [speed] remove repetitive computation
2023-06-12 10:40:22 +08:00
zhang junjun
78ee0640ae Fix pytest not found (#6129)
* [CI] fix examples api names bug

* fix pytest not found

* fix pytest not found
2023-06-09 18:39:08 +08:00
zhaoyingli
8c9717a9ec [AutoParallel] add sharding opt config (#6124) 2023-06-08 16:20:58 +08:00
Zhong Hui
ecb2f66676 fix llama pretrain init. (#6116) 2023-06-08 15:21:27 +08:00
Sijun He
a7a7251c3b decoder_weight -> decoder.weight (#6117) 2023-06-08 14:18:00 +08:00
Linjie Chen
0e5875985f add llama bench (#6119) 2023-06-08 11:34:38 +08:00
gmm
e274c447b2 【benchmark】fix new profiler (#6089)
* fix benchmark

* fix static gpt benchmark

* fix benchmark,add run_mode

* fix benchmark

* add benchmark model rpoch

* add benchmark model epoch

* fix benchmark_log

* fix benchmark log

* fix static benchmark

* fix benchmark

* fix benchmark

* update benchmark model name

* fix profiler

* fix

---------

Co-authored-by: zhengya01 <zhengya01@baidu.com>
Co-authored-by: mmglove <gmm_email@baidu.com>
2023-06-08 11:22:33 +08:00
骑马小猫
eef98b6acb [New Features] Add top p sampling (#6120)
* add top-p-sampling support in top-p process

* add top-p-sampling support in top-p process
2023-06-07 21:36:00 +08:00
Liujie0926
3b8e5fe102 [gpt-3]update loss_base for auto (#6115) 2023-06-07 14:20:41 +08:00
Zhang Ting
e831abdd30 disable kernel promotion for amp training (#5922)
* disable kernel promotion for amp training

* improve amp training performance

* fix eval
2023-06-06 20:49:15 +08:00
骑马小猫
5540c0cfbe change condition writing (#6112) 2023-06-06 19:45:28 +08:00
zhaoyingli
d0664604e9 [AutoParallel] Update auto_model ref single model & Add 1F1B (#6049)
* align auto parallel with dynamic graph

* split auto_config auto_utils auto_env

* update entry file

* update yaml ref dynamic graph

* update .sh scripts

* rm FusedDropoutAdd

* rm comment

* fix import
2023-06-06 17:44:30 +08:00
Zhong Hui
bb5ce22b14 Update OpenWebText2.md (#6103)
* Update OpenWebText2.md

* Update README.md

* Update README.md

* Update README.md

* Update modeling_pp.py
2023-06-06 15:55:32 +08:00
LixinGuo
5c2477ee2f modify gpt dateset addr for benchmark (#6110)
* remove tsinghua pypi

* modify gpt dateset addr for benchmark
2023-06-06 15:40:36 +08:00
w5688414
22feca132c [speecht5] Add speecht5 (#6035)
* Add speecht5

* Add audio processing common util

* Update generation utils

* Add unitests

* remove generation utils

* Add missing files

* Add audio dependency

* Update CI dependency

* Remove unused comments

* Trigger docs build

* Trigger docs

* Update copyright

* Update docs requirements

* Fix paddle usage error

* change to pretrained_resource_files_map

* Remove model device

* Remove unused comments

* Update speecht5
2023-06-06 14:48:56 +08:00
yujun
c170670c2e add init (#6108) 2023-06-06 12:22:48 +08:00
yujun
4fa09e30c0 [BUG fix]Fix bert glue bug (#6101)
* fix bug

* update

* update

* add init

* update
2023-06-06 12:01:48 +08:00
Liujie0926
3a01f5fa8e [gpt-3] update CI/Benchmark (#6102)
* [gpt-3]add auto_amp benchmark

* fix

* [benchmark]update static/gpt max_step

* [gpt-3]update auto loss of ci

* fix loss_base

* fix
2023-06-05 19:41:03 +08:00
Milen
3f5737a1a6 [New Feature] Add MiniGPT4 Model (#5989)
1. add MiniGPT4 Model
2. add tests for MiniGPT4
2023-06-05 13:30:49 +08:00
zhang junjun
59739ccbf6 Fix pytest not found (#6088)
* [CI] fix examples api names bug

* fix pytest not found
2023-06-05 10:46:09 +08:00
duanyanhui
a81b79277a [NPU-TIPC] Update npu tipc config and scripts (#6086)
* fix npu tipc config

* update tipc scripts
2023-06-05 10:43:50 +08:00
xuzhang
de8c91d92d [PPDiffusers]Fix 2 power problem (#6090)
* t2i-adapter generate upgrade

* add args

* delete wight and height

* fix 2 power problem
2023-06-02 21:01:51 +08:00
xuzhang
a56d9477e6 [PPDiffusers]t2i-adapter generate upgrade (#6085)
* t2i-adapter generate upgrade

* add args

* delete wight and height
2023-06-02 20:13:16 +08:00
Zhong Hui
5fd7e6b048 [Bug fixes] Fix dtype convert bugs. (#6082)
* Fix dtype convert bugs.

* fix load
2023-06-02 17:48:40 +08:00
lugimzzz
ba76aa2651 [peft]add loraconfig in from_pretrained (#6084)
* add loraconfig pretrain

* add peft in init
2023-06-02 17:13:42 +08:00
Noel
7ddec39b00 [arange] set dtype='int64' explicitly. (#6071) 2023-06-02 16:39:02 +08:00
yangjianfengo1
6c131828d2 修改多个输出的bug (#6069) 2023-06-02 15:17:47 +08:00
Sijun He
09c652a5a0 changes (#6077) 2023-06-02 13:54:39 +08:00
Zhong Hui
935f102328 [LLM] support trainer for gpt and llama pre-training. (#6053)
* support trainer for gpt and llama pretrain.

* update

* fix

* fix use flash.

* support llama pre-train and post-train

* fix

* support use virtual pp degree.
2023-06-02 13:04:20 +08:00
lugimzzz
a37bdfe64e optimize readme (#6070) 2023-06-01 20:20:21 +08:00
w5688414
1d74603fed Fix docs build error (#6072) 2023-06-01 19:53:00 +08:00
LixinGuo
a80c4a2273 remove tsinghua pypi (#6066) 2023-06-01 14:38:50 +08:00
lugimzzz
b0eab857f8 [prefix tuning]add prefix test (#6061)
* add prefix test

* new llama

* fix
2023-06-01 10:54:22 +08:00
w5688414
b927cf701c [clap] Add clap (#6028)
* Add clap

* Add unitest

* Add more unitests

* reformat

* Remove unused comments

* Add copyright info

* Fix return_dict bug

* Update docs

* Add ci requests

* Fix paddle tensor

* Fix floor and repeat

* Fix modeling

* Update comments
2023-06-01 08:07:06 +08:00
Sijun He
b088618584 [Docs] use new readthedocs theme (#6060)
* test

* Update requirements.txt
2023-05-31 21:13:32 +08:00
Sijun He
0c3122efbf Update run_sequence_labeling.py (#6063) 2023-05-31 20:36:53 +08:00
co63oc
24f3bb14a5 Fix typos (#6064) 2023-05-31 20:11:06 +08:00
Sijun He
3e62a6f4bd Update pyproject.toml 2023-05-31 19:33:06 +08:00
yujun
73f153a71b update ldm txt (#6059) 2023-05-31 18:03:38 +08:00
Sijun He
ad0a677554 add model licenses for Llama and ChatGLM (#6056)
* add model licenses

* Update README.md

---------

Co-authored-by: Linjie Chen <40840292+linjieccc@users.noreply.github.com>
2023-05-31 17:12:11 +08:00
yujun
acd7b3f649 [PPDiffusers] Add reference only (#6039)
* add reference only

* add ref readme

* update ref only

* update

* update current_style_fidelity

* use stable var

* update readme

* update
2023-05-31 15:53:50 +08:00
Zhong Hui
442d9acbf5 [GPT-3] add pre commit add rms norm (#6033)
* add pre commit add rms norm

* add pre-commit-config
2023-05-31 15:42:10 +08:00
w5688414
8b96403965 [paddle-pipelines] Add Agents support for pipelines (#5961)
* Add Agents support for pipelines

* Add sseclient dependency

* Add agent unitest

* Add more unitest for prompts

* Add memory support and Add WebQAPipeline

* Add missing memory files

* Add ConversationMemory

* remove telemetry.py

* Add ReAct& ChatGLM Agent example

* Fix unit test error

* Fix BaseComponent import

* Fix BaseDocumentStore

* Add chatglm invocation

* Remove unused comments

* Remove node error config

* Force update pydantic

* Force typing_extensions to 4.5

* Reformat
2023-05-31 14:45:47 +08:00
Sijun He
815991e904 Consolidate LoRA and Prefix into Peft package (#6051)
* [chatglm] ignore warning for inv_freq and lm_head (#6046)

* [Bug fix] fix LoRA unsync parameters issue (#6048)

* fix styles

* remove extra print

* fix styles

* remove old lora

* fix imports

---------

Co-authored-by: Noel <25607475+LemonNoel@users.noreply.github.com>
2023-05-31 11:45:16 +08:00
Sijun He
c8b47a699b disable (#6050) 2023-05-30 21:51:24 +08:00
Sijun He
699f73a5fe [Bug fix] fix LoRA unsync parameters issue (#6048)
* fix styles

* remove extra print
2023-05-30 21:10:52 +08:00
Noel
84a9548e5a [chatglm] ignore warning for inv_freq and lm_head (#6046) 2023-05-30 16:40:45 +08:00
lugimzzz
1d776a6b48 change save type (#6044) 2023-05-29 19:11:24 +08:00
lugimzzz
2b53d2127f [prefix tuning]change past_key_value save shape (#6042)
* change past_key_value save shape

* change

* chage
2023-05-29 16:55:38 +08:00
Zhong Hui
a44ef4f446 [LLM] llama fix pad, support pp with attn_mask. (#6030) 2023-05-29 11:29:41 +08:00
lugimzzz
dda4c60ef0 fix chatglm generation (#6027)
* fix chatglm generation

* fix
2023-05-25 20:50:15 +08:00
Qinghua Zhang
01efa61be0 glm-readme add lora (#6021) 2023-05-25 20:49:15 +08:00
Zhong Hui
ab766a4c60 [Trainer] pipline remove extra accumulate (#6017)
* remove extra pp stage + main-grad

* use main grad to amp_master_grad.

* optimize some pipeline parallel useage.

---------

Co-authored-by: chenxuyi <chenxuyi@baidu.com>
2023-05-25 17:18:08 +08:00
Qinghua Zhang
ed2948018c Add PretrainedConfig for Gpt3 (#6012)
* Add PretrainedConfig

* modefied

* modefied other files
2023-05-25 14:29:20 +08:00
xuzhang
2ae133891c non unified sample (#6019) 2023-05-25 14:11:19 +08:00
yujun
640d4be015 [Benchmark] add ldm benchmark (#5993)
* add ldm benchmark

* bs 8 -> 16
2023-05-25 11:46:07 +08:00
Sijun He
3def881f29 [Bug Fix] Fix LoRA init issue under MP (#6016)
* allow bf16

* fix lora init issue
2023-05-24 23:58:03 +08:00
Zhong Hui
aa1926898d Update run_pretrain_mp.py (#5995) 2023-05-23 21:09:04 +08:00
Sijun He
3a62bf0aba fix data loader (#5999) 2023-05-23 19:21:36 +08:00
Sijun He
635b272b64 fix big bird (#6001) 2023-05-23 16:54:11 +08:00
xuzhang
72b3166b03 Update requirements.txt (#6004) 2023-05-23 16:15:32 +08:00
Qinghua Zhang
3b2b7e45e5 Add Prefix and Lora Parameters (#5930)
* modefied prompt and predict

* add prefix and lora

* modefied

* modefied

* modefied and add do generation

* modefied acc metrics

* modefied acc metric

* modefied readme

* add ppl
2023-05-23 16:09:22 +08:00
Sijun He
02fbd04521 [Bug fix] fix train.py in examples/machine_translation/seq2seq (#5997)
* fix seq2seq

* fix styles
2023-05-23 13:11:00 +08:00
yujun
d5ab5d20b0 fix gpt2 bug gpt3 save pretrained bug (#5967) 2023-05-22 22:46:12 +08:00
Zhong Hui
e2215098dc return tensor for compatible with bf16 (#5992) 2023-05-22 19:55:46 +08:00
lugimzzz
b554227b3b fix chatglm acc (#5987) 2023-05-22 19:54:45 +08:00
Submerge
3a9f5fd436 On branch ControlNet-v1-1 (#5951)
* On branch ControlNet-v1-1
Changes to be committed:
	new file:   ../../ppdiffusers/examples/controlnet/gradio_ip2p2image.py
	new file:   ../../ppdiffusers/examples/controlnet/gradio_mlsd2image.py

* Changes to be committed:
	modified:   ppdiffusers/examples/controlnet/README.md
	modified:   ppdiffusers/examples/controlnet/gradio_ip2p2image.py
	modified:   ppdiffusers/examples/controlnet/gradio_mlsd2image.py

* Changes to be committed:
	modified:   ppdiffusers/examples/controlnet/README.md
	new file:   ppdiffusers/examples/controlnet/annotator/shuffle/__init__.py
	modified:   ppdiffusers/examples/controlnet/annotator/util.py
	renamed:    ppdiffusers/examples/controlnet/gradio_mlsd2image.py -> ppdiffusers/examples/controlnet/gradio_shuffle2image.py
2023-05-22 18:39:15 +08:00
gmm
9dc4434f70 【benchmark】update benchmark model name (#5973)
* fix benchmark

* fix static gpt benchmark

* fix benchmark,add run_mode

* fix benchmark

* add benchmark model rpoch

* add benchmark model epoch

* fix benchmark_log

* fix benchmark log

* fix static benchmark

* fix benchmark

* fix benchmark

* update benchmark model name

---------

Co-authored-by: zhengya01 <zhengya01@baidu.com>
Co-authored-by: mmglove <gmm_email@baidu.com>
2023-05-22 18:38:25 +08:00
yujun
164896107f update txt2imglaion400m support v_prediction (#5971) 2023-05-22 10:14:09 +08:00
Sijun He
2d7889896e upgrade layoutlm (#5964) 2023-05-19 17:56:16 +08:00
w5688414
a0cdff3cfc [chatglm] set default max_seq_length to 2048 (#5970)
* set max_seq_length to 2048

* Add THUDM/chatglm-6b-v1.1

* Add chatglm v1.1 config
2023-05-19 17:46:00 +08:00
zirui
3642ec52b7 fix the issue of ernie-layout model inference error cause by invalid… (#5866)
* fix the issue of ernie-layout model inference error cause by  invalid input of image (without ocr results), refer issue:#5865

* fix format check of pre-commit

* modify ppocr2example to fix bugs caused by empty ocr input
2023-05-19 16:48:37 +08:00
骑马小猫
fa44cdcbc3 [Docs] update opt readme (#5860)
* update opt readme

* update opt readme & makefile
2023-05-19 10:59:27 +08:00
w5688414
c1b753e9ce [chatglm] Fix chatglm token eos bug (#5963)
* Fix chatglm token eos bug

* Convert eop_token_id to eos_token_id
2023-05-18 22:52:09 +08:00
xuzhang
c2d1a30240 doc update (#5962) 2023-05-18 20:30:41 +08:00
zhang junjun
f0edb34b74 Fix protobuf conflict (#5960)
* [CI] fix examples api names bug

* fix protobuf confict
2023-05-18 20:22:43 +08:00
gongenlei
d3a1a9d0ca distributed_scaler/distributed_model/distributed_optimizer for MP/TP (#5956) 2023-05-18 19:25:29 +08:00
xuzhang
09cd6aded7 version change (#5957) 2023-05-18 18:13:06 +08:00
yujun
18cdabf159 [Bug] 修复benchmark的bug (#5954)
* updte

* update
2023-05-18 17:39:52 +08:00
xuzhang
65912cdadb [PPDIffusers] Add T2I-Adapter and COCOeval (#5387)
* update

* add example

* update new

* change

* update

* update

* update readme

* update

* lint1

* lint2

* lint3

* lint4

* update

* update

* upgrade codes and add new eval scripts

* update

* update

* update

* update

* update

* update

* update

* update

* down_nonlinear_temb fix

* unclip fix

* data_preprocess_reduce
2023-05-18 16:37:03 +08:00
parap1uie-s
140752d288 Enable input_embeds for ChatGLM / ChatGLMForConditionalGeneration (#5775)
* Enable input_embeds for ChatGLM / ChatGLMForConditionalGeneration

Fix typo and minor bugs to enable the input_embeds input rather than input_ids

* Update modeling.py

* Update modeling.py

* Update modeling.py
2023-05-18 16:07:23 +08:00
Sijun He
86f1dda5b3 fix (#5952) 2023-05-18 15:59:03 +08:00
yujun
dd11b56eaf use_cache False (#5948) 2023-05-18 13:20:07 +08:00
Sijun He
36591ab297 fix styles (#5947) 2023-05-18 13:05:13 +08:00
lugimzzz
715c159a47 support lora prefix tuning for load_best_model_at_end and resume (#5943) 2023-05-17 21:05:12 +08:00
Kunbo Ding
d902a580e8 [ConvBert] fix examples (#5925)
* fix convbert pretrain

* fix convbert pretrain

* fix convbert pretrain

* Update run_pretrain.py
2023-05-17 21:03:52 +08:00
Linjie Chen
e6a9cee8e7 [Trainer] fix stage3 (#5937)
* fix distributed training

* fix
2023-05-17 17:02:29 +08:00
lugimzzz
c346ea8cf2 bug fix (#5936) 2023-05-17 16:02:11 +08:00
w5688414
432534e4e4 [blip2]Fix inputs embedding batch_size bug (#5932)
* Fix inputs embedding batch_size bug

* Fix key error
2023-05-17 15:51:17 +08:00
Qinghua Zhang
6996333725 Add Prefix for LLM (#5919)
* add_prefix

* modefied
2023-05-16 10:54:18 +08:00
骑马小猫
c765dc98c6 [New features] refactor install-package (#5923)
* refactor install-package

* update package-name

* fix lint
2023-05-16 09:08:13 +08:00
lugimzzz
2cb0d141a8 [chatglm]school math without prompt (#5918)
* without prompt

* load best model
2023-05-15 20:21:51 +08:00
Linjie Chen
868b549c66 [LLM] Add llama weights (#5900)
* add weights

* fix
2023-05-15 16:46:48 +08:00
jm12138
28208c77f9 [BugFix] Fix max_position_embeddings (#5914) 2023-05-15 14:22:29 +08:00
Zhong Hui
6da10f9b6f [BugFix] Fix configuration dtype load (#5911) 2023-05-15 14:20:18 +08:00
Zhong Hui
e3fad6f1cf [Trainer] Fix amp usage for lookup_table. (#5907) 2023-05-15 14:19:57 +08:00
Sijun He
6995c5d3cc Update utils.py (#5910) 2023-05-15 10:55:28 +08:00
Tokounmpo
0a486447d9 [ConvBert P0 P1 P2] Add PretrainedConfig, unit tests and input_embs (#5886)
* [ConvBert P0 P1 P2] Add PretrainedConfig, unit tests and input_embs

* fix

* fix 'test_resize_embeddings'
2023-05-13 11:36:13 +08:00
w5688414
9ed2d66e0c [paddle-pipelines] Add chatglm for pipelines (#5898)
* Add chatglm for pipelines

* Add markdown support for convert_files_to_dicts

* Add chatglm support for multi recall

* Add chatpdf multi recall example

* Fix ci bug

* Add unitest for chatglm

* Add the missing test files
2023-05-13 11:35:07 +08:00
Sijun He
af191a1e79 Fix PretrainedConfig issues in fast transformer (#5904)
* fix fast transformer

* changes
2023-05-13 11:33:44 +08:00
lugimzzz
477c704bb8 add save infer result (#5909) 2023-05-13 11:33:15 +08:00
lugimzzz
c3da2fe74e fix prefix tuning (#5902) 2023-05-12 12:33:22 +08:00
lugimzzz
4db38c4de2 [lora prefix tuning]unify dtype (#5894)
* unify dtype

* fix dtype
2023-05-12 10:55:47 +08:00
Milen
565397c632 Add stable diffusion hire.fix pipeline (#5802)
add StableDiffusionHiresFixPipeline
2023-05-12 10:40:48 +08:00
yujun
803b48968e 【Benchmark】update bert pretrain (#5895)
* update bert pretrain

* add cinn optition
2023-05-12 10:37:00 +08:00
Sijun He
5a2682f4a5 [DO NOT MERGE] fix 0-d tensor CI (#5863)
* test

* style
2023-05-11 18:36:16 +08:00
w5688414
7ffd03e55b Add more parameters config for chatglm (#5896) 2023-05-11 18:35:49 +08:00
Sijun He
8e4087126c fix cblue ci (#5888) 2023-05-11 11:56:10 +08:00
wuhuachaocoding
3849e09bce Fix seed conflict bug. (#5885) 2023-05-10 13:04:52 +08:00
Qinghua Zhang
aed52d89d9 add_llama_export_lora (#5887) 2023-05-10 12:47:11 +08:00
Linjie Chen
9362d39fba [LLM] Fix llama static infer (#5857) 2023-05-10 12:07:28 +08:00
Jade Peng
d66ab8ecd7 TextSimilarityTask support onnx (#5841)
* TextSimilarityTask support onnx

* Update text_similarity.py

---------

Co-authored-by: w5688414 <w5688414@outlook.com>
2023-05-10 11:52:42 +08:00
Sijun He
4de53b4310 Fix HF-related subfolder download issues (#5871)
* fix subfolder

* changes
2023-05-10 11:52:18 +08:00
duanyanhui
97101ec8ae [NPU] update npu infer api (#5818)
* update npu infer api

* add gpu config for tipc
2023-05-10 11:37:28 +08:00
Qinghua Zhang
2ee198907c add_lora_for_bloom (#5881) 2023-05-10 11:11:40 +08:00
Yichen Zhang
80cc85956c [MoE] fix the bug when using 0-D tensor in MoE model (#5538) 2023-05-09 21:26:28 +08:00
Linjie Chen
dd1da392e6 fix wordtag infer (#5876)
* fix wordtag infer

* update params
2023-05-09 17:08:10 +08:00
zhiboniu
b7246e1ac8 gradio depth,normal,hough ok (#5873) 2023-05-09 14:39:50 +08:00
Qinghua Zhang
4a83c565fa Add Lora for Export (#5786)
* glm_export_add_lora
2023-05-09 14:14:20 +08:00
lugimzzz
f640bf44b2 fix save pretrain (#5875) 2023-05-09 11:52:53 +08:00
wjx-sudo
abd83743b8 fix glm & t5 README (#5819)
* fix glm & t5 README

* fix comments

* fix comment

* fix bugs

* fix bugs

* fix t5readme

* add dataLink
2023-05-08 19:52:33 +08:00
w5688414
af76663b47 Add taskflow support for chatglm (#5864)
* Add taskflow support for chatglm

* Add more parameter configurations

* format text generation
2023-05-08 19:01:11 +08:00
Linjie Chen
8e0a383476 [LLM] Add Instruction FT (#5833)
* add instruction ft

* update readme

* remove

* fix comments
2023-05-08 18:42:28 +08:00
lugimzzz
b18d672709 [chatglm]add acc for tuning (#5844)
* add acc

* fix
2023-05-08 17:56:20 +08:00
Qinghua Zhang
68a551a14d Modefied Bert_md5 (#5867)
* modefied_bert_md5

* modefied_bert_config_md5
2023-05-08 17:54:37 +08:00
Roc
d2810c10c6 update (#5870) 2023-05-08 17:03:33 +08:00
Roc
1bb39c6449 fix loss (#5846) 2023-05-08 14:58:46 +08:00
Zhong Hui
a05a1c3342 [LLM] Fix 0d concat, fix pp config, add _from_config. (#5858)
* add _from_config

* fix trainer pp bugs

* fix 0d concat.
2023-05-08 14:23:25 +08:00
houj04
19ac480600 [XPU] update loss, dropout, triangle for xpu (#5843) 2023-05-08 10:29:15 +08:00
骑马小猫
ade8a04be7 [Bug fixes] fix readthedoc urllib3 version dependency (#5849)
* fix readthedoc urllib3 version dependency

* fix doc requirements
2023-05-07 18:03:37 +08:00
lugimzzz
dd20cd43e2 [prefix tuning]save past key values (#5829)
* add past key value

* fix

* add

* fix format
2023-05-07 18:02:51 +08:00
骑马小猫
c9e4fd728e [Bug fixes] fix bloom eval (#5809)
* fix bloom eval

* update bloom run_eval.py scripts
2023-05-06 10:45:46 +08:00
lugimzzz
90cbb21f22 add belle finetune (#5836) 2023-05-05 17:50:56 +08:00
Milen
856175124b fix paddleocr compatibility issue. (#5831) 2023-05-05 17:08:07 +08:00
骑马小猫
af9eea757f [New features] add multi stop tokens features (#5794)
* add multi stop tokens features

* add test for get_unfinished_flag

* add generation testing sample

* add generation testing sample

* update default use_cache args

* fix unfinish flag

* update more testing

* fix decoded checking
2023-05-05 14:03:27 +08:00
ELLIOTT
9a8769e7f3 [Fnet P0]add PretrainedConfig and unit test (#5780)
* add PretrainedConfig and unit test

* fix
2023-05-05 10:58:19 +08:00
骑马小猫
08dd8eed10 [Bug fixes] update init_weights for examples & model_zoo (#5784)
* update init_weights for examples & model_zoo

* update config md5sum

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-05-04 23:35:08 +08:00
Sal Saromines
2f4ffa6495 [Translation] Update on README_en.md (#5816)
* [Translation] Update on README_en.md

Doing a community job for English developers and updating the translations for README_en.md.

If you have any questions or problems, feel free to ask. 👍

* Update README_en.md

* Update README_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update README_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update README_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update README_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update README_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update README_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-05-04 17:31:52 +08:00
houj04
358ce430f3 [XPU] update is_fused_matmul_bias_supported for xpu (#5820) 2023-05-04 17:04:45 +08:00
lugimzzz
53b2ea0d33 [lora] fix lora load and save (#5796)
* fix lora

* add comment
2023-05-04 16:21:54 +08:00
Alpha Hinex
30390b2c5e Fix typo (#5815) 2023-05-04 11:36:38 +08:00
lugimzzz
abb705e650 add load save prefix (#5797) 2023-05-04 11:32:08 +08:00
Zhong Hui
93e78c2f3f [LLM] Support pipeline parallel for llama model. (#5755)
* init for llama  pipeline.

Co-authored-by: chenxuyi <chenxuyi@baidu.com>
2023-04-28 16:01:35 +08:00
Noel
7586abb414 [LLM] GLM fix 0-dim tensor (#5808) 2023-04-28 14:15:56 +08:00
yujun
687265014b [PPDiffusers] add webui version of text2img and controlnet (#5647)
* add webui version controlnet

* fix hf download

* support lora

* update download

* add enable_lora option

* update

* display supported Lora

* update
2023-04-28 12:59:33 +08:00
骑马小猫
d7a059b2f9 [New features] Add opt examples (#5444)
* update opt examples

* update opt examples

* add opt finetune & export & infer & export

* update opt readme & data

* add auto-converter and parallel layer

* complete opt mp logit

* update opt examples

* update opt testing

* update lor config

* update opt exampls

* update opt unit testing

* update opt test-modeling

* update md5sum
2023-04-28 12:03:51 +08:00
Sijun He
a443998a5f fix ernie health cblue (#5792) 2023-04-27 23:43:12 +08:00
zhiboniu
a9fec1f460 add annotator depth&normal (#5779) 2023-04-27 14:10:23 +08:00
骑马小猫
acb292bb7d [Bug fixes] fix flask-babel dependency (#5791)
* fix flask-babel dependency

* fix protobuf dependency

* update readthe docs requirements

* fix doc requirements

* update aiohttp dependency

* update numpy dependency

* update h11 dependency

* update tiny-bert-random md5sum
2023-04-26 20:25:51 +08:00
lugimzzz
182ae45903 fix lora unitest (#5790) 2023-04-26 16:48:39 +08:00
zhiboniu
885f4fef6f add hough line detector (#5781)
* add hough line detector

* update

---------

Co-authored-by: jerrywgz <jerrywgz@126.com>
2023-04-26 10:40:18 +08:00
lugimzzz
caf8720c0f [prefix tuning]add prefix mp (#5774)
* add prefix mp

* fix

* fix
2023-04-25 14:43:58 +08:00
wangxinxin08
a8e065acd1 add ade20k config for segformer (#5773) 2023-04-25 14:01:14 +08:00
lugimzzz
1e43b64a1b [lora] load merged parameters as mp (#5769)
* add dtype & lora model load merged parameters as mp

* fix

* delete unused print

* no need add dtype

* add comment
2023-04-25 11:17:42 +08:00
kangguangli
77e60d6e6f add flag for gpt3 hybird_parallelelism (#5761) 2023-04-25 10:39:23 +08:00
Shuangchi He
d030c63210 Fix some typos. (#5709)
* Fix typos for applications/

Signed-off-by: Yulv-git <yulvchi@qq.com>

* Fix typos for doc/ and pipelines/

Signed-off-by: Yulv-git <yulvchi@qq.com>

* Fix typos for examples/ and ppdiffusers/

Signed-off-by: Yulv-git <yulvchi@qq.com>

* Fix typos for model_zoo/ and paddlenlp/

Signed-off-by: Yulv-git <yulvchi@qq.com>

* Update for copyright_checker.

* Fix error with *.md toc.

---------

Signed-off-by: Yulv-git <yulvchi@qq.com>
2023-04-24 16:18:12 +08:00
wjx-sudo
8fb58ebd6f Add instruction data from belle (#5718)
* Add instruction data from belle

* add databuilder

* resolve some question

* fix oom & belle url

* fix prediction_loss_only
2023-04-24 16:11:58 +08:00
Linjie Chen
2cb2441a07 scale before matmul (#5762) 2023-04-24 15:31:32 +08:00
Feng Ni
e70e9d8284 Support UniDiffuser model and pipeline (#5487)
* unidiffuser initial version

* add 7 example codes

* refine codes

* simplify codes

* fix caption_decoder uvit from_pretrained

* unified all pipelines in one UniDiffuserPipeline

* fix set_timesteps

* fix preprocess and some hpyparams

* fix scheduler params

* delete sub-pipeline

* add unittest

* fix sub-pipeline

* add einops in ppdiffusers/requirements.txt

* fix encode_prefix

* unidiffuser dpm solver++

* fix dpmsolver++ for unidiffuser

* refator

* layer_norm

* missing use_beam_search

* fix center_crop and remove CFG

* support xformers

* support purge float16

* skip_special_tokens

* update import UVitModel

* remove einops dep

* update dummpy

---------

Co-authored-by: yujun <573009727@qq.com>
2023-04-24 14:36:10 +08:00
骑马小猫
fc5b9b17e1 disable warning in pytest (#5767) 2023-04-24 13:27:47 +08:00
Meiyim
46f6b8023d [BugFix] hyper parallel failed with > 128 workers (#5765) 2023-04-24 12:09:59 +08:00
w5688414
2b92fd22ec [paddle-pipelines] Add chatpdf&chatmarkdown examples (#5760)
* Add chatpdf chatmarkdown examples

* Remove unused comments

* Update chatmarkdown

* Fix grammar mistakes
2023-04-24 10:44:21 +08:00
Meiyim
d021d992bb [bug-fix] trainer inf detection (#5758) 2023-04-23 17:59:36 +08:00
lugimzzz
841ca0d9f8 [prefix]add prefix tuning (#5753)
* add prefix tuning

* fix
2023-04-23 16:37:27 +08:00
Linjie Chen
1bff13e1ca [LLM] fix training (#5687)
* fix loss func

* fix paddle zeros

* fix

* fix

* fix

* remove amp disable

* fix

* fix training

* adjust

* d2s val

* add dtype for export

* update

* fix

* fix
2023-04-23 10:29:08 +08:00
Linjie Chen
71d3e0142d fix taskflow (#5727) 2023-04-21 21:51:47 +08:00
Sijun He
68052b179f changes (#5733) 2023-04-21 21:07:12 +08:00
Sijun He
6f4ea6eb62 changes (#5747) 2023-04-21 21:06:36 +08:00
w5688414
ac37c7bced [paddle-pipelines] Add Chinese PDF preprocessing & text splitter (#5738)
* Add Chinese PDF preprocessing

* Add preprocessor test units

* Remove unused comments

* Add splitter preprocessing

* remove merge_sentences

* Update test_pdf unitest

* Add copyright information
2023-04-21 19:00:43 +08:00
Wenbo Yang
4b8c0c4e89 BugFix: GPTChineseTokenizer.get_vocab() not implemented (#5736)
* BugFix: get_vocab() not implemented

Raising NotImplementedError exception when calling GPTChineseTokenizer.get_vocab().

* Fix lint error

* Fix isort

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-04-21 17:05:02 +08:00
Meiyim
2731d96f40 [BugFix] fix resume rng-state file check (#5741) 2023-04-21 16:05:06 +08:00
Sijun He
c41d314893 [Bug fix]fix breaking tests due to loss item change (#5740)
* fix breaking tests due to loss item change

* changes
2023-04-21 14:57:23 +08:00
lugimzzz
5f51585455 [lora]add lora to chatglm (#5742)
* add lora to chatglm

* add bleu4
2023-04-21 14:49:53 +08:00
骑马小猫
256c5e79f4 [Function optimization] fix bloom bf16 supporting ops (#5606)
* fix bloom bf16 supporting

* fix tensor-degree merge

* add c_embedding op to black-list

* disable c_embedding in bf16

* support topk bf16

* fix finetune amp

* update generation for bf16

* update sampling for bfloat and topk=1

* fix lint

* fix dtype checking
2023-04-21 14:03:36 +08:00
Noel
d46114f356 [glm] fix repeated generation (#5730) 2023-04-21 11:17:15 +08:00
Sijun He
48a37795a5 fix (#5734) 2023-04-21 11:16:05 +08:00
w5688414
7d48f0eba8 [paddle-pipelines] Add chatbot pipeline example (#5710)
* Add chatbot pipeline example

* Add pipeline conversations

* refactor erniebot for applying ak sk

* Fix ernie bot unitest issue

* Optimize chatbot_example
2023-04-20 17:05:04 +08:00
Noel
8d2400e36d [LLM] Fix ChatGLM and set default generation arguments for GLM (#5724)
* [chatglm] delete layernorm dtype convertion

* [glm] update default parameters

* [glm] fix penalty dtype

* [example] update readmes
2023-04-20 15:17:23 +08:00
骑马小猫
feb7c0569a update sentiment analysis model (#5725) 2023-04-20 12:11:05 +08:00
ELLIOTT
ef2cac13e4 [Funnel P0]add PretrainedConfig and unit test (#5705)
* add PretrainedConfig and unit test

* fix

* Update modeling.py

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-04-19 14:56:32 +08:00
骑马小猫
740fb2d36d update llama autoconverter (#5699) 2023-04-19 14:11:59 +08:00
骑马小猫
0518ce63a4 [New features] enable bf16 dtype in paddlenlp (#5708)
* enable bf16 dtype in paddlenlp

* trigger license/cla
2023-04-19 14:11:04 +08:00
Noel
b0a7946fe6 [glm] support skip_special_tokens in decode (#5703)
* [glm] support skip_special_tokens in decode

* [glm] fix slow test_modeling

* [glm] remove duplicate special tokens
2023-04-19 12:54:06 +08:00
骑马小猫
d7d3f83b6c [Bug fixes] update inherited function checking (#5664)
* update function checking

* reconstruct all init_weights

* update init_weights -> _init_weights

* update tie_weights

* fix tie-weights

* fix lint
2023-04-19 12:00:27 +08:00
Sijun He
49b9d5785c Update pyproject.toml 2023-04-19 11:09:01 +08:00
Noel
5bc6aa81b0 [chatglm] add unittest (#5701) 2023-04-19 10:40:03 +08:00
Haohongxiang
6a3a14bf92 [GLM/GPT3] Fix bugs in modeling of GLM/GPT3 (#5607)
* fix glm modeling

* update

* update

* update
2023-04-19 10:27:21 +08:00
Noel
ef1d1f9385 [utc] fix post-process for compatibility (#5706)
* [utc] fix post-process for compatibility

* [utc] update condition
2023-04-18 20:24:25 +08:00
Sijun He
a5dfb37f92 [pipelines] Add EB and History class API; Add example chat pipeline (#5686)
* changes

* fix stream

* history

* changes

* fix history

* changes
2023-04-18 19:55:43 +08:00
Sijun He
38a23dadf7 Update tests.yml 2023-04-18 19:55:04 +08:00
骑马小猫
ea777ba057 [Function optimization] default target_name is source_name (#5696)
* default target_name is source_name

* make target_name defualt value is None

* refactor all _get_name_mapings

* fix roberta name_mapping
2023-04-18 19:31:08 +08:00
xuzhang
6105b7e092 update (#5689) 2023-04-18 14:38:12 +08:00
Noel
ce5fe7e982 [chatglm] add __init__ (#5698) 2023-04-18 11:22:36 +08:00
Sijun He
7110ff367b Run GitHub tests only when there is changes in paddlenlp or tests (#5674)
* less ci

* changes

* test examples
2023-04-18 10:48:25 +08:00
zhenyun
e33118a4af add use_fused_dropout_add for gpt3 (#5683) 2023-04-18 10:47:17 +08:00
wjx-sudo
a567f2a116 [LLM] Add t5 Pre-training and support tensor parallel (#5378) 2023-04-18 10:31:55 +08:00
Noel
15d0bedfbe [LLM] Add ChatGLM (#5543)
* [chatglm] init version

* [chatglm] model architecture

* [update] align commit 9324de7

* [chatglm] forward and generation aligned

* [chatglm] remove resource file

* [chatglm] add model state

* [chatglm] adapt for mp

* [chatglm] aligned mp forward

* [chatglm] add finetune and checkpoint to check generation

* [chatglm] fix generation shape error

* [chatglm] add prediction script

* [chatglm] fix recompute

* [chatglm] feasible export

* [chatglm] export ok, infer dtype error

* [chatglm] use dtype instead of paddle_dtype

* [chatglm] fix shape error during inference

* [chatglm] standarize modeling (to check)

* [chatglm] check succeed

* [chatglm] rename finetune script

* [chatglm] remove external type cast

* [chatglm] move modeling and tokenizer to transformers

* [chatglm] aligned with 4e8efe

* [chatglm] update readme

* [chatglm] update readme

* [chatglm] update readme

* [chatglm] update readme
2023-04-17 20:37:52 +08:00
zhang junjun
8256c7a012 Fix electra export model (#5694)
* [CI] fix examples api names bug

* [CI] fix question_matching datasets

* Update ci_case.sh

* fix electra export_model

* fix codestyle

* fix codestyle

* fix codestyle
2023-04-17 20:03:15 +08:00
wawltor
4032ccc4be add the flash attention for the llama (#5653)
* add the flash attention for the llama

* add the support for the autocast

* update the float16

* update the code for auto_cast
2023-04-17 11:52:14 +08:00
骑马小猫
fa4d961092 [Bug fixes] update bloom tp computation (#5657)
* update bloom tp computation

* update tensor_parallel_degree > 0
2023-04-17 10:40:31 +08:00
Linjie Chen
a7b6adb01f [LLM] update ignore_index (#5671)
* update ignore index

* update

* fix
2023-04-17 09:28:20 +08:00
wjx-sudo
d9924bdac9 squeezebert & layoutxlm p0升级 (#5637)
* squeezebert & layoutxlm p0升级

* fix comments

* fix layoutmoxlm deling test

* fix layoutxlm configuration
2023-04-15 13:53:15 +08:00
sneaxiy
8fae7623f9 fix gpt setup (#5676) 2023-04-15 13:51:13 +08:00
Sijun He
b4f3629d43 [Pipelines] add basic ci and unit tests to pipelines (#5673)
* add tests

* changes

* changes

* changes

* add paddle
2023-04-15 13:49:18 +08:00
megemini
9aae2ff998 【Hackathon 4th No.102】给AutoConverter增加新的模型组网的支持 CLIPModel (#5595)
* [Add]Add CLIPModel to AutoConverter

* [Change]Change text/vision projection mapping

* [Delete]Delete clip/converter.py
2023-04-14 19:02:26 +08:00
megemini
65db5e5497 【Hackathon 4th No.102】给AutoConverter增加新的模型组网的支持 AlbertModel (#5626)
* [Add]Add AlbertModel to AutoConverter

* [Change]Add classifier.bias to suppress warning

* [Fix]Fix AlbertForQuestionAnswering name mapping

* [Fix]Fix lint style
2023-04-14 17:41:05 +08:00
megemini
7a6baa71ee [Add]Add DistilBert to AutoConverter (#5672) 2023-04-14 17:34:19 +08:00
megemini
9d2552878a 【Hackathon 4th No.102】给AutoConverter增加新的模型组网的支持 Bart (#5668)
* [Add]Add Bart to AutoConverter

* [Delete]Delete bart/converter.py
2023-04-14 17:30:18 +08:00
Sijun He
52aa271613 changes (#5669) 2023-04-14 17:29:34 +08:00
megemini
848f5c1ccd [Add]Add Electra to AutoConverter (#5658) 2023-04-14 13:46:14 +08:00
lugimzzz
638c7953ab [Lora] support lora model train and eval (#5667)
* support  lora train and eval

* fix restore
2023-04-14 13:45:57 +08:00
Aurelius84
413fd2fd5f [Dy2St] Decorated Monkey Patch Function With @not_to_static (#5645) 2023-04-14 11:49:21 +08:00
lugimzzz
a6c247d549 add lora mp load and save (#5659) 2023-04-14 11:05:31 +08:00
Linjie Chen
5f01f073ed [LLM] Add predict generation and fix causal mask (#5656)
* fix attn_mask

* rename

* add predict_generation
2023-04-13 23:14:47 +08:00
Sijun He
d85ee65a37 restore model api (#5654) 2023-04-13 21:27:26 +08:00
westfish
4e303bb513 [PPDiffusers] tiny fix (#5639)
* update

* rerun
2023-04-13 19:59:32 +08:00
Sijun He
aef101acc0 Use our own Linear layer for easier tie_weights; Fix resize_token_embeddings API (#5623)
* linear linear

* add linear

* styles

* changes

* things

* changes

* bias

* changes

* fix artist and ctrl

* codegen

* changes

* address comments

* fix dtye
2023-04-13 19:44:49 +08:00
Sijun He
5effd1d276 Transformers upgrade: deprecate legacy from_pretrained and save_pretrained (#5307)
* changes

* update
2023-04-13 18:50:04 +08:00
骑马小猫
376891bd3a [Bug fixes] update dtype variable init (#5646)
* update dtype variable init

* update dtype checking

* update dtype

* remove low_cpu_mem_usage

* update dtype guard
2023-04-13 17:32:11 +08:00
Zhong Hui
08a00059ee [BugFix] Update run_pretrain_static.py (#5636) 2023-04-13 17:29:45 +08:00
yujun
f8f2441a4b [PPDiffusers] Fix config cache (#5644)
* update config subfolder

* miss []

* donot use paddlenlp dtype use paddle_dtype

* paddle_dtype

* dtype

* dtype

* local_files_only we will not need newwork, folder_names we will not download None
2023-04-13 13:07:46 +08:00
invokerbyxv
a863d0091c fix [Errno 13] Permission denied in windows (#5622)
* fix [Errno 13] Permission denied in windows

* formatting code

* formatting code
2023-04-13 12:08:12 +08:00
Linjie Chen
156bf88ff7 [LLM] update llama parameters (#5611)
* llama update

* update

* fix unit test

* fix lm_head

* del

* update

* update

* fix

* fix

* fix

* parallel loss

* remove

* remove

* update

* fix

* fix

* fix

* Update README.md

* Update README.md

* update d2s
2023-04-13 10:23:36 +08:00
骑马小猫
cfb8a03665 update bloom config (#5635) 2023-04-13 00:34:02 +08:00
yujun
28a81b3252 release 0141 (#5628) 2023-04-12 21:13:01 +08:00
yujun
c8d323cc32 [PPDiffusers]t2v_support_fp16 (#5631)
* support fp16

* fix storage_offset bug

* fix bug

* cast this to int

* config auto savepretrained
2023-04-12 21:12:45 +08:00
yujun
14aeaa9aff [PPDiffusers] add webui pipeline (#5586)
* add webui pipeline

* update redme

* update

* update

* update custom pipeline revision

* update
2023-04-12 13:14:42 +08:00
yujun
3ee90fa04d [PPDiffusers] update text2img_laion400M (#5619)
* update

* update
2023-04-12 11:57:25 +08:00
westfish
d6e316af07 [PPDiffusers]add t2v model (#5529)
* add t2v model

* update

* update

* add hf copyright

* update it all

* update
2023-04-12 11:37:17 +08:00
骑马小猫
d7336d9f98 [New Features] disable init-weights when lazy-init float16&bfloat16 (#5545)
* disable init-weights

* update modeling init_weights

* fix model utils

* run under the base model
2023-04-11 19:16:24 +08:00
lugimzzz
feec3f42f2 add trainable modules (#5612) 2023-04-11 19:11:16 +08:00
Sijun He
a3627c06ff Update tokenizer.py (#5613) 2023-04-11 19:10:56 +08:00
wawltor
0173fc2320 Update README.md 2023-04-11 16:26:16 +08:00
wawltor
8bea1a9098 support the pure fp16 (#5597)
* support the pure fp16

* fix the attention probs for the bloom

* fix the bloom readme
2023-04-11 13:11:10 +08:00
wawltor
d0921dd27e Update server.md 2023-04-11 12:46:14 +08:00
cyber-pioneer
be3e5eaf93 add arg num_workers for ernie3.0 (#5598) 2023-04-11 11:22:30 +08:00
zhiboniu
37e520565a ppdetpose test ok (#5470)
* update pose model by ppdetpose in controlnet to improve performance

* add model auto download
2023-04-11 11:03:10 +08:00
ShenLiang
229056b6ad [BugFix]fix bug of seed conflict (#5590)
* fix bug of seed

* fix bug of seed

* fix seed
2023-04-11 10:59:33 +08:00
骑马小猫
8403350506 fix loading numpy ndarray (#5593) 2023-04-11 09:55:21 +08:00
wawltor
c2f7e310f5 add the pure fp16 (#5591) 2023-04-10 21:22:43 +08:00
Zhong Hui
6d1c1636a3 [LLM] Fix GLM amp useage. (#5556)
* check glm

* fix bugs.

* fix bugs

* support merge_tensor_parallel for predict_generation.py

* fix loading with dtype.
2023-04-10 15:20:56 +08:00
Sijun He
e5ea39845e Fix prompt head shape due to tie weights (#5571)
* changes

* working

* ernie tie_weights works

* remove prints

* working

* bert

* changes

* changes
2023-04-10 14:50:59 +08:00
Zhong Hui
ae66645f4f [GPT-3] Fix jit with os.getenv (#5583) 2023-04-10 14:49:09 +08:00
Weilong Wu
6ec9a10eca fix neg shape under to_static+prim mode (#5389) 2023-04-10 11:39:25 +08:00
yujun
8eb03fdb23 [PPDiffusers] add tomesd (#5507)
* add tomesd

* update 0140post

* update type hind fd.c

* update version

* rm .to(cuda)

* update readme

* sum->add

* update

* update MIT license

* update tomesd

* 同步faff0eca8e
2023-04-10 10:49:57 +08:00
wawltor
0224912de4 fix the underfit problem (#5574)
* fix the underfit problem

* add the no grad for the bloom predict
2023-04-09 18:34:56 +08:00
Sijun He
d461885463 fix ernie (#5568) 2023-04-08 15:26:53 +08:00
Sijun He
706e5d6a41 [GPT-3] inference bug fix (#5567)
* bug fix

* benchmark
2023-04-07 17:34:30 +08:00
vivienfanghuagood
f9d9fd7176 revert npu device map (#5566) 2023-04-07 16:53:29 +08:00
ELLIOTT
c682b3f311 [Luke]add PretrainedConfig and unit test (#5560)
* add PretrainedConfig and unit test

* fix
2023-04-07 16:06:13 +08:00
骑马小猫
7a03b840f1 [New features] enable dynamic community download url (#5544)
* enable dyanmic community uri

* add test for dynamic community

* update downloader testing

* update downloader url prefix

* update test_downloader url

* remove simple downloader test code
2023-04-07 16:05:26 +08:00
yujun
87ccc16c0f [PPDiffusers] remove patch size pt (#5565)
* remove patch size pt

* fix paddle.cat
2023-04-07 15:54:22 +08:00
vivienfanghuagood
5b2490c317 [GPT-3] fix auto_engine and eager_engine, add inference script (#5563)
* add_gpt_dev

* add sys path

* add

* add
2023-04-07 15:10:53 +08:00
yujun
951bc76d53 [benchmark] fix bertqa and PPMiniLM tests bug (#5562)
* fix

* fix

* fix reformer
2023-04-07 14:17:10 +08:00
Liujie0926
ea43846cde [gpt-3]update auto loss_base for #5511 & fix ci_bug (#5554)
* [gpt-3]fix ci bug

* fix

* update auto loss_base fot PR #5511
2023-04-07 13:37:40 +08:00
wawltor
18299d75e7 fix the predict problem for bloom (#5558) 2023-04-07 10:22:25 +08:00
wawltor
e5ac57be89 fix the recompute oom (#5555) 2023-04-06 22:25:06 +08:00
wawltor
0d1cba43ca update trainer for bloom (#5518)
* add the trainer for blooom

* update the code
2023-04-06 20:58:37 +08:00
Chitsing KUI
98878e5251 fix rm api is_compiled_with_npu (#5553) 2023-04-06 20:27:28 +08:00
Sijun He
f9cc3ec045 [Generation] Remove __get_attr__ shortcut that gets attribute from config (#5527)
* changes

* fix transformers __get_attr__

* fix

* fix transformers
2023-04-06 17:33:43 +08:00
骑马小猫
8737f682fc [Bug fixes] fix generation cache bug (#5535)
* fix generation cache bug

* update beam_search & group_beam_search method
2023-04-06 16:51:41 +08:00
qiuwenbo
019ce128b7 【PaddlePaddle Hackathon 4】[103] 新增tie_weights能力 代码和单元测试 (#5193)
* [103] 新增tie_weights能力 提交rfc文档

* [103] 新增tie_weights能力 提交rfc文档 v2

* [103] 新增tie_weights 能力 提交rfc文档 v3

* [code] 添加tie weight 函数以及单侧 初版

* [code] 完稿

* [103] 添加上了 只检查以CausalLM或者MaskedLM结尾的模型的逻辑,可以稍微改变一下模型代码来满足tie_weights的要求

* [103] 将包含 MaskedLM: CausalLM 两种结构的模型 进行tie_weight的实现检查

* [103] 优化代码风格 clint

* [103] 尝试解决black 问题

* [103] 撤回对reformer模型修改

* [103] 针对绑定和不绑定的两种情况的适配

* [103] test black

* [103] 修改bug

* [103] 测试

* [103]  修改promot的单侧
2023-04-06 15:58:04 +08:00
Sijun He
59a3db8532 filelock (#5548) 2023-04-06 15:16:42 +08:00
sneaxiy
4f260bf9c7 fix flash attn and core attn recompute bug (#5541) 2023-04-06 13:31:22 +08:00
Linjie Chen
1c8a4f13bc [Llama] support trainer finetune (#5441)
* llama lora

* update loss

* update criterion

* fix

* add bleu-4

* fix mp bugs; mp should work now

* support ParallelCrossEntropy

* tensor parallel support

* fix metric

* fix

* squad finetune

* left padding

* update

* update export model for squad

* Update README.md

* update metric

* update infer example

* update infer

* add result show

* move to transformers lib

* add unit test

* fix

* fix ci

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-04-06 11:00:45 +08:00
lugimzzz
2ee2948da5 fix dataaug test (#5532)
* fix dataaug test

* decrease length
2023-04-04 19:13:53 +08:00
lugimzzz
95475e395d 【lora】add ColumnParallelLoRAMergedLinear (#5530)
* add mp lora mergedlinear

* Update lora.py

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-04-04 18:26:44 +08:00
Jiaqi Liu
17d066448b [PPMiniLM P0] Add PretrainedConfig and unit tests (#5520)
* update ppminilm

* update copyright

* update ppminilm tokenizer unittest

* fix format of tinybert

* remove useless arg
2023-04-04 17:44:37 +08:00
Guoxia Wang
2bb0965a48 add GPT3-13B auto export (#5515) 2023-04-04 15:56:17 +08:00
骑马小猫
5acbba4631 [UnitTest]add bloom testing (#5483)
* add bloom testing

* complete bloom test-modeling

* fix variable assigment

* update paralle_matmul method
2023-04-04 14:45:56 +08:00
Linjie Chen
08319b858a [CI] IE taskflow load model from HF Hub (#5524)
* unit test from hf

* fix
2023-04-04 14:44:56 +08:00
yujun
02cf04ef3a update log control image (#5526) 2023-04-04 13:58:57 +08:00
zhaoyingli
ef8d01488e [AutoParallel] update config and yaml for bf16 and fp16 (#5519) 2023-04-04 13:48:31 +08:00
ELLIOTT
5593b198cc [Rembert]add PretrainedConfig and unit test (#5517)
* add PretrainedConfig and unit test

* fix

* fix
2023-04-04 11:00:48 +08:00
Sijun He
006efcf4ea Fix FleetX GPT-3 styles (#5516)
* fix styles

* fix

* changes
2023-04-03 22:41:41 +08:00
wawltor
68b21f120d Add merge tp trainer (#5491)
* add merge tp optional in trainer.

* fix bugs.

* add warning.

* Add set hyrbid parallel seed.

* tmp

* fix the default value for the bloom

* fix the prompt trainer save

---------

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2023-04-03 21:54:00 +08:00
Chitsing KUI
7e8e2ab040 fix lr 0 bug (#5511) 2023-04-03 20:16:09 +08:00
LazyFyh
0a0a78cb2b update prophetnet examples (#5514) 2023-04-03 19:38:31 +08:00
kangguangli
593159044d remove with_data_parallel in static graph training (#5438)
* remove with_data_parallel in static graph training

* fix codestyle
2023-04-03 17:28:19 +08:00
Sijun He
2560f2da02 [CodeStyle] fix styles in model_zoo, paddlenlp/transformers (#5462)
* transformers

* model zoo gpt

* fix ernie-1.0

* electra model zoo

* model zoo bert

* sd utils

* rembert

* laylout lm xlm

* ppminilm

* changes
2023-04-03 17:25:46 +08:00
ELLIOTT
49808f7c96 [ProphetNet]add PretrainedConfig and unit test (#5481)
* add PretrainedConfig and unit test

* test

* fix

* test
2023-04-03 15:21:03 +08:00
Sijun He
ac3e743f87 lora take implementation 2 (#5504) 2023-04-03 11:59:05 +08:00
westfish
7e270b9ad1 fix doc typos (#5496) 2023-04-03 11:54:26 +08:00
lugimzzz
c7da6ec412 add merge lora (#5492) 2023-03-31 18:42:49 +08:00
yujun
5ea29f01d7 更新ppdiffusers安装方式,采用 https://www.paddlepaddle.org.cn/whl/paddlenlp.html (#5490) 2023-03-31 15:07:11 +08:00
lugimzzz
444f989b84 support generate (#5488) 2023-03-31 14:39:02 +08:00
yujun
7a8a4b6203 update freeze_params (#5485) 2023-03-31 11:18:22 +08:00
lugimzzz
0df8976093 【Lora】add lora merged linear (#5451)
* add mergedlinear

* add lora unitest

* update forward

* update forward

* update

* Update paddlenlp/layers/lora.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update paddlenlp/layers/lora.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update paddlenlp/layers/lora.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update paddlenlp/layers/lora.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update paddlenlp/layers/lora.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update lora.py

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-03-30 23:57:38 +08:00
wawltor
cbdacec92a fix the parallel and recompute for bloom (#5469)
* fix the parallel and recompute

* fix the recompute bug
2023-03-30 22:53:21 +08:00
Liujie0926
8b3fc80615 [gpt-3]Update CI/Benchmark (#5472)
* update benchmark_repo from fleetx into paddlenlp

* update sharding16 step

* add gpt-3 ci

* fix gpt-3 ci_requirements

* fix

* update auto loss_base

* update auto loss_base

* Revert "update auto loss_base"

This reverts commit 0d6fde7c2c.

* update log

* update

* add use_flash_attn case

* add use_flash_attn case

* update pretrained model path
2023-03-30 19:01:52 +08:00
Sijun He
1188d6fe49 unit test passes (#5475) 2023-03-30 17:53:05 +08:00
yujun
5d7b63b1e3 [PPDiffusers]upgrade_ppdiffusers0140 (#5360)
* upgrade

* update copyright

* update scaled_dot_product_attention

* update code

* update pipelines inference

* make example passed

* update

* update

* update lora and convert ckpt

* update dtype

* update mel_config.json

* update vae

* bfloat16 text encoder

* update bfloat16 and fd

* update inpaint

* update webui lora download utils export timeout

* update recompute

* update flash attention, we can use it in Axxx, fix load_attn_proc

* update webui lora

* doc update

* time change

* save safetensors torch.uint16=torch.bfloat16

* update download

* update readme and fd pipe

* update diffusers_default_cache_path

* update readme

* update

* fix a small bug

* fix small bug

* remove paddlepaddle-gpu>=2.4.2

* update dit missing id2label

* remove device

* pipeline_semantic_stable_diffusion support fp16

* fix pix2pipx zero

* F.scaled_dot_product_attention_

* update attention unet1d attention, when head_size>128 we will use cutlass

* export model disable_xformers_memory_efficient_attention

* disable AttnProcessor2_5 default

* update pipelineutils is_fastdeploy_model

* support return_global_step

* pop global_step

* update fromckpt

* if upcast_softmax or upcast_attention, we need cast dtype

* update download max_workers

* pipe module update dtype

* missing conditioning_scale 1.0

---------

Co-authored-by: westfish <westfish@126.com>
2023-03-30 17:49:44 +08:00
Noel
0c4e09a088 [glm] update readme (#5479) 2023-03-30 16:55:46 +08:00
Sijun He
4c6fb860fc Remove all ImageGeneration related code (#5306)
* wip

* changes

* changes

* changes

* glm

* changes

* changes
2023-03-30 13:46:14 +08:00
Zhong Hui
218c7cbfe8 fix (#5466) 2023-03-30 10:19:38 +08:00
wawltor
106d78bef9 Update finetune_generation.py 2023-03-30 00:36:48 +08:00
MiuGod0126
1e29a93b16 change ---tokenizer_name to --tokenizer_name (#5465) 2023-03-29 22:31:57 +08:00
LazyFyh
3bfee92753 [MPNet P0] Add mpnet test and configuration (#5439)
* Add mpnet config and test

* update mpnet examples and config attributes_map
2023-03-29 22:29:41 +08:00
骑马小猫
cd9b90e233 [New features] Add Bloom generation scripts (#5311)
* update bloom scripts

* update args

* disable parallel output

* update generation script

* update generation script

* update generation scripts

* update generation scripts

* update readme

* add bloom tokenizer

* update modeling and configuration

* add bloom model

* remove bloom modeling & configuration

* update importing

* update todo comment

* update bloom scripts

* fix tokenizer unittest

* trigger cla license

* update importing

* update bloom scripts

* update tokenizer importing

* update test-modeling common

* add bloom example test code

* update predict generation process

* update generation prediction

* remove configs
2023-03-29 17:45:41 +08:00
wjx-sudo
cb856b255d ctrl add config & test p0 & fix modeling bug (#5445)
* ctrl add config & test p0 & fix modeling bug

* 修改完善

* fix ctrl modeling

* Update paddlenlp/transformers/ctrl/modeling.py

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-03-29 14:09:58 +08:00
yujun
a46c06ebce [Benchmark] update ernie3.0 benchmark seqlen=5112 (#5435)
* update ernie3.0 benchmark seqlen=5112

* fix develop bug, we donot use DataCollatorWithPadding
2023-03-29 11:30:17 +08:00
Jiaqi Liu
8d63af54fd [TinyBERT P0] Add PretrainedConfig and update unit tests (#5452)
* update tinybert p0

* add configuration

* Change constant names to uppercase
2023-03-29 11:17:21 +08:00
Zhong Hui
c521917897 tipc Update prepare.sh (#5434) 2023-03-29 11:17:06 +08:00
Haohongxiang
759fee360b [Model_zoo/GPT-3] Support Adamw CPU offload strategy (#5443)
* adamw cpu offload

* update
2023-03-28 21:43:55 +08:00
Roc
3510097a7a [ZeroDim] fix static gpt (#5440)
* fix
2023-03-28 19:52:59 +08:00
Sijun He
fbddc61862 fix collator (#5446) 2023-03-28 18:48:30 +08:00
w5688414
d34e83f65c Fix Blip2Model input token_type_ids error (#5437) 2023-03-28 15:01:46 +08:00
ELLIOTT
47c9e085da [Blenderbotsmall P0]add PretrainedConfig and unit test (#5423)
* "add PretrainedConfig and unit test"

* Update paddlenlp/transformers/blenderbot_small/modeling.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-03-28 12:03:09 +08:00
w5688414
9fb103cb61 Fix blip2-opt model import error (#5431) 2023-03-27 23:35:05 +08:00
Yam
c2b84816ec Hackathon No.106 add Stable Diffusion Pipeline Attend and excite (#5296)
* add attend_and_excite

* rewrite AttendExciteCrossAttnProcessor by flatten

* check code style

* add record

* modify sample code in README

* move markdown file

* remove md file

* remove unusing code, replace paddle.equal by paddle.equal_all
2023-03-27 21:26:39 +08:00
Zhong Hui
07a5874eaf trainer support eval_accumulation_steps. (#5426) 2023-03-27 19:14:41 +08:00
PiaoYang
f98fb04272 Update README.md (#5428)
Change from single quotation marks to double quotation marks to avoid parsing error in Windows.
2023-03-27 17:25:56 +08:00
w5688414
a6f5129c10 Add clipseg models (#5412)
* Add clipseg models

* Add copyright info

* rename processing to processing
2023-03-27 13:27:37 +08:00
w5688414
ed367b7228 Add blip2 models (#5025)
* Add blip2 models

* Update generation_utils.py

* Add blip2 unitest

* Add blip2 unitest

* Update generation_utils.py

* Add blip2-flan-t5-xl-coco

* Add HF copyright

* remove unused comments

* Add blip2 opt support

* remove blanks

* Update blip2 for float16 inference

* Fix input_ids NoneType bug

* Update unitests for blip2

* Fix KeyError: 'cache'

* revert opt causal_mask

* adjust initial weights, adjust tie weights

* remove post init

* delete ModuleUtilsMixin

* remove return dict

* Fix some comments
2023-03-27 10:14:55 +08:00
Zhong Hui
e72fb98534 [LLM] Support tensor parallelism for save and load (#5397)
* tmp

* debug

* fix

* fix

* add tensor parallel merge.

* support save/load for tp

* fix

* remove unused files.

* fix tests

* fix gather group.

* fix

* add missing file

* fix import

* tmp

* fix load
2023-03-26 14:39:51 +08:00
PiaoYang
f2fae78764 [Typo] Update README.md (#5419)
Typo
2023-03-26 14:13:43 +08:00
骑马小猫
f54e80db00 [Function optimization] add unittest for downloading with file-lock (#4972)
* add unittest for file lock

* add file
2023-03-24 21:46:55 +08:00
骑马小猫
c436823d58 [Performance optimization] update ernie ctm input embeds (#5408)
* add testing for ernie-ctm

* update ernie-ctm modeling

* update ernie-ctm unittest

* update erniectm testing config

* fix tokenizer lint
2023-03-24 18:16:28 +08:00
wawltor
44c9e6c924 Update README.md 2023-03-24 17:58:44 +08:00
Sijun He
a858cf9048 distilbert p0 (#5382)
* distilbert p0

* add test

* import

* changes

* remove print statements

* switch to small models
2023-03-24 16:28:24 +08:00
wawltor
64e5968eb1 Update export_generation_model.py 2023-03-24 16:20:40 +08:00
LazyFyh
b998342645 [Pegasus P0] Update pegasus test and configuration (#5342)
* update pegasus test and configuration

* fix config __init__

* fix tokenizer test and add PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST

* fix typo

* fix config bug

* fix config bug.

* add 523M-V1 model and reduce vocab.txt

* update applications train.py

* tidy test_modeling and fix pretrain bug
2023-03-24 16:14:14 +08:00
Sijun He
2035f2b8fb Make CI test print 20 slowest tests (#5404) 2023-03-24 15:39:17 +08:00
zhang junjun
d8b54b7baa [CI] Fix question matching (#5403)
* [CI] fix examples api names bug

* [CI] fix question_matching datasets

* Update ci_case.sh
2023-03-24 14:19:15 +08:00
Sijun He
1f86dd9de7 Fix Ernie Doc CI (#5391)
* fix ci

* fix styles

* fix dropout
2023-03-24 13:23:09 +08:00
sneaxiy
8795f4a53a fix sp bug (#5398) 2023-03-24 11:58:09 +08:00
yujun
6e29d6fd1f 删除TaskFlow中文生图的文档 (#5225)
* 更新文档

* remo
2023-03-24 11:42:32 +08:00
Sijun He
505b77e082 [CodeStyles] fix all of examples (#5394)
* ernie-gen

* ernie-layout

* ie

* qa

* tipc

* trans

* question generation

* word embedding

* semantic indexing

* text correction

* text to knowledge

* examples

* text graph

* text matching

* fix utils
2023-03-24 11:21:25 +08:00
yujun
8a5841015f Update roformer config (#5392)
* upgrade config

* update tests

* config.num_labels = self.num_classes

* update results

* make test pass

* update converter
2023-03-24 10:57:42 +08:00
骑马小猫
5e4d789496 [ErnieCtm P0] add testing & inputs_embeds supporting (#5221)
* add testing for ernie-ctm

* update ernie-ctm modeling

* update ernie-ctm unittest
2023-03-24 10:56:59 +08:00
Noel
11b8f83d9d [glm] fix zero-dim tensor (#5396) 2023-03-23 23:51:52 +08:00
wawltor
1cdcc82915 Add export and inference glm (#5371)
* update the finetune script

* rename the test dataset to dev dataset

* add the export model and inference model for the glm

* update the model_dir to model_path

* fix the batch_texts in predict_generation
2023-03-23 19:47:57 +08:00
zhang junjun
5b25039847 [CI] Fix distilbert pretrained teacher model (#5390)
* [CI] fix examples api names bug

* [CI] fix distilbert

* Update ci_case.sh
2023-03-23 19:41:14 +08:00
Sijun He
b3d761e5fa LoRA MP is ready to go! (#5368)
* working

* remove
2023-03-23 18:45:12 +08:00
w5688414
48e6183016 [Paddle-pipelines] Fix queries_type bugs (#5385)
* Fix queries_type bugs

* upgrade to 0.5.2

* Upgrade query_type config

* Update comments
2023-03-23 17:42:02 +08:00
ShenLiang
4aca24d3f9 [BugFix] Fix bug in setting order of hybridparallel (#5381)
* fix bug

* fix bug
2023-03-23 15:25:58 +08:00
ShenLiang
f6886de42a opt gpt (#5375) 2023-03-23 12:58:54 +08:00
Linjie Chen
cf5bf390aa fix flake8 (#5377) 2023-03-23 12:19:07 +08:00
zhang junjun
5b88880640 [CI] fix examples api names bug (#5376) 2023-03-23 11:58:24 +08:00
Haohongxiang
3e3e1ea42a fix commented bugs (#5349) 2023-03-23 11:25:42 +08:00
Zhong Hui
5f7d9c9840 [LLM] low_cpu_mem_usage enable dtype guard (#5344) 2023-03-23 11:09:36 +08:00
zhang junjun
b343e76523 [BugFix] Fix ernie-1.0 static (#5374) 2023-03-23 11:08:01 +08:00
Sijun He
3eac38e6bc [CodeStyles] fix examples (#5369)
* fix few shot

* fix benchmarks

* dialogue

* examples

* examples

* lex

* working
2023-03-23 10:58:12 +08:00
LazyFyh
58be2e364f Update chinesebert P0 examples (#5310)
* Update chinesebert P0 examples

* empty message

* empty message
2023-03-23 10:27:51 +08:00
Sijun He
edbcee6536 [CodeStyles] fix gpt3 fleetx (#5358)
* fix ppfleetx styles

* address comments

* address comment
2023-03-22 19:53:51 +08:00
Noel
b014daf358 [GLM10B] Fix rouge calculation (#5361)
* [GLM10B] Fix loss bug in MP mode

* [rank] Fix typo of local_rank

* [examples] fix rouge calculation

* remove print
2023-03-22 17:28:51 +08:00
Linjie Chen
8e6c51f65f Add LLaMA (#5159)
* add llama

* Update config

* add unit test

* move llama to examples

* remove

* glue finetune

* support mp finetune

* add model export

* update config

* fix convert

* update modeling

* update

* support d2s

* Update README.md

* remove some files

* remove unused

* LLaMA -> Llama

* fix ci

* fix ci

* fix ci

* fix ci
2023-03-22 17:06:56 +08:00
Chitsing KUI
0aeef23053 add lora mp (#5347) 2023-03-22 15:45:47 +08:00
Sijun He
8a338ddbed [CodeStyle] fix applications/text_classification (#5356)
* changes

* text classfication applications
2023-03-22 15:08:22 +08:00
LazyFyh
e09e51b62b CodeGen examples update (#5234)
* CodeGen examples update

* Add do_eval
2023-03-22 13:23:17 +08:00
Noel
7de1ddd907 [GLM10B] Fix loss bug (#5339)
* [GLM10B] Fix loss bug in MP mode

* [rank] Fix typo of local_rank
2023-03-21 22:35:32 +08:00
sneaxiy
41ae9cf6fe Add GPT LayerNorm external ops (#5340)
* add gpt external ops

* add fused_layers
2023-03-21 21:21:22 +08:00
Sijun He
bcd96cb29e [Bug fix] fix trainer MP wrong dataset issue (#5341)
* [Bug fix] fix trainer MP wrong dataset issue

* Update trainer.py
2023-03-21 20:41:23 +08:00
Linjie Chen
fe51ce8624 fix generate sample_d2s (#5333)
* fix generate sample_d2s

* fix

* fix
2023-03-21 19:27:17 +08:00
yujun
587f26878e update (#5336) 2023-03-21 19:10:13 +08:00
lugimzzz
2e8c741de2 【Lora】fix weight initialization and support bias trainable (#5330)
* optimize_lora

* fix lora

* update lora

* add trainable_bias to LoRAConfig

* Update paddlenlp/layers/lora.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-03-21 18:11:43 +08:00
Linjie Chen
ea5143c2ea [LayoutLMv2 P0] Add PretrainedConfig and unit tests (#5329)
* LayoutLMv2 P0

* add test files

* add tokenizer unit tests

* add modeling unit tests

* update

* remove unused
2023-03-21 17:55:16 +08:00
Jack Zhou
9cd6726edf [FastDeploy] Add UTC fastdeploy example (#5058)
* Add utc infer

* fix bug

* update doc

* remove batch_text

* update utc doc
2023-03-21 13:37:10 +08:00
Jack Zhou
cef5a63ae9 [FastDeploy] Add uie fastdeploy example (#5053)
* Add uie infer

* update key

* remove inference sample of uie

* update uie

* Update doc

* update tokenizer save

* Update default backend
2023-03-21 13:36:56 +08:00
Sijun He
92e7d3373e Fix OFA and ppminilm CI (#5328)
* fix

* fix
2023-03-21 13:22:16 +08:00
liu zhengxi
73228418d8 Fix GPT decoder output (#5212)
* fix gpt decoder
2023-03-21 13:02:11 +08:00
Zhong Hui
27c2edfa2d [BugFix] Fix bert training with trainer. (#5327) 2023-03-21 13:00:54 +08:00
Haohongxiang
5e167deca1 [GPT3] Migrate gpt3 from fleetx into paddlenlp (#5292)
* migrate fleetx gpt3

* migrate fleetx gpt3

* update
2023-03-21 13:00:08 +08:00
Noel
f53b7d3c64 [GLM10B] Fix attention bug in MP mode (#5322)
* [glm] fix generation

* [glm] convert tokenizer variables to numpy

* [GLM10B] Fix attention bug in MP mode
2023-03-21 11:04:18 +08:00
Sijun He
dacd251d83 Fix Trainer IterableDatasetShard bug (#5325) 2023-03-21 11:02:38 +08:00
Zhong Hui
0cbf8b9fad [BugFix] Fix some comments (#5314) 2023-03-20 22:58:30 +08:00
wawltor
e307c9693c Update finetune_generation.py 2023-03-20 21:49:57 +08:00
wawltor
792e22df3c Add epxort glm (#5321)
* update the finetune script

* rename the test dataset to dev dataset
2023-03-20 21:40:36 +08:00
Noel
b28eb5d30d [GLM 10B] Fix generation (#5320)
* [glm] fix generation

* [glm] convert tokenizer variables to numpy
2023-03-20 21:34:43 +08:00
Zhong Hui
c4d22a4647 [LLM] Support GLM for Tensor Parallel (#5198)
* init version

* support mp for glm.

* support mp for trainer.
2023-03-20 16:10:34 +08:00
wawltor
895d49f911 Add predict bloom (#5313)
* add the inference code

* update the code for predict

* update the generation for dygraph model
2023-03-20 15:37:51 +08:00
LixinGuo
9544cfc56b fix gpt benchmark (#5304) 2023-03-20 15:17:43 +08:00
Sijun He
ef5a9f8fd5 fix (#5305) 2023-03-20 13:12:59 +08:00
westfish
0177069573 [PPDiffusers] Controlnet load update (#5294)
* add controlnet specific convert script

* fix cla problem

* update
2023-03-20 12:21:54 +08:00
yujun
c0f95c7e0c [ControlNet Fastdeploy] add ControlNet Fastdeploy (#5203)
* add fd

* update fd deploy

* add speed

* upate
2023-03-20 12:20:19 +08:00
Sijun He
7dea6d220f Ignore fleetx in CI (#5303) 2023-03-20 11:35:52 +08:00
gongenlei
f8604c450b [D2S] Sampling generate supports d2s (#5138)
* feat: sampling generate supports d2s

* for mt5/t5 unitest

* fix

* judge tracing

* update args and min/max len
2023-03-17 20:38:01 +08:00
w5688414
77cfcbe1e0 flake8 neural search (#5290) 2023-03-17 16:38:30 +08:00
Zhong Hui
37b976fb31 [TIPC] Update modeling.py (#5287) 2023-03-17 16:34:18 +08:00
wawltor
b37391f0de Fix load big model (#5289)
* fix the load the model from None

* fix the load the model

* change dtype of config
2023-03-17 16:10:30 +08:00
lugimzzz
7ebda5ef75 add model config for ernie gram (#5288) 2023-03-17 15:37:20 +08:00
Sijun He
940c5e6465 GLM + LoRA (#5200)
* lora working

* merge
2023-03-17 15:30:32 +08:00
Jack Zhou
e17da677ea update default scheduler (#5284) 2023-03-17 14:17:28 +08:00
Zhong Hui
5a040a5145 [TIPC] Fix tipc (#5274)
* Update prepare.sh

* Update prepare.sh
2023-03-17 13:28:32 +08:00
westfish
fcdbc75bc8 [GPT-J P0-P1-P2] GPT-J Basic Experience Update (#5219)
* update

* update

* tiny fix

* fix cpu unitest problem

* update

* remove head_mask totally
2023-03-17 13:09:48 +08:00
小小的香辛料
b138ebea2e [Trainer] Resume trainer find_unused_parameters (#5261) 2023-03-17 12:54:48 +08:00
w5688414
2263d217d7 Add ClipGradByGlobalNorm (#5272) 2023-03-17 11:27:18 +08:00
Zhong Hui
453fe23298 [LLM] Support Lazy init from pre-trained model (#5270) 2023-03-17 11:23:21 +08:00
Sijun He
edadca24fd fix styles (#5279) 2023-03-17 11:03:49 +08:00
ELLIOTT
5c8e2652a6 [blenderbot P0] add PretrainedConfig and unit test (#5271)
* "add PretrainedConfig and unit test "

* "fix"

* "fix"
2023-03-17 10:59:27 +08:00
lugimzzz
1e251a71f4 [P0 albert]add model config (#5275)
* update albert

* fix_format
2023-03-16 23:59:11 +08:00
Sijun He
74c2a4eb19 metrics (#5265) 2023-03-16 19:18:04 +08:00
Jack Zhou
1dcb967873 Fix PretrainedFastTokenizer import (#5266) 2023-03-16 16:17:26 +08:00
Sijun He
22f8bb9339 Add lora tests (#5262) 2023-03-16 16:03:49 +08:00
Zhong Hui
5c977048c5 [TIPC] Update requirements.txt (#5264) 2023-03-16 16:03:27 +08:00
liu zhengxi
7540ae9157 Enable gpt_for_sequence_classification benchmark (#5140)
* add gpt_for_sequence_classification ben

* update
2023-03-16 13:42:04 +08:00
Sijun He
9e3bc45936 Fix styles in examples/language_models (#5215)
* machine translation

* changes

* examples t5

* bigbird

* luke

* chinese bert

* moe

* transformer-xl

* roberta

* sentiment analysis

* torch migration

* end_to_end_memory_networks

* megatonbert

* mpnet rembert

* language model

* transformers
2023-03-16 10:59:07 +08:00
wjx-sudo
29b37fef8c 升级xlnet和xlm支持config (#5091)
* 升级xlnet和xlm支持config

* modified bug

* modified bug

* 修改完善上次提交并新增xlm test

* fix xlm tokenizer test

* fix

* fix test requirment.txt

* fix

* init

* add sacremoses to  requirements_ci

* Revert "add sacremoses to  requirements_ci"

This reverts commit c3e8c435f1c3e136daf24696de1041599c16c4f8.

* add sacremoses to requirment_ci

* modified comments
2023-03-16 10:58:41 +08:00
w5688414
e83ce9597d [Paddle-pipelines] Fix ContentTypes missing bug and upgrade to 0.5.1 (#5251)
* Fix ContentTypes missing bug and upgrade to 0.5.1

* query_type to queries_type
2023-03-16 10:24:43 +08:00
小小的香辛料
4e529879fc [Model Zoo] Refactor Ernie health usage in Model Zoo (#5161)
* [Model Zoo] Refactor Ernie-health usage in Model Zoo
2023-03-16 10:11:25 +08:00
wawltor
17b54a3a80 fix the recompute and pure_fp16 (#5250) 2023-03-15 20:37:43 +08:00
zhang junjun
0406607e86 [CI] Fix transformer xl (#5255)
* [CI] fix transformer-xl

* Update
2023-03-15 20:20:42 +08:00
Sijun He
230e03f66f mark_lora_as_trainable (#5241) 2023-03-15 19:21:28 +08:00
Sijun He
586755ba0c config (#5244) 2023-03-15 16:06:57 +08:00
Milen
64f4c107a9 [OPT P2] add inputs_embeds and cache (#5232)
* [OPT P1] support labels, return_dict, output_hidden_states, output_attentions in opt

* [OPT P1] add annotations for opt

* [OPT P1] remove unuseful print.

* [OPT P1] refine codestyle

* [OPT P2] add test_for_model_cache in tests

* [OPT P2] remove some comments

* [OPT P2] add annotation for attention_mask
2023-03-15 15:26:51 +08:00
wawltor
22640b83ad Fix pretrain model (#5242)
* add the bloom support finetune and inference

* add the generation finetune

* update the generation export and inference

* update the bloom code

* add the args and pretrain script

* update the pretrain code

* fix the pretrain model

* fix the pure fp16 pretrain
2023-03-15 12:52:22 +08:00
wawltor
96b76a3c1c fix the bloom pretrain (#5235)
* add the bloom support finetune and inference

* add the generation finetune

* update the generation export and inference

* update the bloom code

* add the args and pretrain script

* update the pretrain code

* fix the pretrain model
2023-03-14 23:14:09 +08:00
wawltor
559016558c Add bloom pretrain (#5231)
* add the bloom support finetune and inference

* add the generation finetune

* update the generation export and inference

* update the bloom code

* add the args and pretrain script

* update the pretrain code
2023-03-14 21:25:54 +08:00
w5688414
947282ae13 [Paddle-pipelines] Add image to text retrieval (#5216)
* Add image to text retrieval

* Add wukong text demo dataset
2023-03-14 17:49:55 +08:00
Milen
8fb02b36ef [OPT P1] add return_dict, labels and so on. (#5222)
* [OPT P1] support labels, return_dict, output_hidden_states, output_attentions in opt

* [OPT P1] add annotations for opt

* [OPT P1] remove unuseful print.

* [OPT P1] refine codestyle
2023-03-14 16:41:36 +08:00
Qinghua Zhang
b660b050cb [Reformer BigBird]Add IntegrationTest (#5214)
* add_IntegrationTest

* modefied

* modefied
2023-03-14 16:33:18 +08:00
Sijun He
b4b2234144 fix styles in ft (#5217) 2023-03-14 15:01:39 +08:00
zhang junjun
3d0076d2ec [CI] change paddle inference (#5218) 2023-03-14 14:39:25 +08:00
Noel
5f90194520 [GLM] update default model name (#5185) 2023-03-14 14:12:45 +08:00
ELLIOTT
9590300db5 [ErnieDoc P0] add PretrainedConfig and unit test (#5210)
* "add PretrainedConfig and unit test"

* "fix"

* "fix"
2023-03-14 13:45:25 +08:00
lugimzzz
2ee028b69c [AutoNLP]add UTC (#5184)
* add utc

* optimizer test

* update_md5sum

* unify metric_for_best_model

* update according to comments

* Update paddlenlp/experimental/autonlp/text_classification.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-03-14 12:08:04 +08:00
Milen
7372bfcbe6 [OPT P0] update OPT with pretrianedConfig and tests (#5206)
* initial commit

* refine readme

* refine codestyle

* refine readme

* refine readme

* fix model saving bug

* initial commit

* initial commit

* initial commit

* use common metric instead of eval_metrics.py and remove unuseful code

* mv stage project to ASO_analysis

* add unified sentiment analysis

* refine readme

* refine readme

* refnie readme

* add unified sentiment analysis

* refine readme

* initial commit

* initial commit

* refine readme

* add taskflow for sentiment analysis with UIE

* refine Readme

* refine readme.md

* support sentiment analysis (UIE) with inputing by file format

* refine readme

* delete predict scripts

* refine readme

* delete unuseful files

* add pipeline for sentiment_analysis

* merging with the newest code

* fix to convert data without synonyms

* add senta pipeline

* refine readme

* drop functions: inputting file and saving results

* add UIE-seta-[base, medium, mini, micro, nano]

* modify .gitignore to trace deploy code

* add deploy with SimpleServer

* add debug mode

* fix debug mode

* update the loading  method of UIE

* refine readme

* fix bug caused by version updating

* fix hard coding for model name.

* refine codestyle

* modify readme according the way of 'step by step'

* refine codestyl

* change saving txt to json files

* download font automatically when not input font_path

* change readme in the way 'step by step'

* add model prediction by batch

* add uie-senta-x to support_schema_list

* update sentiment analysis in taskflow

* add prediction with saved offline model

* change the exception exposure way

* add description for visual schema

* delete comments

* remove comments

* remove unused code and comments

* convert uie-senta-x model params to fit ernie/uie

* refine readme for sentiment analysis

* add running time

* refine readme for senta pipeline

* change uie-base to uie-senta-base

* load uie-senta-x with auto module

* add deploy with SimpleServer

* refine codestyle

* refine readme

* add uie-senta-x to support_schema_list

* fix hard coding for mdoel anme

* refine codestyle

* refine codestyl

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* fix senta response

* refine codestyle

* remove lambda expressions

* add link of senta pipeline

* refine codestyle

* remove local path

* fix typos

* refine readme

* load uie-senta-x with automodel

* remove commented code

* restore auto

* add link of hotel dataset to readme.

* add link for downloading test_hotel.txt

* fix url problem for server and client

* refine readme

* fix for senta_examples.py

* update visualization function

* update visualization function

* refine readme and update visualization description

* update visualization function

* refine readme and update visualization function

* change logger in PaddleNLP to log information

* fix running time for skep and uie

* fix bug to solve tokenizer updating problem

* refine label-studio readme

* refine label-studio readme

* refine label-studio readme

* optimize example construction for a, o, as, ao extraction task

* add the labeling method for ext task: a,  as, ao and so on.

* add note for visual_analysis.py

* change link for downloading data and refine log output

* refine log output

* refine readme

* expose options interface

* refine readme

* modify typos

* expose options for customing sentiment analysis

* README.md

* fix bug for param is_shuffle in label_studio.py

* [BugFix] Fix the param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [Model Update] add configuration for skep model.

* [Reproduce] inital nystromformer

* [Add Model] add nystromformer model

* [Add Model] add __init__.py

* [Add Model] add nystromformer model.

* Delete configuration.py

* [Add Model] support auto module for nystromformer and refine some descriptions

* [Add Model] add tests for nystromformer

* [Add Model] remove some imports from nystromformer/__init__.py

* [Nystromformer] add fast tokenizer for nystromformer

* add fast_tokenizer file for nystromformer

* [OPT P0] update with pretrainedConfig and tests

* [OPT P0] add tests for OPT

* [OPT P0] add modeling for opt

* [OPT P0] update TransformerDecoderLayer with config for OPT

* [OPT P0] modify normalize_before in gpt

* [OPT P0] refine codestyle for unittest

---------

Co-authored-by: tianxin <tianxin04@baidu.com>
2023-03-14 11:35:54 +08:00
Qinghua Zhang
7c75f5983d [Reformer P2] Add inputs_embeds and past_key_values(cache) (#5175)
* reformer_pr2

* modefied

* modefied
2023-03-14 09:40:10 +08:00
Qinghua Zhang
571760fefa [BigBird P2] Add inputs_embeds (#5186)
* bigbird_pr2

* modefied

* modefied
2023-03-14 09:37:31 +08:00
骑马小猫
71a3dd97cf [LLM] Add requirements to gpt-3 examples (#5208)
* add requirements to gpt-3 examples

* disable softmax_mask_fuse_upper_triangle
2023-03-13 21:35:50 +08:00
wawltor
32dd7cb326 add the bloom support finetune and inference (#5179)
* add the bloom support finetune and inference

* add the generation finetune

* update the generation export and inference

* update the bloom code
2023-03-13 20:15:50 +08:00
westfish
f088025382 [PPDiffusers] Add ControlNet Converter (#5156)
* add controlnet specific convert script

* fix cla problem
2023-03-13 19:25:05 +08:00
Zhong Hui
d71b03754a [GPT] Support MP for finetune (#5071)
* init commit

* remove pp for pretrain

* fix dataset.

* fix bugs

* add seq cls for gpt-3

* fix traing log

* fix

* fix save/load and fuse transformer.

* fix

* fix

* fix bs

* support for generation

* support for generation and fix save bugs.

* optimized for dataset resumption.

* fix

* fix

* add export

* fix compatible

* fix comments

* fix export.

* add finetune on squad

* fuse qkv -> fuse attention qkv.

* fuse -> enable fuse transformer.
2023-03-13 14:52:23 +08:00
Guo Sheng
ae68847d8c copy newer_group form distutils.dep_util to avoid import distutils (#5183) 2023-03-11 01:18:11 +08:00
Linjie Chen
f727741cf2 Fix Unit Test (#5188)
* replace by small model

* uie-test

* update
2023-03-11 00:40:36 +08:00
zhang junjun
a1648848ac [CI] add codegen (#5170) 2023-03-10 11:07:01 +08:00
qiuwenbo
20f1edda7e 【PaddlePaddle Hackathon 4】[103] 新增tie_weights能力 提交rfc文档 (#5098)
* [103] 新增tie_weights能力 提交rfc文档

* [103] 新增tie_weights能力 提交rfc文档 v2

* [103] 新增tie_weights 能力 提交rfc文档 v3
2023-03-10 11:04:46 +08:00
Sijun He
c338234130 Add LoRA layer (#5150)
* lora wip

* ready for first commit

* comments
2023-03-10 10:57:10 +08:00
zws-2019
b8d23a12b2 fix npu nn.Pad2D() (#5167) 2023-03-09 23:29:31 +08:00
Milen
86c88489b4 [Nystromformer Feature] add fastTokenizer for Nystromformer (#5124)
* initial commit

* refine readme

* refine codestyle

* refine readme

* refine readme

* fix model saving bug

* initial commit

* initial commit

* initial commit

* use common metric instead of eval_metrics.py and remove unuseful code

* mv stage project to ASO_analysis

* add unified sentiment analysis

* refine readme

* refine readme

* refnie readme

* add unified sentiment analysis

* refine readme

* initial commit

* initial commit

* refine readme

* add taskflow for sentiment analysis with UIE

* refine Readme

* refine readme.md

* support sentiment analysis (UIE) with inputing by file format

* refine readme

* delete predict scripts

* refine readme

* delete unuseful files

* add pipeline for sentiment_analysis

* merging with the newest code

* fix to convert data without synonyms

* add senta pipeline

* refine readme

* drop functions: inputting file and saving results

* add UIE-seta-[base, medium, mini, micro, nano]

* modify .gitignore to trace deploy code

* add deploy with SimpleServer

* add debug mode

* fix debug mode

* update the loading  method of UIE

* refine readme

* fix bug caused by version updating

* fix hard coding for model name.

* refine codestyle

* modify readme according the way of 'step by step'

* refine codestyl

* change saving txt to json files

* download font automatically when not input font_path

* change readme in the way 'step by step'

* add model prediction by batch

* add uie-senta-x to support_schema_list

* update sentiment analysis in taskflow

* add prediction with saved offline model

* change the exception exposure way

* add description for visual schema

* delete comments

* remove comments

* remove unused code and comments

* convert uie-senta-x model params to fit ernie/uie

* refine readme for sentiment analysis

* add running time

* refine readme for senta pipeline

* change uie-base to uie-senta-base

* load uie-senta-x with auto module

* add deploy with SimpleServer

* refine codestyle

* refine readme

* add uie-senta-x to support_schema_list

* fix hard coding for mdoel anme

* refine codestyle

* refine codestyl

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* fix senta response

* refine codestyle

* remove lambda expressions

* add link of senta pipeline

* refine codestyle

* remove local path

* fix typos

* refine readme

* load uie-senta-x with automodel

* remove commented code

* restore auto

* add link of hotel dataset to readme.

* add link for downloading test_hotel.txt

* fix url problem for server and client

* refine readme

* fix for senta_examples.py

* update visualization function

* update visualization function

* refine readme and update visualization description

* update visualization function

* refine readme and update visualization function

* change logger in PaddleNLP to log information

* fix running time for skep and uie

* fix bug to solve tokenizer updating problem

* refine label-studio readme

* refine label-studio readme

* refine label-studio readme

* optimize example construction for a, o, as, ao extraction task

* add the labeling method for ext task: a,  as, ao and so on.

* add note for visual_analysis.py

* change link for downloading data and refine log output

* refine log output

* refine readme

* expose options interface

* refine readme

* modify typos

* expose options for customing sentiment analysis

* README.md

* fix bug for param is_shuffle in label_studio.py

* [BugFix] Fix the param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [Model Update] add configuration for skep model.

* [Reproduce] inital nystromformer

* [Add Model] add nystromformer model

* [Add Model] add __init__.py

* [Add Model] add nystromformer model.

* Delete configuration.py

* [Add Model] support auto module for nystromformer and refine some descriptions

* [Add Model] add tests for nystromformer

* [Add Model] remove some imports from nystromformer/__init__.py

* [Nystromformer] add fast tokenizer for nystromformer

* add fast_tokenizer file for nystromformer

---------

Co-authored-by: tianxin <tianxin04@baidu.com>
2023-03-09 23:22:01 +08:00
Noel
9213720364 [GLM] Add fine-tuning for small-scale GLM (#5061)
* [glm] add draft code

* [glm-dev] add draft code

* [glm] enable converting to static model

* [glm] update implementation

* [glm-dev] abort when optimier.step()

* [glm-dev] update implementation

* [glm] update configuration

* [glm] forward version

* [glm-dev] backward version

* [glm-dev] generation

* [glm] unittest

* [glm] add large, 10b and chinese

* [glm] update implementation

* [glm] split generate function

* [glm] update added_tokens

* [glm] update unittest

* [glm] update unittest
2023-03-09 23:20:26 +08:00
yujun
64621af691 add bert-base text cls TIPC (#5171)
* add

* test
2023-03-09 22:54:11 +08:00
w5688414
1d43ce5ec5 Fix bm25 and joindocuments import bugs (#5157) 2023-03-09 18:48:00 +08:00
Qinghua Zhang
ea41f01c6f [BigBird P1] Add loss, return_dict, hidden and attention outputs (#5160)
* bigbird_pr1

* debug
2023-03-09 18:01:06 +08:00
Sijun He
a1e21a5286 add metrics test (#5166) 2023-03-09 16:52:11 +08:00
yujun
c7395fb3a6 [Benchmark] add stablediffusion benchmark (#4807)
* add sd benchmark

* cast float32

* update bench

* bs = 2

* install ppdiffusers
2023-03-09 15:37:04 +08:00
yujun
6e20322d05 release ppdiffuser0.11.1 (#5147)
* release ppdiffuser0.11.1

* update readme

* update allinone
2023-03-08 17:11:46 +08:00
Jack Zhou
40aeee11dd [FastDeploy] Update fastdeploy api for StableDiffusion (#5143)
* Update fd api

* Add cast to float32

* delete_pass->disable_trt_ops

* Use delete pass

* delete all fp16 passes
2023-03-08 17:04:08 +08:00
westfish
b73d606ac9 [PPDiffusers] Add ControlNet Hed to Image (#5148)
* add hed

* update doc
2023-03-08 17:03:17 +08:00
Qinghua Zhang
a0c1b54866 bigbird_examples更新 (#5062)
* examples_modefied

* modefied

* CI_debug
2023-03-08 16:37:38 +08:00
ELLIOTT
0ce38b9914 [DalleBart P0] add PretrainedConfig and unit test (#5069)
* "add PretrainedConfig and unit test "

* "fix bug"

* "fix bug"

* "fix bug"

* retest

* retest

* retest

* retest

* ”fix“
2023-03-08 15:32:32 +08:00
小小的香辛料
c1307db8af [Electra P0] Add PretrainedConfig and unit tests (#5123)
* [Electra P0] Add PretrainedConfig and unit tests

* [Electra P0] fix issues by PR
2023-03-08 15:00:06 +08:00
zhang junjun
25b38b7052 add requirements-dev (#5145) 2023-03-08 14:29:04 +08:00
yujun
eef0b28bce torch_load use ZipFile, support bf16, support torch.nn.Parameter (#5128)
* use ZipFile, support bf16, support torch.nn.Parameter

* add bfloat16 test, add torch.nn.Parameter test
2023-03-08 00:55:40 +08:00
westfish
d98d262c13 [paddle-pipelines] fix device bug in question_generator (#5139)
* fix device bug in question_generator

* update

* fix update

* update

* update
2023-03-07 21:41:03 +08:00
Milen
767ccabf3d [SKEP P2] support inputs_embeds and past_key_values as input (#5136)
* initial commit

* refine readme

* refine codestyle

* refine readme

* refine readme

* fix model saving bug

* initial commit

* initial commit

* initial commit

* use common metric instead of eval_metrics.py and remove unuseful code

* mv stage project to ASO_analysis

* add unified sentiment analysis

* refine readme

* refine readme

* refnie readme

* add unified sentiment analysis

* refine readme

* initial commit

* initial commit

* refine readme

* add taskflow for sentiment analysis with UIE

* refine Readme

* refine readme.md

* support sentiment analysis (UIE) with inputing by file format

* refine readme

* delete predict scripts

* refine readme

* delete unuseful files

* add pipeline for sentiment_analysis

* merging with the newest code

* fix to convert data without synonyms

* add senta pipeline

* refine readme

* drop functions: inputting file and saving results

* add UIE-seta-[base, medium, mini, micro, nano]

* modify .gitignore to trace deploy code

* add deploy with SimpleServer

* add debug mode

* fix debug mode

* update the loading  method of UIE

* refine readme

* fix bug caused by version updating

* fix hard coding for model name.

* refine codestyle

* modify readme according the way of 'step by step'

* refine codestyl

* change saving txt to json files

* download font automatically when not input font_path

* change readme in the way 'step by step'

* add model prediction by batch

* add uie-senta-x to support_schema_list

* update sentiment analysis in taskflow

* add prediction with saved offline model

* change the exception exposure way

* add description for visual schema

* delete comments

* remove comments

* remove unused code and comments

* convert uie-senta-x model params to fit ernie/uie

* refine readme for sentiment analysis

* add running time

* refine readme for senta pipeline

* change uie-base to uie-senta-base

* load uie-senta-x with auto module

* add deploy with SimpleServer

* refine codestyle

* refine readme

* add uie-senta-x to support_schema_list

* fix hard coding for mdoel anme

* refine codestyle

* refine codestyl

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* fix senta response

* refine codestyle

* remove lambda expressions

* add link of senta pipeline

* refine codestyle

* remove local path

* fix typos

* refine readme

* load uie-senta-x with automodel

* remove commented code

* restore auto

* add link of hotel dataset to readme.

* add link for downloading test_hotel.txt

* fix url problem for server and client

* refine readme

* fix for senta_examples.py

* update visualization function

* update visualization function

* refine readme and update visualization description

* update visualization function

* refine readme and update visualization function

* change logger in PaddleNLP to log information

* fix running time for skep and uie

* fix bug to solve tokenizer updating problem

* refine label-studio readme

* refine label-studio readme

* refine label-studio readme

* optimize example construction for a, o, as, ao extraction task

* add the labeling method for ext task: a,  as, ao and so on.

* add note for visual_analysis.py

* change link for downloading data and refine log output

* refine log output

* refine readme

* expose options interface

* refine readme

* modify typos

* expose options for customing sentiment analysis

* README.md

* fix bug for param is_shuffle in label_studio.py

* [BugFix] Fix the param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [Model Update] add configuration for skep model.

* [Transformer Update] update skep and add related unittest

* [Skep Update] fix examples and taskflow

* [Transformer Update] update skep examples for sentiment analysis

* [Transformer Update] update skep examples for sentiment analysis

* [Transformer Update] CodeStyle for examples/skep/*

* [Transformer Update] examples/skep done

* [Transformer Update] refine readme in examples/skep

* [Transformer Update] initial skep tests done.

* [Skep Upgrade] add skep in taskflow tests

* [Skep Upgrade] add tests for skep in taskflow

* [Skep Upgrade] remove yapf in examples/skep

* [Skep P0] remove print

* [SKEP P0] fix the param ckpt_dir in predict scripts

* [SKEP P0] fix the param ckpt_dir for skep examples.

* [SKEP P0] fix ci_case

* [SKEP P0] remove tiny_random_bert taskflow/test_sentiment_analysis

* [SKEP P0] add tiny-random-skep as code comment

* [SKEP P0] using tiny_random_skep for tests in case of OOM at test machine.

* [SKEP P0] add taskflow prediction for examples/skep/sentence

* [SKEP P0] add __internal_testing__/tiny-random-skep as taskflow model

* [SKEP P1] fix return parameters for SkepCrfForTokenClassification

* [SKEP P1] pass labels to forward for examples

* [SKEP P1] pass labels to forward for applications

* [SKEP P2] support inputs_embeds and past_key_values  as input

* [SKEP P2] modify test_inputs_embs test to support comparing tensor with int64

---------

Co-authored-by: tianxin <tianxin04@baidu.com>
2023-03-07 19:39:32 +08:00
Jack Zhou
3695ac798b [FastDeploy] Fix zero copy (#5130)
* update script

* Update readme
2023-03-07 17:44:30 +08:00
w5688414
e40e40be09 [Neural Search] change output_emb_size to self.ptm.config.hidden_size (#5127)
* change output_emb_size to self.ptm.config['hidden_size']

* Update applications/neural_search/recall/milvus/base_model.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update applications/neural_search/recall/milvus/base_model.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update applications/neural_search/recall/simcse/model.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* change to self.ptm.config.hidden_size

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-03-07 16:40:59 +08:00
Sijun He
ee390a697f test=release (#5134) 2023-03-07 16:29:51 +08:00
小小的香辛料
1382201e6d [Roformerv2 P0] Add PretrainedConfig and unit tests (#5131)
* Refactor RoFomerV2 usage

* add configuration and modeling

* [RoFormerv2 P0] Refactor RoFormerv2 usage

* fix issues raised in PR
2023-03-07 14:56:56 +08:00
gongenlei
f152050201 Fix mt5 config and add auto (#5129)
* fix mt5 config and add auto

* update unitest
2023-03-07 14:55:45 +08:00
Linjie Chen
5d053f646f [DocParser] Add bbox check (#5132)
* check bbox

* Update
2023-03-07 14:54:25 +08:00
wawltor
fa71eeec48 add the gpt-3 of model zoo (#5133) 2023-03-07 14:36:09 +08:00
Noel
18287d3a85 [UTC] Support single-label and multiple-label classification (#5083) 2023-03-07 10:41:09 +08:00
w5688414
35be940d8e Add semantic search taskflow API for pipelines (#4792)
* Add semantic search taskflow API for pipelines

* code refactoring and Add title indexing

* Add text_feature_extraction.py

* Add rocketqav2 and ernie search support

* Add rocketqa 3.0 models

* Try to fix the windows dtype bug

* Add rocketv2 and ernie-search support

* Add ernie-search comments

* Add unitest for text encoder and text similarity

* Add text feature extraction unittest

* Fix protobuf to 3.20

* Update gpu configs

* Add feature extraction usage examples

* Update test_multimodal_feature_extraction.py

* Update README docs
2023-03-07 10:25:52 +08:00
Jiaqi Liu
be80a3e30f Fix dead link in compression api (#5125)
* fix dead link, test=document_fix

* fix dead link, test=document_fix
2023-03-06 20:23:18 +08:00
zhang junjun
ec29e4f302 fix ernie-csc depoly core dumped (#5117)
* fix ernie-csc depoly core dumped

* fix codestyel
2023-03-06 20:13:56 +08:00
wuxin
ccfb7741fd Add MRR metric (#5097)
* add MRR to metrics

* add MRR to metrics

* add MRR to metrics

* add MRR to metrics

* add MRR to metrics
2023-03-06 20:03:51 +08:00
zqw_1997
920ce29b2e [Fluid] Change paddle.fluid.layers.utils to paddle.utils (#5121) 2023-03-06 19:07:01 +08:00
Jack Zhou
9989d600c2 [FastDeploy] Add ernie-m fastdeploy example (#4891)
* Add ernie-m doc

* Add inference scripts

* Add README

* update readme

* remove predictor

* Add fastdeploy test

* update requirements

* Add extra index url

* remove extra

* Add seq cls infer

* add extra-index-url

* Add comment

* remove install fastdeploy

* Update option

* Update doc
2023-03-06 16:18:43 +08:00
Jack Zhou
ce18df0272 [FastDeploy] Add bert fastdeploy example (#5003)
* Add infer script

* Add Bert deploy readme

* Update runtime option

* Update readme

* paddle->paddle_infer

* Update doc

* update doc

* update doc and remove predict scripts

* remove glue
2023-03-06 15:28:56 +08:00
gongenlei
cfc5a4723a Fuse qkv and fix bart decoding (#5111)
* fix bart decoding and fuse qkv

* add more args
2023-03-06 15:22:06 +08:00
w5688414
e7e4fa558f Remove sigmoid for paddle inference (#5109) 2023-03-06 14:58:03 +08:00
Linjie Chen
ae4e48c4ac fix uie-m and add unit test (#5108)
* fix uie-m

* update

* update config
2023-03-06 14:46:52 +08:00
yujun
4cadf62e5f fix sde vp dead link (#5115) 2023-03-06 14:44:41 +08:00
Jack Zhou
b820477cf0 [FastTokenizer] Fix ernie 3.0 of fast_tokenizer deadlink (#5116)
* fix ernie 3.0 deadlink

* Update link
2023-03-06 14:43:49 +08:00
chenxujun
2ad9117998 Change instr to outstr (#4558)
The first instr.strip is not use, change instr to outstr
2023-03-06 13:28:59 +08:00
Jack Zhou
cd9ac32b07 [FastDeploy] Add ernie 1.0 fd (#5004)
* Add ernie 1.0 fd

* update readme of ernie 1.0

* update option

* update doc

* remove predict_chnsenticorp.py

* update doc

* update demo output

* update doc
2023-03-06 10:45:19 +08:00
westfish
f6cf94de48 [PPDiffusers] Add ControlNet Anatator and Gradio (#5089) 2023-03-03 22:27:18 +08:00
yujun
8bdf65b3ad update ema model (#5090) 2023-03-03 21:22:20 +08:00
Linjie Chen
9e232300a3 Update unit test for Taskflow UIE (#5075)
* update unit test for UIE

* refine unit test

* update dependency
2023-03-03 13:38:15 +08:00
Linjie Chen
8c4b03bede fix label-studio example (#4812) 2023-03-03 11:37:28 +08:00
Sijun He
119baf0d59 fix styles (#5077) 2023-03-03 11:09:41 +08:00
w5688414
485ce9d86e flake8 pipelines examples,ui,restapi (#5078) 2023-03-03 11:06:08 +08:00
chenxiaozeng
b4f11f9c89 Update README.md (#5080) 2023-03-03 10:33:54 +08:00
yujun
95d2295553 [PPDiffusers] Add ControlNet (#5009)
* first commit

* text_encoder eval

* ema

* add gradio canny

* update

* update

* update

* update

* add paddle conv init

* update
2023-03-02 21:29:49 +08:00
yujun
350881005c typo (#5076) 2023-03-02 21:21:49 +08:00
w5688414
1e9c60af3e [paddle-pipelines] flake8 pipelines (#5073)
* flake8 pipelines

* Fix some bugs
2023-03-02 20:48:00 +08:00
yujun
709e87072b update proj dim (#5074) 2023-03-02 20:04:54 +08:00
w5688414
2edb82f7f2 Update python versioin to 3.7.3 and index_name (#4996) 2023-03-02 19:58:03 +08:00
lugimzzz
ddccc683bb 【bug fix】Text classification application&example (#5070)
* fix version problem
2023-03-02 18:38:46 +08:00
Milen
13634482f6 [SKEP P1] pass labels to forward function in examples/applications (#5067)
* initial commit

* refine readme

* refine codestyle

* refine readme

* refine readme

* fix model saving bug

* initial commit

* initial commit

* initial commit

* use common metric instead of eval_metrics.py and remove unuseful code

* mv stage project to ASO_analysis

* add unified sentiment analysis

* refine readme

* refine readme

* refnie readme

* add unified sentiment analysis

* refine readme

* initial commit

* initial commit

* refine readme

* add taskflow for sentiment analysis with UIE

* refine Readme

* refine readme.md

* support sentiment analysis (UIE) with inputing by file format

* refine readme

* delete predict scripts

* refine readme

* delete unuseful files

* add pipeline for sentiment_analysis

* merging with the newest code

* fix to convert data without synonyms

* add senta pipeline

* refine readme

* drop functions: inputting file and saving results

* add UIE-seta-[base, medium, mini, micro, nano]

* modify .gitignore to trace deploy code

* add deploy with SimpleServer

* add debug mode

* fix debug mode

* update the loading  method of UIE

* refine readme

* fix bug caused by version updating

* fix hard coding for model name.

* refine codestyle

* modify readme according the way of 'step by step'

* refine codestyl

* change saving txt to json files

* download font automatically when not input font_path

* change readme in the way 'step by step'

* add model prediction by batch

* add uie-senta-x to support_schema_list

* update sentiment analysis in taskflow

* add prediction with saved offline model

* change the exception exposure way

* add description for visual schema

* delete comments

* remove comments

* remove unused code and comments

* convert uie-senta-x model params to fit ernie/uie

* refine readme for sentiment analysis

* add running time

* refine readme for senta pipeline

* change uie-base to uie-senta-base

* load uie-senta-x with auto module

* add deploy with SimpleServer

* refine codestyle

* refine readme

* add uie-senta-x to support_schema_list

* fix hard coding for mdoel anme

* refine codestyle

* refine codestyl

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* fix senta response

* refine codestyle

* remove lambda expressions

* add link of senta pipeline

* refine codestyle

* remove local path

* fix typos

* refine readme

* load uie-senta-x with automodel

* remove commented code

* restore auto

* add link of hotel dataset to readme.

* add link for downloading test_hotel.txt

* fix url problem for server and client

* refine readme

* fix for senta_examples.py

* update visualization function

* update visualization function

* refine readme and update visualization description

* update visualization function

* refine readme and update visualization function

* change logger in PaddleNLP to log information

* fix running time for skep and uie

* fix bug to solve tokenizer updating problem

* refine label-studio readme

* refine label-studio readme

* refine label-studio readme

* optimize example construction for a, o, as, ao extraction task

* add the labeling method for ext task: a,  as, ao and so on.

* add note for visual_analysis.py

* change link for downloading data and refine log output

* refine log output

* refine readme

* expose options interface

* refine readme

* modify typos

* expose options for customing sentiment analysis

* README.md

* fix bug for param is_shuffle in label_studio.py

* [BugFix] Fix the param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [Model Update] add configuration for skep model.

* [Transformer Update] update skep and add related unittest

* [Skep Update] fix examples and taskflow

* [Transformer Update] update skep examples for sentiment analysis

* [Transformer Update] update skep examples for sentiment analysis

* [Transformer Update] CodeStyle for examples/skep/*

* [Transformer Update] examples/skep done

* [Transformer Update] refine readme in examples/skep

* [Transformer Update] initial skep tests done.

* [Skep Upgrade] add skep in taskflow tests

* [Skep Upgrade] add tests for skep in taskflow

* [Skep Upgrade] remove yapf in examples/skep

* [Skep P0] remove print

* [SKEP P0] fix the param ckpt_dir in predict scripts

* [SKEP P0] fix the param ckpt_dir for skep examples.

* [SKEP P0] fix ci_case

* [SKEP P0] remove tiny_random_bert taskflow/test_sentiment_analysis

* [SKEP P0] add tiny-random-skep as code comment

* [SKEP P0] using tiny_random_skep for tests in case of OOM at test machine.

* [SKEP P0] add taskflow prediction for examples/skep/sentence

* [SKEP P0] add __internal_testing__/tiny-random-skep as taskflow model

* [SKEP P1] fix return parameters for SkepCrfForTokenClassification

* [SKEP P1] pass labels to forward for examples

* [SKEP P1] pass labels to forward for applications

---------

Co-authored-by: tianxin <tianxin04@baidu.com>
2023-03-02 16:48:23 +08:00
Sijun He
3b6db41f57 test (#5068) 2023-03-02 16:47:03 +08:00
Sijun He
33fea90b16 Fix styles (#5064)
* fix data

* datasets

* embeddings

* experimental

* layers

* metrics

* ops

* server

* trainer

* transformers

* fix datasets
2023-03-02 15:21:53 +08:00
Milen
023fc9072e [SKEP P1] fix return params for SkepCrfForTokenClassification (#5063)
* initial commit

* refine readme

* refine codestyle

* refine readme

* refine readme

* fix model saving bug

* initial commit

* initial commit

* initial commit

* use common metric instead of eval_metrics.py and remove unuseful code

* mv stage project to ASO_analysis

* add unified sentiment analysis

* refine readme

* refine readme

* refnie readme

* add unified sentiment analysis

* refine readme

* initial commit

* initial commit

* refine readme

* add taskflow for sentiment analysis with UIE

* refine Readme

* refine readme.md

* support sentiment analysis (UIE) with inputing by file format

* refine readme

* delete predict scripts

* refine readme

* delete unuseful files

* add pipeline for sentiment_analysis

* merging with the newest code

* fix to convert data without synonyms

* add senta pipeline

* refine readme

* drop functions: inputting file and saving results

* add UIE-seta-[base, medium, mini, micro, nano]

* modify .gitignore to trace deploy code

* add deploy with SimpleServer

* add debug mode

* fix debug mode

* update the loading  method of UIE

* refine readme

* fix bug caused by version updating

* fix hard coding for model name.

* refine codestyle

* modify readme according the way of 'step by step'

* refine codestyl

* change saving txt to json files

* download font automatically when not input font_path

* change readme in the way 'step by step'

* add model prediction by batch

* add uie-senta-x to support_schema_list

* update sentiment analysis in taskflow

* add prediction with saved offline model

* change the exception exposure way

* add description for visual schema

* delete comments

* remove comments

* remove unused code and comments

* convert uie-senta-x model params to fit ernie/uie

* refine readme for sentiment analysis

* add running time

* refine readme for senta pipeline

* change uie-base to uie-senta-base

* load uie-senta-x with auto module

* add deploy with SimpleServer

* refine codestyle

* refine readme

* add uie-senta-x to support_schema_list

* fix hard coding for mdoel anme

* refine codestyle

* refine codestyl

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* fix senta response

* refine codestyle

* remove lambda expressions

* add link of senta pipeline

* refine codestyle

* remove local path

* fix typos

* refine readme

* load uie-senta-x with automodel

* remove commented code

* restore auto

* add link of hotel dataset to readme.

* add link for downloading test_hotel.txt

* fix url problem for server and client

* refine readme

* fix for senta_examples.py

* update visualization function

* update visualization function

* refine readme and update visualization description

* update visualization function

* refine readme and update visualization function

* change logger in PaddleNLP to log information

* fix running time for skep and uie

* fix bug to solve tokenizer updating problem

* refine label-studio readme

* refine label-studio readme

* refine label-studio readme

* optimize example construction for a, o, as, ao extraction task

* add the labeling method for ext task: a,  as, ao and so on.

* add note for visual_analysis.py

* change link for downloading data and refine log output

* refine log output

* refine readme

* expose options interface

* refine readme

* modify typos

* expose options for customing sentiment analysis

* README.md

* fix bug for param is_shuffle in label_studio.py

* [BugFix] Fix the param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [Model Update] add configuration for skep model.

* [Transformer Update] update skep and add related unittest

* [Skep Update] fix examples and taskflow

* [Transformer Update] update skep examples for sentiment analysis

* [Transformer Update] update skep examples for sentiment analysis

* [Transformer Update] CodeStyle for examples/skep/*

* [Transformer Update] examples/skep done

* [Transformer Update] refine readme in examples/skep

* [Transformer Update] initial skep tests done.

* [Skep Upgrade] add skep in taskflow tests

* [Skep Upgrade] add tests for skep in taskflow

* [Skep Upgrade] remove yapf in examples/skep

* [Skep P0] remove print

* [SKEP P0] fix the param ckpt_dir in predict scripts

* [SKEP P0] fix the param ckpt_dir for skep examples.

* [SKEP P0] fix ci_case

* [SKEP P0] remove tiny_random_bert taskflow/test_sentiment_analysis

* [SKEP P0] add tiny-random-skep as code comment

* [SKEP P0] using tiny_random_skep for tests in case of OOM at test machine.

* [SKEP P0] add taskflow prediction for examples/skep/sentence

* [SKEP P0] add __internal_testing__/tiny-random-skep as taskflow model

* [SKEP P1] fix return parameters for SkepCrfForTokenClassification

---------

Co-authored-by: tianxin <tianxin04@baidu.com>
2023-03-02 14:33:25 +08:00
ELLIOTT
790ab167e0 [Artist P0] add PretrainedConfig and unit test (#4992)
* "add pretraing config and unit test"

* "add tokenizer test"

* "fix bug"

* "fix"

* Apply suggestions from code review

Co-authored-by: 骑马小猫 <1435130236@qq.com>

* retrigger checks

---------

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2023-03-02 14:19:44 +08:00
Sijun He
40b9f1e9a6 Add UTC taskflow unit test (#5052) 2023-03-02 13:02:16 +08:00
liu zhengxi
40180768e9 adjust python libs (#5030) 2023-03-02 09:52:20 +08:00
Andy
fdc4e03737 Update requirements.txt (#5054) 2023-03-01 23:38:54 +08:00
zhang junjun
8b1e3b57de fix ernie-1.0 typo (#5049) 2023-03-01 20:20:07 +08:00
zhang junjun
afa34599c2 run examples when API changed (#5042) 2023-03-01 18:57:17 +08:00
zhang junjun
1e02bf84f4 change ernie-1.0 datasets (#5040) 2023-03-01 17:37:10 +08:00
lugimzzz
e8237674f3 unify trial_id trial_name trial_dir (#5031) 2023-03-01 16:43:16 +08:00
liu zhengxi
ef6c18d066 alter t5 lr (#5034) 2023-03-01 15:58:47 +08:00
Jack Zhou
cd9d29f470 [PPDiffuers] Add CycleDiffusion based on FastDeploy (#4945)
* Add pipeline_fastdeploy_cycle_diffusion.py

* Add cycle diffusion example

* remove cast

* fix vae encoder

* Fix pipeline bug

* Add none paddle_stream

* Add paddle_stream None

* Add synchronize

* Fix cycle diffusion

* Add benchmark steps

* Update cycle diffusion

* pd->np

* add numpy()

* use_trt=False

* Cast to float32

* np -> pdtensor

* Update new api
2023-03-01 15:48:49 +08:00
lugimzzz
98b4a91701 [AutoNLP] compress (#5024)
* add compress & predict

* fix test

* delete part of multi label test

* fix

* fix

* add compress in export and duplicate check
2023-03-01 14:47:55 +08:00
Qinghua Zhang
4e5df921ff [Reformer P1] Add loss, return_dict, hidden and attention outputs (#4981)
* reformer_upgrade_p1

* modefied

* modefied

* modefied

* modefied
2023-03-01 13:57:45 +08:00
小小的香辛料
b818ea1668 [Model Zoo] Refactor Bert usage in Model Zoo (#4851)
* [Model Zoo] Refactor Bert usage in Model Zoo
2023-03-01 10:47:37 +08:00
w5688414
91b6d44bfb change expit to softmax (#5006) 2023-02-28 22:44:52 +08:00
Milen
428c21a246 [SKEP P0] update skep model and it's tests, examples. (#4954)
* initial commit

* refine readme

* refine codestyle

* refine readme

* refine readme

* fix model saving bug

* initial commit

* initial commit

* initial commit

* use common metric instead of eval_metrics.py and remove unuseful code

* mv stage project to ASO_analysis

* add unified sentiment analysis

* refine readme

* refine readme

* refnie readme

* add unified sentiment analysis

* refine readme

* initial commit

* initial commit

* refine readme

* add taskflow for sentiment analysis with UIE

* refine Readme

* refine readme.md

* support sentiment analysis (UIE) with inputing by file format

* refine readme

* delete predict scripts

* refine readme

* delete unuseful files

* add pipeline for sentiment_analysis

* merging with the newest code

* fix to convert data without synonyms

* add senta pipeline

* refine readme

* drop functions: inputting file and saving results

* add UIE-seta-[base, medium, mini, micro, nano]

* modify .gitignore to trace deploy code

* add deploy with SimpleServer

* add debug mode

* fix debug mode

* update the loading  method of UIE

* refine readme

* fix bug caused by version updating

* fix hard coding for model name.

* refine codestyle

* modify readme according the way of 'step by step'

* refine codestyl

* change saving txt to json files

* download font automatically when not input font_path

* change readme in the way 'step by step'

* add model prediction by batch

* add uie-senta-x to support_schema_list

* update sentiment analysis in taskflow

* add prediction with saved offline model

* change the exception exposure way

* add description for visual schema

* delete comments

* remove comments

* remove unused code and comments

* convert uie-senta-x model params to fit ernie/uie

* refine readme for sentiment analysis

* add running time

* refine readme for senta pipeline

* change uie-base to uie-senta-base

* load uie-senta-x with auto module

* add deploy with SimpleServer

* refine codestyle

* refine readme

* add uie-senta-x to support_schema_list

* fix hard coding for mdoel anme

* refine codestyle

* refine codestyl

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* refine codestyle

* fix senta response

* refine codestyle

* remove lambda expressions

* add link of senta pipeline

* refine codestyle

* remove local path

* fix typos

* refine readme

* load uie-senta-x with automodel

* remove commented code

* restore auto

* add link of hotel dataset to readme.

* add link for downloading test_hotel.txt

* fix url problem for server and client

* refine readme

* fix for senta_examples.py

* update visualization function

* update visualization function

* refine readme and update visualization description

* update visualization function

* refine readme and update visualization function

* change logger in PaddleNLP to log information

* fix running time for skep and uie

* fix bug to solve tokenizer updating problem

* refine label-studio readme

* refine label-studio readme

* refine label-studio readme

* optimize example construction for a, o, as, ao extraction task

* add the labeling method for ext task: a,  as, ao and so on.

* add note for visual_analysis.py

* change link for downloading data and refine log output

* refine log output

* refine readme

* expose options interface

* refine readme

* modify typos

* expose options for customing sentiment analysis

* README.md

* fix bug for param is_shuffle in label_studio.py

* [BugFix] Fix the param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [BugFix] Fix the bool param is_shuffle problem

* [Model Update] add configuration for skep model.

* [Transformer Update] update skep and add related unittest

* [Skep Update] fix examples and taskflow

* [Transformer Update] update skep examples for sentiment analysis

* [Transformer Update] update skep examples for sentiment analysis

* [Transformer Update] CodeStyle for examples/skep/*

* [Transformer Update] examples/skep done

* [Transformer Update] refine readme in examples/skep

* [Transformer Update] initial skep tests done.

* [Skep Upgrade] add skep in taskflow tests

* [Skep Upgrade] add tests for skep in taskflow

* [Skep Upgrade] remove yapf in examples/skep

* [Skep P0] remove print

* [SKEP P0] fix the param ckpt_dir in predict scripts

* [SKEP P0] fix the param ckpt_dir for skep examples.

* [SKEP P0] fix ci_case

* [SKEP P0] remove tiny_random_bert taskflow/test_sentiment_analysis

* [SKEP P0] add tiny-random-skep as code comment

* [SKEP P0] using tiny_random_skep for tests in case of OOM at test machine.

* [SKEP P0] add taskflow prediction for examples/skep/sentence

* [SKEP P0] add __internal_testing__/tiny-random-skep as taskflow model

---------

Co-authored-by: tianxin <tianxin04@baidu.com>
2023-02-28 21:04:36 +08:00
lugimzzz
4ae2b03dbb [AutoNLP]optimize log (#5021)
* optimize log

* fix test

* fix

* fix
2023-02-28 21:02:44 +08:00
Sijun He
00d842b51b Fix taskflow custom_model download issue (#4984)
* changes

* fix unit test

* hardcode plato

* hardcode ernievil

* fix text similarity
2023-02-28 19:13:49 +08:00
w5688414
1c01e6f87a fix max_seq_len bug (#5017) 2023-02-28 15:22:11 +08:00
Sijun He
4e93939980 Fix cache dir issue for Model, Config and Tokenizer (#5013)
* changes

* remove prints

* address comments
2023-02-28 12:54:04 +08:00
Yam
62a30227f1 Update pipelines of community and add code samples (#4947)
* update interpolate_stable_diffusion.py and add code sample

* update stable_diffusion_mega and add code sample

* update lpw_satable_diffusion and add code sample

* remove todo from readme

* another prompt for lpw
2023-02-28 10:46:48 +08:00
Qinghua Zhang
c35b670699 [BigBird P0] Add PretrainedConfig and unit tests (#4961)
* add unite test to reformer

* configuration_upgrade

* test_tokenizer升级

* Lint

* Lint

* Lint

* Lint

* bigbird_upgrade

* __init__ add

* __init__

* modefied
2023-02-28 09:59:39 +08:00
chenxiaozeng
1eabf866de Update README.md (#5011) 2023-02-27 22:26:14 +08:00
lugimzzz
c19d9aa73d [AutoNLP]add visualdl (#4990)
* add visualdl
2023-02-27 21:13:23 +08:00
gongenlei
a345ca7911 add models for summ (#4933) 2023-02-27 10:52:25 +08:00
Kai Song
b1428e6e49 add Custom NPU support for several models (#4956)
* add Custom NPU support for several models

* modify format

* revert pretrain model of ernie-matching
2023-02-27 10:27:33 +08:00
chenxujun
d2c8174020 Fix typos (#4994) 2023-02-25 01:08:51 +08:00
Pikaman
7aaee596c4 fix: 当使用了多路召回并且搜索字段设置了除content的其他字段,构建索引时其他字段也需要设置,例如:['content', 'name'] (#4987) 2023-02-24 20:30:16 +08:00
WangXi
2007f89bad [GPT-3] fix static gpt3 generation attention_mask (#4986) 2023-02-24 20:19:22 +08:00
lugimzzz
ee78a00b30 fix prompt compute loss without criterion (#4985) 2023-02-24 15:42:33 +08:00
lugimzzz
f38a255326 [AutoNLP]add predict (#4967)
* add_predict

* fix

* fix
2023-02-24 15:22:28 +08:00
Sijun He
edf6fef000 [CodeStyle] fix taskflow (#4982)
* dependency parsing

* fix lexical

* fix lexical

* fix lexical

* poetry

* poetry

* qa

* text correction

* text generation

* seg
2023-02-24 15:12:04 +08:00
w5688414
1a0af2b2be relsease pipelines 0.5.0 version (#4976)
* relsease pipelines 0.5.0 version

* Update requirements.txt
2023-02-24 14:00:50 +08:00
ELLIOTT
a27b4b18ff [MegatronBERT P0] add PretrainedConfig and unit test (#4912)
* "commit megatronbert configuration"

* "tokenizer test"

* ”add unit test“

* "fix bug"

* "fix bug"

* ”fix bug“

* "fix bug"

* fix bug

* "fix bug"

* "fix bug"

* "fix"

* retrigger checks
2023-02-24 13:13:42 +08:00
Noel
d812834bf6 [MobileBert P0] Add PretrainedConfig and unit tests (#4953)
* [mobilebert p0] add pretrained config and unittest

* [mobilebert] add config

* update implementation
2023-02-24 11:48:09 +08:00
ronnywang
3e6565d8d8 fix tokenizer pad (#4974) 2023-02-24 11:44:07 +08:00
Linjie Chen
309fbfc585 fix doc parser (#4975) 2023-02-24 11:42:27 +08:00
w5688414
46eb86cdbd Add ernie vil2.0 finetune (#4508)
* Add ernie vil2.0 finetune

* Add Cross batch strategy

* Update ernivil 2.0 docs and configs

* Add unittest for ernievil

* Remove unused comments

* check codestyle

* rename pretrain  to finetune

* force no check run_finetune

* rename data to data_util

* Remove unused comments and Update readme

* Add Fastdeploy support

* Update test tiny model config

* Remove Flicker30k small dataset

* Add taskflow README

* Format the comments

* Remove training scripts
2023-02-23 22:08:00 +08:00
Milen
5819c3f781 [Add Model] add nystromformer model. (#4897)
1. add nystromformer model
2. add nystromformer's tests
3. support load nystromformer model and tokenizer with auto module
2023-02-23 20:18:56 +08:00
chenxujun
44405380aa Fix typos (#4959) 2023-02-23 20:04:28 +08:00
Yam
f354fe6ad8 [ERNIE-M] Using gpu in CI case script and add more data for testing (#4958) 2023-02-23 17:08:45 +08:00
Sijun He
703a7d9a88 Debug auto test_modeling.py (#4957)
* Update test_modeling.py

* Update test_modeling.py

* Update test_modeling.py

* Update test_modeling.py

---------

Co-authored-by: zhang junjun <1834792141@qq.com>
2023-02-23 16:06:25 +08:00
yujun
b68c8dc6ed [PPDiffusers] Update lora rank (#4925)
* update lora

* update text2img lora rank
2023-02-23 15:25:57 +08:00
Wang Bojun
1248c7b690 Silu op opt disable by default (#4849)
* modify some code

* add some code

* add some code

* add some code

* silu opt disable by default and enable on sd export

* silu opt disable by default and enable on sd export

* code-style refine

* code refine and style fix

* code refine

* code refine

* specific unet with silu opt

* use unet

* refine

* bugfix

* bugfix

---------

Co-authored-by: mengziheng <121283369+mengziheng@users.noreply.github.com>
2023-02-23 15:19:22 +08:00
wawltor
83ba301644 Update taskflow.md 2023-02-23 11:25:37 +08:00
Sijun He
69474be068 [AutoNLP] small fix (#4946)
* fix small things for autonlp

* changes
2023-02-23 10:28:22 +08:00
yujun
cd0afab251 [Trainer] add dp_group and exclude_layer params (#4930)
* add dp_group and exclude_layer params

* update

* update
2023-02-23 09:42:41 +08:00
duanyanhui
b5c48402c6 [NPU] Optim UIE model for NPU (#4781)
* optimize uie for npu

* fix label padding

* add dynamic_length for taskflow-uie

* modify application doc and code

* fix uie-x bug

* fix ci

* Update README.md

---------

Co-authored-by: linjieccc <623543001@qq.com>
2023-02-22 22:15:16 +08:00
Yam
82bd9b1897 add DDIM to CLIP Guided Stable Diffusion and add code example (#4920)
* add DDIM to CLIP Guided Stable Diffusion and add example code

* modify code sample

* use generator and modify code sample
2023-02-22 15:31:47 +08:00
Zhong Hui
9a00c1541a [Fluid] Fix fluid sync params buffers. (#4878) 2023-02-22 15:17:03 +08:00
w5688414
75f313020c Fix clip forward_post (#4928) 2023-02-22 13:14:05 +08:00
Sijun He
6fcd0932e1 [AutoNLP] setup log to file function by adding a trainer integration (#4919)
* working

* importlib

* modified

* fix test
2023-02-22 13:08:18 +08:00
chenxujun
22cae3480a Update README.md (#4918) 2023-02-22 12:33:39 +08:00
yujun
26e7b2f7db remove epoch (#4906) 2023-02-21 15:34:49 +08:00
lugimzzz
9497c547fe [autonlp] text classification fix& add taskflow config file (#4896)
* fix

* add test

* fix

* fix
2023-02-21 15:34:22 +08:00
zhang junjun
8d0801e9ce Fix pipelines install (#4902)
* Change ernie-1.0 to ernie-1.0-base-zh

* [CI] fix pipelines install
2023-02-21 13:52:16 +08:00
tsinghua-zhang
1a06c38b57 [Reformer P0] Add PretrainedConfig and unit tests (#4841)
* add unite test to reformer

* configuration_upgrade

* test_tokenizer升级

* Lint

* Lint

* Lint

* Lint
2023-02-21 11:47:48 +08:00
AlexRainHao
e6e58099f4 fix: fix issue #4801 (#4890)
* fix: fix issue #4801

This commit try to fix #4801, which may break `doc_vqa` application.
This issue effected by `paddleocr` with version > 2.6, it changed ocr
result data structure

* style: lint ocr processing code following `flake8`
2023-02-21 11:32:45 +08:00
Linjie Chen
178bc63d6c Fix uie predictor for multilingual models (#4761)
* fix uie predictor

* update
2023-02-21 10:14:59 +08:00
gongenlei
db2bd1adb9 add codegen 16b sample (#4895) 2023-02-21 10:14:02 +08:00
yujun
5785d07a03 update lora (#4894) 2023-02-21 01:10:58 +08:00
w5688414
99a020437e Convert return_tensors to str (#4898)
* Convert return_tensors to str

* rename functions
2023-02-21 01:04:26 +08:00
Sijun He
6e9e0f0e50 fix typo (#4886) 2023-02-21 01:03:19 +08:00
Yam
23ef2a7e43 [ERNIE-M] Fix layerwise decay ratio to model_zoo/ernie-m (#4892) 2023-02-20 20:51:50 +08:00
zhang junjun
c5d9c9e204 Change ernie-1.0 to ernie-1.0-base-zh (#4893) 2023-02-20 19:27:06 +08:00
Yam
dd376ce429 [ModelZoo] Refactor ERNIE-M usage in Model Zoo (#4324)
* update model_zoo/ernie-m

* add logging eval infomations

* delete unused testing code

* add tests samples for xnli

* fewer tests samples for xnli

* add predict and export

* add predictor and serving

* fix export error when training with data parallelism

* fix mkdir error in distributed training and use ERNIEMHandler

* adjust predictor

* modify ci accroding to #4398 and adjust predictor

* enable load tiny dataset for ci

* support testing infer with precision_mode fp16

* modify ci script

* Update ci_case.sh

* enable to test inputs_embeds for enire-m

* fix ci script

* fix using fast tokenizer

* using set_optimizer_grouped_parameters instead

* consturct optimizer with layerwise_lr_decay out of Trainer
2023-02-20 16:05:37 +08:00
Sijun He
a776002e8c add test (#4879) 2023-02-20 15:24:51 +08:00
LazyFyh
da6c908e48 Fix mt5 test (#4884) 2023-02-20 15:24:40 +08:00
骑马小猫
9d8732af7e [New features] add AutoConfig supporting (#4836)
* add autoconfig

* update testing for auto-config

* improve typo

* fix lint

* update auto-configuration

* add legacy config file supporting

* add comment for legacy_config_file
2023-02-20 14:52:08 +08:00
Sijun He
1a3e753798 add dialogue taskflow test (#4882) 2023-02-20 14:39:31 +08:00
Sijun He
2eb3473141 [Roberta P2] add inputs_embeds and type hints (#4746)
* input embeddings

* inputs embeds

* add return_dict logic
2023-02-20 14:39:21 +08:00
w5688414
c5fa6bc699 Add tiny-random-ernievil2 for testring (#4881) 2023-02-20 14:27:42 +08:00
Sijun He
d2ffb89ad5 Fix config cache dir (#4877)
* release 2.5.1

* fix
2023-02-20 14:10:57 +08:00
yujun
dde0f055ac [PPDiffusers] add_cycle_diffusion_space (#4830)
* first

* add License and update docs
2023-02-20 13:02:23 +08:00
chenxujun
4851d32db2 Fix some words (#4562)
Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-02-20 12:11:17 +08:00
Jack Zhou
fab4a86c36 [FastTokenizer]fix windows import (#4875)
* fix windows import

* Fix windows import
2023-02-20 00:29:05 +08:00
Zhong Hui
2efc3b83c5 Update train.py (#4690) 2023-02-19 13:01:49 +08:00
Sijun He
50cd4cf738 release 2.5.1 (#4871) 2023-02-17 20:34:43 +08:00
zhang junjun
080aeb8ebf [CI] add ernie-layout & uie (#4868)
* [CI] remove stacl wk-3

* [CI] add ernie-layout & uie

* update

* update
2023-02-17 20:15:10 +08:00
lugimzzz
886834eeb1 [autonlp]add prompt candidates for text classification (#4867)
* add prompt candidates

* fix
2023-02-17 20:11:57 +08:00
lugimzzz
33be7e59b0 add test (#4865) 2023-02-17 17:08:08 +08:00
w5688414
2e487edc7e Fix DataCollatorWithPadding for force transform into np.64 (#4861) 2023-02-17 17:06:14 +08:00
Sijun He
093dd7ed9c Update doccano.py 2023-02-17 16:58:42 +08:00
chenxiaozeng
9f78fa5685 add rfc_template (#4854) 2023-02-17 15:07:33 +08:00
Yam
fa18d20f80 [Trainer] Support Trainer to use dataset dict for evaluation in training (#4778)
* support dataset dict for evaluation during training
2023-02-17 15:07:19 +08:00
lugimzzz
bb76b09d63 [autonlp] add text classifcation taskflow (#4815)
* from train to infer

* add taskflow arguments

* update

* fix

* fix

* fix

* fix
2023-02-17 14:00:46 +08:00
Sijun He
2180cae30e use upload_folder (#4828) 2023-02-17 11:05:03 +08:00
w5688414
f406a4df5c mv test_data_collator.py to test/data (#4843)
* mv test_data_collator.py to test/data

* set proper seed 3 for paddle.bernoulli

* remove unused comments
2023-02-17 10:41:52 +08:00
liu zhengxi
99eb861e77 Fix T5 to_static + amp by amp_state (#4783) 2023-02-17 10:11:58 +08:00
Sijun He
48d87a7f8c [AutoNLP] refactor verbosity for more effect log control (#4844)
* wip

* changes

* changes

* changes

* ready

* remove extra print
2023-02-17 10:01:29 +08:00
Noel
e0e9fe52ac [utc] set utc-base as default model (#4825) 2023-02-16 21:49:56 +08:00
Noel
e0a4aa42fe [few-shot] add redirection to UTC (#4780) 2023-02-16 21:49:35 +08:00
Sijun He
4770302f65 Support npu for ernie-3.0 run_qa (#4831)
* support qa

* verify fix
2023-02-16 21:23:36 +08:00
w5688414
b7ae09090b Add cosine scheduler, datacollator, update clip (#4826)
* Add cosine scheduler, DataCollatorForLanguageModeling, DataCollatorForWholeWordMask, Update CLIPVisionTransformer

* Fix datacollator comments

* Add data_collator unittest
2023-02-16 21:05:28 +08:00
yujun
9305134ccf enable bert benchmark (#4749) 2023-02-16 18:40:57 +08:00
Sijun He
3ac3ecbf20 [AutoNLP] switch to ernie-3.0-tiny-v2 models (#4827)
* changes
2023-02-16 17:12:59 +08:00
lugimzzz
11a343c9d2 update text classification application (#4810)
* update_text_classification_application
2023-02-16 16:42:02 +08:00
Sijun He
96d7df1b14 fix styles (#4823) 2023-02-16 15:27:05 +08:00
Pikaman
512d7464b2 fix: mt5 init (#4829) 2023-02-16 14:24:53 +08:00
gongenlei
ff0c88bd7a fix mt5 import (#4824) 2023-02-16 12:08:37 +08:00
MooTong123
a85752d63c enhancement: add simpleServing code for sentence transformers (#4795)
* enhancement: add simpleServing code for sentence transformers

* Update export_model.py

* enhancement: update simpleServing for sentence transformers

* pre-commit

* checkout code format

---------

Co-authored-by: Mu Tong <tong.mou@seaboxdata.com>
Co-authored-by: w5688414 <wugaosheng@mails.ccnu.edu.cn>
Co-authored-by: w5688414 <w5688414@gmail.com>
2023-02-16 09:56:07 +08:00
yujun
3ae3ea5335 [PPDiffusers] Add lora training scripts (#4768)
* add lora training script

* update

* update

* fix mkdir bug

* safety checker & ti bug

* rerun ci

* update text2img readme
2023-02-15 19:53:18 +08:00
Sijun He
dc5f5d82f6 Deprecate Distutils (#4518)
* styles

* fix lint
2023-02-15 19:52:38 +08:00
LazyFyh
a13e8776d2 Add MT5 model (#4765)
* Add MT5 model

* fix import bug

* fix typo and add TODO

* Add mt5 test case

* fix import bug

* empty message

* delete test_tokenizer
2023-02-15 17:11:43 +08:00
lugimzzz
9a02f87473 fix text classification taskflow (#4808) 2023-02-15 16:25:49 +08:00
Sijun He
8f97305cdc changes (#4806) 2023-02-15 14:47:51 +08:00
lugimzzz
1e656c5c30 unify id2label key type (#4804)
force merge due to problematic iPipe CI
2023-02-15 14:47:37 +08:00
Sijun He
e6a5a9f054 Fix cache_dir logic (#4794)
* fix

* wip

* tests

* changes

* update v2

* fix v2 logic

* fix v2

* fix config utils
2023-02-15 14:30:18 +08:00
lugimzzz
3f78be016c set ensure_ascii to False (#4803) 2023-02-15 11:51:46 +08:00
Wang Bojun
2b96999ecd StableDiffusion fastdeploy async inference, using share with external data ptr (#4764)
* scheduler lms direct call

merge fix

* add scale_model_input_preconfigured

* unitfy api

* update scale model input

* remove old preconfig api

* refine lmsd and euler-ances

* code style, remove preconfig fun

* code style

* fix euler unpreconfig bug

* move preconfig sheduler to invidival file

* code refine

* add test

* fix sd infer and fd pipeline

* add kwargs check and dummpy object

* fix fd async stable diffusion inference

* opt fd-sd pipeline

* remove unused comment, refine code style

* add h,w args for export model

* add delete pass, remove unused code
2023-02-15 10:54:33 +08:00
yujun
47fce7822a rm CLIP, ErnieViL, ChineseCLIP custom from_pretrained_v2 method (#4797) 2023-02-15 10:49:57 +08:00
wjx-sudo
a3335b1ed1 [T5] Add clue finetune scripts of trainer (#4626)
* Add T5 clue trainer
2023-02-14 23:22:01 +08:00
w5688414
2992a811c9 Add Image Text Retrieval taskflow&pipelines API (#4516)
* Add vision language taskflow API

* Update image text retrieval taskflow api

* Add multimodal_retriever of pipelines

* Add image text retrieval pipelines application

* Change image text retrieval to feature extraction

* Add feature extraction docs

* Add onnx support

* Fix some bugs and remove unused comments

* fix some errors and adjust onnx ouput config

* Update docs

* Add taskflow loading finetune model

* Rename mode to export_type

* Remove clip english models

* Add unit test for feature extraction taskflow

* set delta to 1e-5

* change delta to 1e-5

* change delta to 1e-5

* Change to is_static_model
2023-02-14 17:00:00 +08:00
Sijun He
33f897b3d8 Fix community url by removing os.path.join (#4758)
* input embeddings

* remove os path

* image process file

* remove roberta change
2023-02-14 16:51:15 +08:00
Noel
f9dbc4fa47 [utc] fix cls_positions gather (#4785) 2023-02-14 15:59:29 +08:00
lugimzzz
fe1bf5dcfa [autonlp] text classification bug fix (#4774) 2023-02-14 13:18:48 +08:00
lugimzzz
052fb5a365 update text classification taskflow (#4769) 2023-02-14 11:40:58 +08:00
yujun
a0699315b5 [Benchmark] enable ernie3.0 benchmark (#4751)
* enable ernie3.0 benchmark

* type

* rename
2023-02-14 11:08:37 +08:00
Jack Zhou
6a8eb74f36 [FastTokenizer] Add FastTokenizer abi=0 library (#4779)
* Add ABI0

* add -D_GLIBCXX_USE_CXX11_ABI

* Update readme.md
2023-02-13 20:23:52 +08:00
Jack Zhou
85f3d7cbe7 [FastDeploy] Update ernie 3.0 serving (#4703)
* init

* update serving link

* Update README

* remove predictor directory

* remove triton serving directory

* Add client

* update task table

* Add token cls serving pipeline

* ernie_tokenizer->ernie_tokencls_tokenizer

* add attention note

* Fix tokencls task

* Add seqcls server

* Add seqcls client

* update doc

* Add space
2023-02-13 17:30:27 +08:00
Linjie Chen
c453f51c24 fix offset mapping for uie-x (#4687) 2023-02-13 16:19:37 +08:00
Sijun He
68e3eea1a6 fix datasets styles (#4767) 2023-02-13 15:08:34 +08:00
Sijun He
2f9d5a48b1 [CodeStyle] Fix code styles under tests/ so that flake8 passes (#4766)
* input embeddings

* fix tipc styles

* reverse roberta

* fix unit test styles
2023-02-13 15:03:52 +08:00
Sijun He
8c90a335c1 Fix auto model bug when architectures and init_class fields are not in the config file (#4763)
* input embeddings

* wip

* fix bug

* add missing fiels

* changes
2023-02-13 14:33:01 +08:00
gongenlei
55fc1af1df Add BART converter and Chinese BART models (#4636)
* add bart converter and transfer chinese models

* update log
2023-02-13 13:42:31 +08:00
LazyFyh
e4bd4f3d09 Fix unimo-text shell typo (#4735)
* Fix unimo-text shell typo

* Fix typo in train.py
2023-02-12 23:00:56 +08:00
Jack Zhou
e73834944d update doc (#4756) 2023-02-11 11:52:47 +08:00
Jiaqi Liu
96b2493761 Fix ernie tiny in-domain data (#4744)
* fix ernie tiny in-domain data, test=document_fix

* fix ernie tiny in-domain data, test=document_fix
2023-02-10 17:06:20 +08:00
Jack Zhou
2c709a4021 update android package (#4745) 2023-02-10 16:40:57 +08:00
Jack Zhou
8ed67300da [FastTokenizer] Update ft version (#4742)
* update fast tokenizer version

* update version
2023-02-10 16:07:24 +08:00
Wang Bojun
494252e207 scheduler lms and euler_ancestral preconfigured step inference (#4579)
* scheduler lms direct call

merge fix

* add scale_model_input_preconfigured

* unitfy api

* update scale model input

* remove old preconfig api

* refine lmsd and euler-ances

* code style, remove preconfig fun

* code style

* fix euler unpreconfig bug

* move preconfig sheduler to invidival file

* code refine

* add test

* fix sd infer and fd pipeline

* add kwargs check and dummpy object
2023-02-10 15:43:11 +08:00
Noel
9505bc84d3 [utc] add small scale models (#4716) 2023-02-10 14:07:06 +08:00
yujun
be70fc4cff [NEW Model] Add BLIP Model & CLIP Interrogator (#4676)
* add BLIP & CLIP Interrogator

* update tests

* isort and add automodel

* add import

* rerun ci and test

* upload data to bos
2023-02-10 12:45:03 +08:00
lugimzzz
d74c879cb5 optimize text classification taskflow (finetune/prompt strategy) (#4723)
* optimize_text_classification_taskflow

* update_autonlp_cls_taskflow

* update
2023-02-10 12:16:19 +08:00
骑马小猫
f366928fab [Function optimization] revert gpt run_pretrain to enable tipc (#4702)
* revert gpt tipc

* update test_gpt & run_pretrain modeling init

* update gpt ci-case

* revert gpt2 train_infer_python.txt file

* update pytest run command in ci-case

* update run_pretrain_static
2023-02-09 21:28:27 +08:00
Jack Zhou
b7cccc532e [Models] Fix windows bug of lac (#4719)
* fix windows bug

* remove comments
2023-02-09 21:27:01 +08:00
zhang junjun
11928cbd79 add lexical_analysis (#4729) 2023-02-09 20:46:03 +08:00
Linjie Chen
f0a17aa924 Support recompute for ernie-layout (#4490)
* support recompute for ernie-layout

* update
2023-02-09 19:38:58 +08:00
LazyFyh
4ea8bfdccd Use SimpleServing in text_summarization (#4720)
* Use SimpleServing in text_summarization

* update finetuen README.md

* update README.md
2023-02-09 19:30:00 +08:00
zhang junjun
f1c395005b Fix paddlenlp install (#4722)
* fix paddlenlp install

* update
2023-02-09 17:14:48 +08:00
Sijun He
8652427343 chinesebert test_modeling (#4683) 2023-02-09 14:23:35 +08:00
Sijun He
3354848f59 [AutoNLP] Add english models for text classification (#4704)
* add english models

* add tests
2023-02-09 12:40:05 +08:00
Guo Sheng
b5b4ce4212 Remove Paddle fluid in paddle/__init__.py introduced by io patch (#4652)
* Remove Paddle fluid in paddle/__init__.py introduced by io patch.

* Update paddle version requirement in README
2023-02-09 11:40:16 +08:00
zhang junjun
feac42e0da fix paddlenlp install (#4706) 2023-02-09 11:27:25 +08:00
yujun
3264427dad disable_train_benchmark (#4707) 2023-02-09 11:27:08 +08:00
liu zhengxi
94e4b53f4e disable train benchmark temporarily (#4705) 2023-02-09 11:03:22 +08:00
LazyFyh
3ab7c61ed5 Add pretrained pegasus and Refactor text summarization (#4695)
* Add pretrained pegasus and Refactor text summarization

* Add README.md

* Fix format
2023-02-08 16:00:56 +08:00
Jack Zhou
29d438e33e [FastDeploy] Decrease the cost of h2d, d2h in the unet loop to imporve SD model performance (#4296)
* use to_dlpack

* remove useless comments

* move init device to start

* use from dlpack

* remove useless code

* Add pdtensor2fdtensor and fdtensor2pdtensor

* Add paddle.to_tensor

* remove numpy()

* Add Text-to-Image Generation demo

* Add img2img demo

* update doc

* Add summary

* update export model

* update doc

* update doc

* update img2img, inpaint

* update legacy infer

* Add pipeline legacy

* use pdtensor2fdtensor to update img2img

* Add inpaint legacy dlpack

* Add zero_copy_infer for FastDeployModelRuntime

* Add inpaint_infer.py

* use dlpack to update inpaint pipeline

* Add toc

* update images

* update doc
2023-02-08 15:36:21 +08:00
w5688414
4123eb9c21 [GAUAlpha P0] PretrainedConfig and model unit test (#4691)
* Add GAUAlpha unit test

* Remove unsed comments and trigger ci

* Add __init__.py

* Update paddlenlp/transformers/gau_alpha/tokenizer.py

Co-authored-by: 骑马小猫 <1435130236@qq.com>

* Update gau_alpha configuration

* Adjust self.config.num_hidden_layers in init_weights

---------

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2023-02-08 14:03:17 +08:00
w5688414
6efaf396c1 Add ernie vil unit test (#4679)
* Add ernie vil unit test

* Add copyright&missing files

* simplify the check json function

* simplify the check json function
2023-02-08 11:23:35 +08:00
gongenlei
6b03189eb8 FasterTransformer->FastGeneration (#4693) 2023-02-08 11:04:03 +08:00
liu zhengxi
7e843eb1bb fix dev prob (#4688) 2023-02-07 20:47:51 +08:00
wawltor
fb625292cd fix the simple server (#4689) 2023-02-07 20:13:01 +08:00
骑马小猫
270ff9487c [Performance optimization] improve unk in offset-mapping (#4557)
* improve unk in offsetmapping

* add joined-unk test case

* Update paddlenlp/transformers/tokenizer_utils.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* add joined-unk test

* update tokenizer emoji

* update clip tokenizer

* update gpt-tokenizer

* update gpt testing

* support offset-mapping in tokenizer

* fix robert bpe tokenizer

* update roberta & t5 tokenizer

* fix offset-mapping bug for t5 & ernie-layout

* update offset-mapping for t5 tokenizer

* Update tests/transformers/t5/test_tokenizer.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update tests/transformers/test_tokenizer_common.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update tests/transformers/codegen/test_tokenizer.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update tests/transformers/gpt/test_tokenizer.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-02-07 15:42:14 +08:00
zhang junjun
564ee56a74 Fix pytest notfound (#4678)
* fix pytest notfound

* update

* add python env
2023-02-07 15:25:12 +08:00
Jack Zhou
4a290409c9 update (#4680) 2023-02-07 15:21:10 +08:00
Jack Zhou
df5f73148c [FastTokenizer] Add faq (#4675)
* Add faq

* update doc

* update android doc

* Add lite shell

* Add lite compile

* Update doc

* add focus

* update doc
2023-02-07 14:02:26 +08:00
Sijun He
dcce376c43 Change icon to from python 3.6.2 to python 3.7 2023-02-07 11:56:35 +08:00
DefTruth
69202b3abd [Android] switch -> c++_shared for fast_tokenizer android lib (#4674)
* [Android] strip fast_tokenizer android lib

* [Android] strip fast_tokenizer android lib

* [Android] switch -> c++_shared for fast_tokenizer android lib
2023-02-07 11:41:07 +08:00
Sijun He
06124c88cb [PPDiffusers] implement save_to_hf_hub for pipelines, models, and Preprocessor (#4640)
* save_to_hf_hub

* commit message

* changes
2023-02-07 10:49:08 +08:00
liu zhengxi
6afc928d7d fix t5 in sampling (#4624) 2023-02-07 09:23:14 +08:00
DefTruth
2b168abda0 [Android] strip fast_tokenizer android lib (#4667)
* [Android] strip fast_tokenizer android lib

* [Android] strip fast_tokenizer android lib
2023-02-06 23:38:49 +08:00
骑马小猫
44c7d65c75 add download_check (#4660) 2023-02-06 19:57:32 +08:00
骑马小猫
67d82fd7f8 [New features] add conversion scripts for opt model (#4622)
* add conversion scripts for opt

* move file

* add comment to file
2023-02-06 17:24:05 +08:00
zhang junjun
0ece990fd9 fix pytest notfound (#4659)
* fix pytest notfound

* update
2023-02-06 17:19:14 +08:00
骑马小猫
3ae33fb180 support pre-release package (#4661) 2023-02-06 17:18:40 +08:00
Sijun He
5f3619b76f Update README.md 2023-02-06 17:06:30 +08:00
liu zhengxi
6124a2f74f adjust paddle develop (#4658) 2023-02-06 16:22:22 +08:00
yujun
68156b6a12 [Benchmark] Update gpt/bert/t5 optimizer (#4654)
* update optimizer sgd

* update learning rate 0.01
2023-02-06 13:33:51 +08:00
LazyFyh
116114a1df Fix pegasus decoder attention mask (#4638)
* fix pegasus decoder attention mask

* empty message
2023-02-06 12:05:46 +08:00
yujun
605c15618e [Benchmark] add G0 ernie3.0 cls benchmark (#4619)
* add G0 ernie3.0 cls benchmark

* compute words/sec

* update

* fix bug

* none
2023-02-06 09:47:29 +08:00
LazyFyh
7922ab75e9 fix args bug in SSTIA (#4646) 2023-02-05 21:57:02 +08:00
Jack Zhou
020805cebc [FastTokenizer] Add android doc desc (#4639)
* Add android doc desc

* Add icu_filters.json

* Add compile options
2023-02-03 23:06:27 +08:00
Sijun He
2f2e40a91f [PPDiffusers] add from_hf_hub to from_pretrained (#4625)
* from_pretrained works

* fix small things

* Update pipeline_utils.py

* fix cache_dir

* move cache_dir

* address cache_dir
2023-02-03 18:00:16 +08:00
yujun
6644c12bae [PPDiffusers] Add vae training (#4137)
* add vae train

* add example requirements

* update

* update default arguments

* update vae train code

* add kl-8 convert script and update vae training code

* add evaluate scripts | fid, psnr, ssim metric
2023-02-03 16:08:44 +08:00
liu zhengxi
18be55d4ca fix fg ci (#4633) 2023-02-03 11:27:21 +08:00
zhang junjun
57999a342d Uninstall cpu paddle (#4629)
* upodate install ways

* fix latest whl

* uninstall cpu paddle
2023-02-02 21:16:34 +08:00
liu zhengxi
edcf0a0fbf [Benchmark] Refine benchmark setting (#4627)
* update benchmark

* update
2023-02-02 21:12:00 +08:00
LazyFyh
52edce76df Fix the pegasus decoder attention mask bug (#4616)
* fix the pegasus decoder attention mask bug

* empty message
2023-02-02 20:44:42 +08:00
zhang junjun
71540c89e3 fix paddlenlp latest whl (#4620)
* upodate install ways

* fix latest whl
2023-02-02 11:11:29 +08:00
zhang junjun
a8bb7a933d upodate install ways (#4613) 2023-02-01 19:50:53 +08:00
Sijun He
bc43696fcc Remove our own filelock and use FileLock that is already in our dependency (#4607)
* remove filelock

* downloader

* filelock

* move decorator
2023-02-01 18:52:25 +08:00
Sijun He
d190283be6 [Nezha P2] Add inputs_embeds (#4605)
* loss and return_dict ready

* address comments

* add inputs_embeds

* remove commented code

* address comments

* fix output_hidden, output_attention
2023-02-01 17:48:14 +08:00
Sijun He
19f7623921 Fix tqdm in downloader (#4603)
* fix tqdm

* rtol -> atol
2023-02-01 15:05:46 +08:00
zhang junjun
a600b413d4 [CI] Update install ways (#4608)
* update install paddlenlp ways

* updata install ways
2023-02-01 15:01:47 +08:00
Noel
507b1f89f1 [prompt] add unittest for verbalizer (#4571) 2023-02-01 14:12:55 +08:00
骑马小猫
e6e0ac1a80 update pre-release version files (#4604) 2023-02-01 14:00:21 +08:00
liu zhengxi
a8a8338111 [Benchmark] Add BERT GPT T5 finetune process (#4492) 2023-02-01 12:22:29 +08:00
Sijun He
6b0b8f90dc Try to remove protobuf dependency (#4600) 2023-02-01 11:09:04 +08:00
骑马小猫
6d2e69d22f [New features] add version control by env (#4588)
* update version control

* fix typo

* update version control logic

* trigger cla
2023-02-01 10:21:12 +08:00
Sijun He
2abc332d14 [Nezha P1] Add loss, return_dict, hidden and attention outputs (#4596)
* loss and return_dict ready

* address comments
2023-02-01 00:00:19 +08:00
Jack Zhou
af01b52bf4 [FastDeploy] Add ernie3.0 fastdeploy inference demo (#4091)
* Add export model for ernie3.0 seq_cls and token_cls task

* update codestyle of export model

* Add python infer for fd ernie3.0

* update export model

* Add cpp demo for ernie 3.0 seq cls

* Add fd python token cls task

* update cpp seq cls task

* Add cpp token cls task

* update trt shape

* Add fastdeploy doc

* Update doc

* add batchfy text

* Remove export model

* Use AFQMC dataset in cpp example

* remove download model

* Update ernie 3.0 doc

* Add space

* add --model_prefix

* Update cpp readme

* Add kunlunxin

* Fix token cls

* update doc

* update python doc

* move fastdeploy to deploy

* update doc

* update doc

* Add fd framework

* add hardware and inference engine table

* update table

* Add quant demo
2023-01-31 22:23:52 +08:00
骑马小猫
0716cea6fb [Function optimization] revert gpt ci-case & add is_slow_test method (#4597)
* revert gpt ci-case & add is_slow_test method

* update default key logic

* refactor argv_context_guard method
2023-01-31 20:56:28 +08:00
LazyFyh
20d154cc1d Add TSDASG model and streaming mode dataset loader (#4408)
* add TSDASG model and streaming mode

* finish SSTIA model and update experiment results

* fix SSTIA detail code

* fix SSTIA detail code

* update reference in README.md

* update checkpoint instruction

* fix README.md
2023-01-31 19:05:09 +08:00
Sijun He
0f8fac866f Standardize Activation Fn (#4589)
* activations

* activations

* activations
2023-01-31 17:56:44 +08:00
chenxiaozeng
8d4f09625d Update README.md (#4561) 2023-01-31 17:26:56 +08:00
骑马小猫
3f419c4b99 support chineseclip model (#4585) 2023-01-31 15:27:58 +08:00
骑马小猫
7148926ce0 fix gpt slow test config (#4584) 2023-01-31 15:01:33 +08:00
zhang junjun
e926be597b update install paddlenlp ways (#4587) 2023-01-31 14:22:51 +08:00
Linjie Chen
05131d5da7 Add test_tokenizer.py for ERNIE-Layout (#4353)
* add test_tokenizer

* fix test_tokenizer

* fix unittests

* fix

* fix

* update ernie-layout tokenizer

* triger ci

---------

Co-authored-by: wj-Mcat <1435130236@qq.com>
2023-01-31 11:11:47 +08:00
骑马小猫
29bf84c0ca [New features] testing example of model zoo (#4398)
* update model-zoo test

* update config

* update model-zoo test

* update config for gpt

* add from_hf_hubarg

* update model-zoo gpt

* add export & infer test

* use with argv context

* update gpt testing

* update gpt configuration

* skip gpt-ci

* fix lint

* Update tests/model_zoo/test_gpt.py

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>

* update ci-case & config variable name

---------

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2023-01-31 10:31:29 +08:00
Sijun He
79d9a37012 fix tokenization logic (#4565)
confirmed that the PR fix the performance issue. Force merging to bypass the known CI bug
2023-01-31 00:16:19 +08:00
Jack Zhou
d6d597da19 [Tokenizer] Fix error when loading tokenizer from hf hub (#4570)
* Fix load tokenizer from hf hub

* remove slow test
2023-01-31 00:15:14 +08:00
Jiaqi Liu
6dc07c18a5 [Trainer] Fix trainer labels names bug (#4578) 2023-01-30 20:22:30 +08:00
Sijun He
e3484a0942 re-enable isort (#4577) 2023-01-30 20:15:15 +08:00
Sijun He
5de082e5e6 add unit tests and config (#4575) 2023-01-30 19:57:41 +08:00
骑马小猫
c4a065aba3 [Bug fixes] fix logit compare in autoconverter models (#4568)
* update model logit comparer

* reduce rtol to make test pass
2023-01-30 19:34:21 +08:00
lugimzzz
ac300e78ba fix (#4567) 2023-01-30 18:56:28 +08:00
Jack Zhou
955b04fabc [FastTokenizer] Update FastTokenizer doc (#4564)
* Add fast wordpiece demo

* Add tokenizer python demo

* Add cpp demo for tokenizer
2023-01-30 15:15:14 +08:00
骑马小猫
af708cd627 [Function optimization] Add test for autoconverter of Bert/GPT models (#4537)
* complete bert test for auto-converter

* complete gpt test for converter
2023-01-30 10:57:08 +08:00
Jack Zhou
6a0c50c9ad Update doc (#4511) 2023-01-30 09:59:52 +08:00
Jack Zhou
6d24a53a30 [FastTokenizer] Add fast tokenizer docs (#4530)
* Add docs building description

* Remove readthedocs

* add space in between English and Chinese

* Add space between Chinese and English

* Update main readme

* Add fast tokenizer framework img

* Add pipeline readme

* Add whitespace split pretokenizer

* Add components description

* WhitespaceSplit -> WhitespaceAndPunctuation

* whitespace_split.cc->whitespace_and_punctuation.cc

* Add Pipeline link

* update doc

* Add normalizers demo

* Add Pretokenizer pipeline demo

* Add model component desc

* Add PostProcessor readme

* Add pybind dependency
2023-01-30 00:20:52 +08:00
chenxujun
88105a64be Fix some words (#4560) 2023-01-29 20:02:49 +08:00
chenxujun
976fb34091 Fix param warmup_proportion (#4559)
Fix param warmup_proportion
2023-01-29 19:31:37 +08:00
chenxujun
71e9e32037 Update train_batch_neg.py (#4555)
* Update train_batch_neg.py

* Update train_batch_neg.py

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-01-29 19:23:31 +08:00
chenxujun
9acf598ee7 Update inference.py (#4554)
* Update inference.py

* Update inference.py

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-01-29 19:21:34 +08:00
chenxujun
461dcc335a Update evaluate.py (#4553)
* Update evaluate.py

* Update evaluate.py

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-01-29 18:01:38 +08:00
chenxujun
e48a7cbb4f Update base_model.py (#4551)
* Update base_model.py

* Update base_model.py

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-01-29 17:56:41 +08:00
chenxujun
270eb8424a Update base_model.py (#4556) 2023-01-29 17:56:04 +08:00
chenxujun
dda1c5f285 Update data.py (#4550)
* Update data.py

* Update data.py
2023-01-29 17:28:30 +08:00
chenxujun
0f657f1a2a Update data.py (#4552) 2023-01-29 17:27:55 +08:00
chenxujun
cd7ca8c7df Update README_en.md (#4548) 2023-01-29 17:22:33 +08:00
chenxujun
83a8b7333e Update export_to_serving.py (#4549) 2023-01-29 17:22:24 +08:00
chenxujun
9451fb8f47 Update train_ce.py (#4542)
* Update train_ce.py

* Update train_ce.py

* Fix styles

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-01-29 17:21:58 +08:00
chenxujun
8cdacbbfbf Update tokenization.py (#4541)
* Update tokenization.py

* remove python 2 unicode stuff

* remove six

* Update tokenization.py

---------

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-01-29 16:32:45 +08:00
chenxujun
0ec66cd7f6 Update train.py (#4547) 2023-01-29 16:31:55 +08:00
chenxujun
694c092809 Update client.py (#4544) 2023-01-29 16:18:58 +08:00
chenxujun
3750ff34d6 Update README_en.md (#4546) 2023-01-29 16:18:29 +08:00
chenxujun
d4b3feafe5 Update ernie.py (#4539) 2023-01-29 15:42:45 +08:00
chenxujun
d08379d90f Update transformer_encoder.py (#4540)
* Update transformer_encoder.py

* Update transformer_encoder.py
2023-01-29 15:42:21 +08:00
Sijun He
c9734ffc33 Enable Roberta AutoConversion, Align Paddle Roberta to HF Transformers (#4512)
* review

* tests

* changes

* changes

* Update test_modeling.py

* Update tests/transformers/roberta/test_modeling.py

Co-authored-by: 骑马小猫 <1435130236@qq.com>

---------

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2023-01-29 15:21:09 +08:00
Sijun He
12d15f9890 disable isort for now (#4538) 2023-01-29 12:58:40 +08:00
daofaziran1
45dab3f6b0 Update README.md , because of Wrong year (#4534) 2023-01-28 16:36:56 +08:00
Sijun He
da0a117af3 add pip cache (#4522) 2023-01-28 12:31:01 +08:00
Sijun He
063e28380d fix readme (#4524) 2023-01-20 10:52:46 +08:00
Sijun He
242050b3ca Reduce number of files in root dir (#4520)
* changes

* changes

* update location
2023-01-19 17:41:51 +08:00
ronnywang
91754e925b add npu support for ernie-3.0 (#4362)
* add npu support for ernie3.0

* enable max_length with padding

* enable max_length with padding

* fix typo

* update field

* implement dynamic max length

* implement dynamic max length

* fix styles

* fix styles

* working

* fix dynamic max length logic; enable lazy processing

* fix styles

* update

* update

* updates

* update ci case

* Update default.yml

* Update default.yml

* Update ci_case.sh

* Update ci_case.sh

* Update default.yml

* Update ci_case.sh

* Update default.yml

Co-authored-by: wj-Mcat <1435130236@qq.com>
Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-01-19 16:02:53 +08:00
Sijun He
5066f94442 add chinese contributing.md (#4301)
* add chinese contributing

* change name

* address comments
2023-01-19 15:18:26 +08:00
lugimzzz
e6bc42958f Fix Deprecation Warning for Sentence Dataaug (#4519)
* fix

* fix
2023-01-19 15:16:13 +08:00
chenxiaozeng
3a18a618f6 Add application/README.md (#4517)
* update group code and and unimo-text metric

* update qianyan introduction

* add application/README.md

* fix link bug

* Update applications/README.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update applications/README.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update applications/README.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* add IE intro

* fix markdown format

* fix markdown format

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-01-19 14:23:33 +08:00
westfish
1db10ff3f1 ppdiffusers version 0.11.0 release (#4513) 2023-01-18 20:24:31 +08:00
westfish
715a50a238 [PPDiffusers]update docs and add new infer scripts (#4390)
* pipeliens doc update

* update

* update docs

* update

* add unclip scripts

* rm score_sde_vp

* add release note

* remove novel
2023-01-18 18:48:03 +08:00
w5688414
4ca26ac0bc Update text similarity taskflow & Pipelines doc (#4488)
* Update text similarity taskflow

* Update Pipelines docs
2023-01-18 14:46:19 +08:00
yujun
7db00ff990 fix download error multi gpu or multi node (#4491)
* fix download error multi gpu or multi node

* update
2023-01-18 14:24:54 +08:00
Noel
82a303fa28 [utc] fix loading local model in taskflow (#4505) 2023-01-17 17:35:38 +08:00
Kai Song
b1b8908cd9 fix elmo bug (#4501) 2023-01-17 16:06:44 +08:00
Jack Zhou
9835bd87b8 [Actions] Add FastTokenizer actions (#4470)
* Add fast tokenizer actions for compile

* fix cpp_compile actions

* test

* test

* test

* fix cpp compile actions

* Add ft python compile action

* Split FastTokenizer Jobs

* turn WITH_TESTING=ON

* update action

* update action

* install requirement

* Use tab instead of space

* Add paths filter

* Test action

* Use single thread to compile ft

* 20.04->22.04

* add fast_tokenizer_cpp_test

* Add bash

* fix actions

* fix makefile

* fix input bug

* Add default arguments for get_splits

* Add log

* Update makefile

* python->python3

* fix makefile

* Add unittest for action

* Add paddlepaddle install

* Add tab in cmakelists

* fix unittest

* Fix yaml and makefile according to comments

* Set working directory for fast-tokenizer actions

* remove working-directory for install

* fix fast_tokenizer_python_install

* use pytest instead of unittest

* fix makefile
2023-01-17 15:33:32 +08:00
Noel
c21ebfcdd2 Add English Documents for UTC (#4476)
* [UTC] Add English documents

* [UTC] Add English documents

* [utc] update readmes

* [utc] add xclue link
2023-01-17 15:15:41 +08:00
Sijun He
c1359cb134 Add T5 to AutoConverter (#4477)
* wi

* wip

* ready for review

* trigger CI again

* trigget ci again
2023-01-17 13:16:43 +08:00
Sijun He
689428ac66 Fix readthedocs bug (#4502)
* Fix readthedocs bug

* fix
2023-01-17 12:16:31 +08:00
Jack Zhou
e6f68a234a Add tokenizer save (#4499) 2023-01-17 11:36:43 +08:00
Yam
d9a4855680 fix generating attention_mask of ernie-m (#4494) 2023-01-16 17:24:32 +08:00
Linjie Chen
eb1a89e2a3 fix docs (#4489) 2023-01-16 15:29:02 +08:00
Jack Zhou
ffc6d48e8c Fix use hardware (#4487) 2023-01-16 11:11:42 +08:00
wawltor
bed109b7d3 Update README_cn.md 2023-01-15 23:19:19 +08:00
wawltor
a337ced850 Update README_cn.md 2023-01-15 13:48:52 +08:00
wawltor
052c5cd29a Update README_cn.md 2023-01-15 13:47:22 +08:00
yujun
d2985b71d3 Revert "add cmsim lock (#4388)" (#4480)
This reverts commit 37dc101c3c.
2023-01-14 17:12:27 +08:00
Jiaqi Liu
0bb1571605 Update ERNIE Tiny README (#4474)
* test=document_fix, update readme

* delete useless expression, test=document_fix
2023-01-13 17:25:47 +08:00
Jack Zhou
69121b3bba [Model] Add readme for fastdeploy (#4447)
* Add ft readme

* Add readme for ft

* add char style

* Add space between Chinese and English

* Add space

* Add detail

* Add detail

* Add detail

* Add space

* Add space

* Add x

* update supportted hardware

* update android tokenization latency

* add FastTokenizer desc

* Update ernie-tiny doc

* Update doc

* Add FT desc

* Add emoji

* Update benchmark

* Update url
2023-01-13 15:26:14 +08:00
Milen
4bec43f0dc [BigFix] Fix the bool parameter inputting problem (#4460)
* Fix the bool parameter inputting problem
2023-01-13 10:38:02 +08:00
chenxiaozeng
a650918874 Update group code and and unimo-text metric (#4462)
* update group code and and unimo-text metric

* update qianyan introduction
2023-01-12 22:30:22 +08:00
Linjie Chen
8aa85d1237 release 2.5.0 (#4461) 2023-01-12 20:33:34 +08:00
pangyoki
b976b74b2f [NPU] Add flatten_param_grads for Trainer to improve NPU performance (#4426) 2023-01-12 18:54:17 +08:00
Zhong Hui
06de433ca0 [BugFix] Fix ernie tiny tipc (#4427) 2023-01-12 16:06:15 +08:00
Zeyu Chen
cc4151e6ea Update README.md
Update titles
2023-01-12 15:54:43 +08:00
wawltor
7c5e087f23 Update README.md 2023-01-12 15:51:28 +08:00
wawltor
e96594239f Update README.md 2023-01-12 15:49:27 +08:00
lugimzzz
8cdc31c954 support simple serving for ernie-m text classification (#4435)
* support ernie m

* add simple serving for ernie m

* add handler in library

* change class name
2023-01-12 15:06:25 +08:00
Noel
03679e23c2 [few-shot] add encoding (#4457) 2023-01-12 15:01:30 +08:00
zhang junjun
cf712a8a09 [CI] updata paddlenlp install ways (#4455)
* [CI] updata paddlenlp install ways

* update
2023-01-12 14:58:35 +08:00
Noel
c742b1630f [prompt] Fix bug in Template (#4456)
* [trainer] fix unknown variable bug in prompt trainer

* [prompt] fix bug in template
2023-01-12 14:54:36 +08:00
liu zhengxi
b4697f00f3 Fix faster fp16 (#4423) 2023-01-12 14:31:33 +08:00
骑马小猫
105f572431 [Function optimization] add fixed input_ids for bert-converter (#4453) 2023-01-12 14:05:07 +08:00
lugimzzz
58eb2be17c add sentence & character level data augmentation api (#4194)
* add_sentence_dataaug

* add_char_augmentation

* add_antonym

* add_file_augmentation

* add_test
2023-01-12 14:03:25 +08:00
duanyanhui
20adadc059 add npu device support for uie (#4401)
* add npu support for uie

* update get_device/get_env_device
2023-01-12 12:51:54 +08:00
骑马小猫
be7d123409 [Bug fixes] update gpt testing issue (#4438) 2023-01-12 12:01:16 +08:00
Jack Zhou
0b1d706596 Fix build script (#4446) 2023-01-12 11:12:40 +08:00
w5688414
d668a1a262 Add devlopment tutorials for pipelines (#4444) 2023-01-12 10:37:08 +08:00
Jack Zhou
1f295e6e2c Fix ft single thread performance (#4441) 2023-01-11 22:38:52 +08:00
骑马小猫
b2a24c65df [New features] add roberta & gpt conversion (#4407)
* add roberta & gpt conversion

* update gpt model

* revert roberta related files

* update gpt loading

* update requirements

* fix input_ids
2023-01-11 21:07:58 +08:00
Jiaqi Liu
d9cd8c3dd7 Update ERNIE Tiny doc (#4422)
* fix dead link, test=document_fix

* update title of ernie-tiny readme, test=document_fix

* test=document_fix
2023-01-11 20:55:03 +08:00
DefTruth
704fb69e9b [Android] Update ERNIE 3.0 Tiny Android deploy demo (#4437) 2023-01-11 20:47:44 +08:00
Noel
98d311e122 [UTC] update readme (#4428) 2023-01-11 20:31:28 +08:00
Zhong Hui
b0aa443eca [BugFix] Fix ErnieSage model for configuration (#4425) 2023-01-11 19:37:03 +08:00
gongenlei
31b5e198dd fix windows bug (#4431) 2023-01-11 19:24:04 +08:00
yujun
c0134dd645 rm paddlenlp.zip (#4434) 2023-01-11 19:14:36 +08:00
zhang junjun
2ecdb669e6 [CI] add fast gpt test (#4432)
* add opencv-contrib-python

* enable Faster gpt transformer

* add FT FG test

* fix fast path

* update

* disable  new model_zoo test

* disable gpt

* add fast gpt
2023-01-11 19:00:36 +08:00
yujun
37dc101c3c add cmsim lock (#4388) 2023-01-11 17:58:51 +08:00
Sijun He
ccb1c31174 Fix test_fill_mask bug (#4429) 2023-01-11 17:17:40 +08:00
DefTruth
bb8861561d [Android] Add ERNIE Tiny android support (#4342)
* [Android] init ERNIE Tiny android codes

* [Android] init ERNIE Tiny android codes

* [Android] init ERNIE Tiny android codes

* [Android] init ERNIE Tiny JNI codes

* [Android] init ERNIE Tiny JNI codes

* [Android] Add ERNIE Tiny App codes

* [Android] Add ERNIE Tiny App codes

* [Android] remove UIE codes

* [Android] Update perf_jni.h

* [Android] Update AndroidManifest.xml

* [Android] Update android/README.md

* [Android] Update android/README.md

* [Android] Update android/README.md

* [Android] Update android/README.md

* [Android] Update android/README.md

* [Android] Update android/README.md

* [Android] Update android/README.md

* [Android] remove un-needed deps

* [Android] remove un-needed c++ deps

* [Android] fixed android/README.md typos

* [Token] Add added_tokens_path to java & jni

* [Token] Add added_tokens_path to java & jni

* [Doc] fixed ERNIE 3.0 Tiny Android docs typos

* [Doc] fixed ERNIE 3.0 Tiny Android docs typos
2023-01-11 16:31:38 +08:00
骑马小猫
22de327cd2 [Bug fixes] update attribute map handler (#4421)
* update config

* update legacy config

* add comment for change

* trigger cla
2023-01-11 16:06:27 +08:00
Jack Zhou
ed1f5acae3 [FastDeploy] Add inference demo for ernie-tiny (#4334)
* Add cpp inference demo

* Add python demo for ernie-tiny

* add test_data_path

* Use batchify_text

* Abolish readme

* Add python readme

* Add python readme

* Fix comments

* Add model_prefix args

* Add AddedTokens api

* Add args descriptions

* Add android directory

* add quant examples

* Add table of supported hardwares when deploying ernie

* Add ascend support

* remove test data path setting
2023-01-11 14:53:35 +08:00
Jiaqi Liu
a64e2adff1 test=document_fix (#4418) 2023-01-11 14:52:30 +08:00
Jiaqi Liu
8e20a7f136 Update ERNIE Tiny doc (#4419)
* test=document_fix

* test=document_fix
2023-01-11 14:52:21 +08:00
骑马小猫
f98f695fa8 [BugFixes] update version of paddlenlp package (#4402)
* update version of paddlenlp package

* use latest version of paddlenlp

* remove paddlenlp importing test
2023-01-11 13:26:52 +08:00
Jiaqi Liu
091888b4d4 Add ERNIE Tiny in model zoo (#4011)
* add pre and postprocess

* fix slot label bug

* reorder slot label

* add train.py

* update test.py

* update train and test script, update readme

* update readme, evaluate.py, fix bug in train.py

* update ernie tiny readme

* update readme, and copyright

* fix trainer api bug, update readme

* fix trainer bug

Co-authored-by: LiuChiachi <>
2023-01-11 13:00:50 +08:00
Linjie Chen
93f4dba1d9 Fix deadlinks for UIE (#4417)
* fix deadlinks

* fix
2023-01-11 12:36:06 +08:00
zhang junjun
98cae1a5a8 Disable model zoo ci (#4416)
* add opencv-contrib-python

* enable Faster gpt transformer

* add FT FG test

* fix fast path

* update

* disable  new model_zoo test
2023-01-11 12:34:49 +08:00
w5688414
4519f586d3 Fix dead links for pipelines and add requirements (#4413) 2023-01-11 11:43:16 +08:00
Sijun He
7229f2fb0d Fix dead link in README (#4415) 2023-01-11 11:08:22 +08:00
wawltor
30367f40d5 fix the applications server for the paddlenlp (#4414) 2023-01-11 10:59:16 +08:00
Sijun He
94b66c3b07 allow hf loading (#4406) 2023-01-10 21:11:43 +08:00
Zhong Hui
a1e1a48150 [BugFix] Fix the checkpoints saving for sharding (#4397) 2023-01-10 20:51:34 +08:00
Milen
f340ff5c7b support other ext tasks except aso task and fix sentiment analysis based on SKEP (#4357)
1. support for common sentiment analysis functions: a, o, as, ao, aso, cls extraction, open up the whole process of each task from annotation description-data annotation-sample construction-model training-sentiment analysis visualization
2. For prompts with emotional elements such as sample construction, visual scripts, etc., fixed attributes, opinion words, and emotional tendencies, parameter customization is no longer provided, which lowers the threshold for users to understand and use
3. Optimize the labeling document, which is easy for users to understand, and add all supported labeling task descriptions
4. Optimize project operation log output
5. Upgrade the sentiment analysis based on SKEP to solve the word segmentation problem caused by tokenizer upgrade
2023-01-10 20:00:37 +08:00
Yam
20c74857e9 remove standard_config_map and use attribute_map instead (#4404) 2023-01-10 19:57:45 +08:00
Noel
92b00551f3 [utc] add default arguments (#4399) 2023-01-10 15:40:11 +08:00
骑马小猫
0716eada98 [BugFixes] update converter command & unittest (#4367)
* fix importing issue

* improve converter

* remove unused import

* fix typo

* update desc & bool env

* update from_hf_hub

* update test

* add logger info for conversion
2023-01-10 12:02:04 +08:00
Noel
689b91c6fc [UTC] add applications and taskflow (#4340) 2023-01-10 11:54:12 +08:00
yujun
7304171817 fix load torch (#4383) 2023-01-09 17:52:05 +08:00
Jack Zhou
5a44636d1f Fix added token input for fast_tokenizer(#4380) 2023-01-08 22:47:08 +08:00
yujun
bc2d3e326d [PPDiffusers] Update ppdiffusers 0.11.1 (#4303)
* update ppdiffuser0.10.0

* rm enable attention slice

* update ldm

* rm seed
2023-01-07 09:31:44 +08:00
yujun
826922073c Refactor CLIP&ErnieViL model and Add ChineseCLIP Model (#4270)
* refactor clip model

* update test tokenizer

* update test tokenizer

* refactor ernie vil

* update config from_pretrained

* set return_dict True

* add chineseclip model

* update
2023-01-06 22:17:32 +08:00
zhang junjun
5710bbebe9 add opencv-contrib-python (#4371)
* add opencv-contrib-python

* enable Faster gpt transformer

* add FT FG test

* fix fast path

* update
2023-01-06 19:52:50 +08:00
Jiaqi Liu
da7fbab847 Add ERNIE Tiny-v2-Mini En (#4250)
* add ernie config

* add ernie tiny mini en
2023-01-06 19:08:29 +08:00
骑马小猫
2d77bb80b3 [ModelZoo] Refactor GPT usage in Model Zoo (#3917)
* update model-zoo gpt

* update gpt test case

* add configs for gpt

* update gpt

* refactor msra-ner

* update msra

* complete gpt trainer

* complete msra_er refactor

* remove corpurs data

* update json to yaml file

* remove tmp dir

* complete run-glue

* update run-pretrain

* update gpt-code

* update model_zoo

* complete gpt

* fix lint

* complete modelzoo gpt

* change testing entry

* remove comment

* enable corpus downloading

* update config

* fix max_predict_len param

* update model-zoo gpt device config

* update gpt readme

* update test config

* remove get_device

* update config

* update small typo

* update model-zoo gpt

* update transformers

* use small model to run ci-case
2023-01-06 16:40:18 +08:00
骑马小猫
7f80e740ea [BugFixes] fix converter importing issue (#4373)
* fix import issue quickly

* update warning for converter
2023-01-06 15:58:30 +08:00
Linjie Chen
47cf9d0b4d Fix ernie-ctm and taskflow knowledge mining task (#4315)
* fix data loader

* fix fine-tune examples

* update urls
2023-01-06 15:19:46 +08:00
wawltor
47fe71d983 change the token cls (#4365) 2023-01-06 14:21:19 +08:00
Noel
7341fdf750 [uie] fix empty prediction in deploy (#4368) 2023-01-06 14:06:07 +08:00
zhang junjun
8683dbe968 Fix taskflow unittest (#4366)
* add model_zoo tests

* fix taskflow unittest

* fix test_taskflow path

* add paddleslim
2023-01-06 13:12:19 +08:00
Linjie Chen
943a0ffec0 fix ci (#4359) 2023-01-05 20:51:44 +08:00
骑马小猫
ee14e04299 [New Features] Refactor converter (#4314)
* update converter

* complete bert-converter

* update lint

* update lint

* enable test requirements

* Update tests/transformers/bert/test_converter.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* refactor converter

* complete bert-converter

* add Converter for compatibility

* complete bert converter

* update model-utils

* fix by comment

* update makefile

* update url-fetching

* fix test_converter

* complete bert convert

* add compatibility for converter

* update bert compatibility testing

* enable torch checkpoint

* update config

* add blank line to requirements.txt

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2023-01-05 20:15:53 +08:00
Jack Zhou
6960a46cba [FastTokenizer] Add unittest for fast_tokenizer (#4339)
* with_added_tokens->with_added_vocabulary

* faster->fast

* Add fast_tokenizer to test and ci requirements

* Add unittest for BertTokenizerFast

* faster->fast

* Add ernie tokenizer fast unittest

* fast_tokenizer->fast_tokenizer_python

* Add fast_tokenizer_python

* Add TinyBertFastTokenizer unittest

* Add ernie-m tokenizer unittest

* Add \n for tests/requirements.txt

* Add test_sequence_builders for ErnieMFastTokenizer

* Add full tokenizer test for fast_tokenizer

* Add use_faster args test

* Add test_fast_and_python_full_tokenizer
2023-01-05 19:23:55 +08:00
shentanyue
d218a25a4c update fd api (#4321) 2023-01-05 17:28:52 +08:00
westfish
8a0dfd423c fix uqa text problems (#4355)
* fix uqa text problems

* rm sh
2023-01-05 17:20:42 +08:00
lugimzzz
ac483a079d update paddleslim version (#4356) 2023-01-05 16:11:46 +08:00
Haohongxiang
79d7a252ff [MoE] Remove legacy sharding (#4346) 2023-01-05 14:06:27 +08:00
Sijun He
0a15de868b [AutoNLP] Remove dirs_exist_ok in export to support py37 (#4349) 2023-01-05 13:56:28 +08:00
zhang junjun
f5480d98f4 add model_zoo tests (#4347) 2023-01-05 13:07:19 +08:00
Sijun He
4afe186e40 AutoNLP TrainerBase and Text Classification (#3728)
* merging AutoNLP branch
2023-01-05 12:27:05 +08:00
yujun
109e5bf233 add prepare_decoder_input_ids_from_labels method (#4331) 2023-01-04 18:45:13 +08:00
liu zhengxi
5488a4bb4a Faster supports MIRO (#3964) 2023-01-04 17:46:21 +08:00
w5688414
201864620d Fix version 2.4.9 bugs for pipelines (#4300)
* Fix version 2.4.9 bugs for pipelines

* Delete unused comment

* Fix the bugs of output_emb_size for neural search & ernie search

* Update offlineann.py

* restore rocketqa-zh-dureader-cross-encoder
2023-01-04 17:17:02 +08:00
骑马小猫
04b7c8bfeb update installation command (#4338) 2023-01-04 16:46:02 +08:00
yujun
ca6dcb9549 fix dead link and add sd License (#4336) 2023-01-04 15:44:44 +08:00
liu zhengxi
5721e1ff01 Fix fast dead links (#4333)
* fix fast dead links

* update
2023-01-04 15:02:06 +08:00
Sijun He
bd2be0f974 Remove "stop at first failure" in CI Test (#4329) 2023-01-04 11:52:22 +08:00
liu zhengxi
640a84a942 Optimize ft when using padded vocabulary (#3936)
* optimize ut when using padded vocab

* fix t5 bart mbart
2023-01-04 10:58:07 +08:00
SylarTiaNII
255360ffcf [BugFix] fix torch migration on step4 (#4228) 2023-01-04 10:43:33 +08:00
骑马小猫
5cc4b21b3a change model-name (#4323) 2023-01-04 09:31:01 +08:00
骑马小猫
0295f0da2a stop at first failure (#4322) 2023-01-03 19:09:16 +08:00
wawltor
f01d8ebe8c fix the load the parameter (#4318) 2023-01-03 16:05:03 +08:00
zhang junjun
37be45db80 add fast_generation samples test (#4311) 2023-01-03 14:35:14 +08:00
Sijun He
a445332667 Add set_level to logger (#4316)
* set level

* styles
2023-01-03 14:15:38 +08:00
骑马小猫
8ab307e464 [BugFix] fix ernie-ctm ci bug (#4292)
* update ernie-ctm

* update traing code

* update model result fetching

* rename data module

* fix model output

* update ErnieCtmForTokenClassification

* fix by comment
2023-01-03 14:03:24 +08:00
chenxiaozeng
0abdcde001 Update README.md (#4313) 2023-01-03 11:38:14 +08:00
caption
2e9dfce577 update streamlit 1.9.0 to 1.11.1 (#4040) 2023-01-03 11:02:08 +08:00
wawltor
23307fe3e4 Update server.md 2023-01-03 10:29:30 +08:00
liu zhengxi
21714c3797 Alter faster to fast in FG (#4213)
* fix fast got

* fix pretrained config used in fg
2023-01-01 11:14:09 +08:00
chenxiaozeng
0f21d526ed Update README.md (#4304) 2022-12-31 00:06:25 +08:00
Milen
c7d6fb4ea7 fix running time for skep and uie (#4302)
fix running time for skep and uie
2022-12-30 21:27:07 +08:00
Linjie Chen
45c2269a43 Fix order of model input for ernie-layout (#4258)
* fix order for model input

* revert
2022-12-30 15:30:55 +08:00
Jack Zhou
0399b72bec [FastDeploy]Update fd sd (#4098)
* update scripts of text to img

* update export model

* Add use_trt=False for text encoder

* paddle-tensorrt -> paddle_tensorrt

* use ort backend

* remove text_encoder_shape
2022-12-30 14:41:27 +08:00
Sijun He
522abcbc51 release 2.4.9 (#4295) 2022-12-30 13:32:40 +08:00
chenxiaozeng
8826f4d677 Simplify news (#4288)
* Simplify news.

* fix typo

* Update README_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update README_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update README_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update README_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update README_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-30 11:28:42 +08:00
zhang junjun
d3fd249a60 【CI】 add ci scripts (#4249)
* fix docprompt deadlink

* fix pretrained_models deadlink

* add ci scripts

* fix codestyle

* fix codestyle

* add make examples

* add make release

* add test_key

* add make release

* Update Makefile

* rename regression

* fix typo

* fix typo

* update Makefile

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-30 10:43:02 +08:00
westfish
1415878049 Uqa deadlink remove (#4290)
* fix deadlinks in uqa docs

* update

* update
2022-12-30 10:37:49 +08:00
骑马小猫
512a219472 enable model-zoo testing (#4291) 2022-12-29 21:21:21 +08:00
Noel
ff70faa0b8 [prompt] fix missing args in autotemplate and labels in trainer (#4293) 2022-12-29 20:31:05 +08:00
Jiaqi Liu
ff3c0c978a Support dynamic export for dynabert (#3549)
* support dynamic export for dynabert

* save diff

* add error message for input check

* update input model name prefix

* solve conficts and update compress strategy
2022-12-29 19:30:09 +08:00
Milen
240f81703f update visualization function (#4282)
1. Upgrade the visualization function to support more flexible processing of sentiment analysis results processed by different schemas
2. Improve sentiment analysis and pipeline readme
2022-12-29 19:03:11 +08:00
Zhong Hui
8c4c418b0f fix fp16 for paddle version (#4283) 2022-12-29 18:44:47 +08:00
lugimzzz
5064b112c7 update text classification (#4279)
* update_text_classification

* update_according_to_the_comments
2022-12-29 18:11:42 +08:00
Sijun He
df0bd27487 warn only once (#4284) 2022-12-29 15:59:59 +08:00
骑马小猫
ef20863098 fix ernie-encoder (#4281) 2022-12-29 15:50:32 +08:00
Jiaqi Liu
5d542a2fb5 Add Embedding quantization (#4159)
* add quant emb

* support quant embeddings

* remove useless log
2022-12-29 14:44:17 +08:00
Noel
6f5c287e21 [speech-cmd] use uie in transformers (#4278) 2022-12-29 12:05:59 +08:00
Linjie Chen
91ab453f86 Fix load config for UIE (#4271)
* fix load config

* update comment
2022-12-29 11:43:43 +08:00
Linjie Chen
867afd6219 fix demo (#4277) 2022-12-29 11:26:20 +08:00
骑马小猫
def43c5d27 enable fix-lock in configuration (#4274) 2022-12-29 11:14:55 +08:00
GGBond8488
81b78e6e7b replace static.sparsity with incubate.asp (#4186)
* replace static.sparsity with incubate.asp

* code style format
2022-12-29 10:42:56 +08:00
westfish
c984ee7120 add unsupervised qa (#4193)
* add uqa

* update

* update doc

* update
2022-12-29 10:31:02 +08:00
westfish
932e416b34 add uie-base-answer-extractor and uie-base-qa-filter (#4259)
* add uie-base-answer-extractor and uie-base-qa-filter

* update
2022-12-29 10:30:22 +08:00
骑马小猫
6a68fd87aa update config save (#4272) 2022-12-29 10:26:28 +08:00
Sijun He
2c59e39c10 [PretrainedConfig] Bring back deprecation warning and fix redundant warnings (#4264)
* commits

* wip

* remove all hasattr

* codegen

* turn on test

* add standard config map

* standard config map

* Update paddlenlp/transformers/bert/configuration.py

Co-authored-by: 骑马小猫 <1435130236@qq.com>

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-29 09:41:07 +08:00
pangyoki
7b0c59d263 [NPU] ernie-1.0 support npu device (#3954)
* ernie1.0 support npu device
2022-12-28 20:03:38 +08:00
westfish
520cb0913b update spanevaluator (#4195) 2022-12-28 17:15:59 +08:00
Linjie Chen
af505d10b7 Add english docs for UIE (#4255)
* Add english docs for UIE

* Update README_en.md

* Apply suggestions from code review

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Apply suggestions from code review

* Update applications/information_extraction/document/README_en.md

* Update taskflow_text_en.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-28 17:04:50 +08:00
ymyjl
d22f1f76f7 [DOC] Update trainer.md (#4262)
* Add skip_memory_metrics which is used for whether to trace memory metrics
2022-12-28 15:38:31 +08:00
ymyjl
70ca8f874b [Trainer] Add Memory Tracer (#4181)
* Add memory tracer
2022-12-28 15:10:29 +08:00
骑马小猫
699a2f07d4 fix downloading (#4142)
Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-27 14:37:48 +08:00
骑马小猫
52d7f11ea3 disable warning (#4248) 2022-12-27 13:40:53 +08:00
Linjie Chen
3ee8459154 Update README.md (#4247) 2022-12-27 13:21:43 +08:00
Sijun He
c73a3a0412 [CI] Fix Unit Tests of Embeddings, Metrics, Ops and Utils (#4242)
* fix all tests

* missing embeddings tests
2022-12-27 10:40:59 +08:00
Milen
d45807d9cc Fix delopy bug and add downloading link of hotel dataset. (#4245)
1. Fix delopy bug
 2. Add downloading link of hotel dataset.
2022-12-26 22:46:56 +08:00
Sijun He
2583b5ab68 Bump version to 2.4.8 for release (#4243)
* test=document_fix

* fix style error of ErnieModel to run CI again
2022-12-26 19:09:34 +08:00
骑马小猫
e6a1bca253 [Bug fixes] fix config attributes backward compatibility (#4237)
* fix config comp

* update comp

* complete fix config comp

* add deprecated warning

* add common testing

* add turn-on keys

* update modeling

* fix typo
2022-12-26 16:55:32 +08:00
Yam
1c7ddf0b27 fix gpt inputs embeds (#4179) 2022-12-26 16:03:01 +08:00
Sijun He
d45864da58 model_config.json -> config.json (#4239) 2022-12-26 15:30:20 +08:00
yujun
ba0c3d16f3 [NEW Model] Add BIT DPT Model (#4202)
* add bit dpt

* update autobackbone example

* paddle.to_tensor

* typo

* update dpt tests image file

* update docs

* test_training_gradient_checkpointing
2022-12-26 14:59:21 +08:00
westfish
e9f785b846 update ppdiffusers pipelines (#4230) 2022-12-26 14:17:42 +08:00
Sijun He
2c465df2fe styles (#4236) 2022-12-26 12:45:36 +08:00
Sijun He
6088ebb72a fix auto release workflow (#4229)
* fix auto deploy

* auto deploy

* remove extra line
2022-12-26 12:40:33 +08:00
骑马小猫
706971bfda [Bug fixes] fix load-torch with different prefix key (#4141)
* fix load-torch scripts

* fix tensor reading

* add serialization error for seek_by_string

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-26 10:56:18 +08:00
Sijun He
dd792d6d01 [CI] Fix data and datasets tests (#4215)
* changes

* add data, datasets

* add dataset

* remove data
2022-12-26 10:45:01 +08:00
gongenlei
28a7ef1fc8 fix sharding save bug (#4220) 2022-12-24 11:06:49 +08:00
shentanyue
6dc4f552b8 Add Ascend NPU mode (#4217) 2022-12-24 01:18:59 +08:00
Sijun He
918a54571b fix version (#4226) 2022-12-23 20:09:20 +08:00
Sijun He
9124996d0f Bump HF Hub version (#4223) 2022-12-23 19:42:16 +08:00
Yuang Liu
c877a21c72 freeze vae part in fp32 (#4214) 2022-12-23 18:33:26 +08:00
Sijun He
36e78fa90a Re-work release logic (#4221)
* fix release logic

* workflow

* add version file
2022-12-23 17:22:17 +08:00
SeverusQin
1816c85af7 add ERNIE-CTM configuration class and move ERNIE-CTM modeling and rel… (#3945)
* add ERNIE-CTM configuration class and move ERNIE-CTM modeling and related tasks onto configuration.

* fix some code-styl

* fix some arguments

* fix some bugs

* fix term-linking priority bugs.

* fix term-linking priority bugs.

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-23 16:53:06 +08:00
Sijun He
cc16ff249e Fix PyPI release again (#4219)
test=document_fix
2022-12-23 16:29:31 +08:00
Sijun He
d9ad3d115a Release 2.4.6 (#4218) 2022-12-23 15:51:16 +08:00
Sijun He
c61c4dfc15 switch to pkg_resources (#4216) 2022-12-23 14:58:00 +08:00
Sijun He
8b33cfea22 Fix Auto Release (#4209) 2022-12-23 12:14:19 +08:00
Yam
91d0a1f9e0 fix error included by #3998 (#4201)
Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-23 10:56:42 +08:00
Zhong Hui
318ed29f37 [Trainer] fix multi_precision (#4208)
* fix multi_precision
2022-12-23 10:31:29 +08:00
骑马小猫
5e3c3a58a1 [New features] complete auto-deploy (#4175)
* complete auto-deploy

* update manual deploy for paddlenlp

* fix typo

* Update paddlenlp/version.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* update auto-deploy

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-23 00:04:31 +08:00
wawltor
9ef9a8d2c7 fix the tipc for the ernie-tiny (#4207) 2022-12-22 20:20:29 +08:00
Zhong Hui
b19244dfde Update README.md (#4205) 2022-12-22 18:19:53 +08:00
Linjie Chen
67a045c2ff [ModelZoo] Refactor ERNIE-Layout Usage and add unittest (#4170)
* Add unittest

* Apply suggestions from code review

* Delete test_tokenizer.py

* Apply suggestions from code review

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-22 18:08:01 +08:00
Milen
dabf03333f Refine Readme (#4199)
refine readme for unified sentiment analysis.
2022-12-22 14:35:31 +08:00
wawltor
3e56184805 Update README.md 2022-12-22 12:22:58 +08:00
wawltor
2cfec5c9a7 add the ernie pretrain config (#3962)
* add the model zoo for the ernie 3.0

* temp add

* add the qa prediction

* add the config for the ernie

* add the predictor for the paddlenlp

* add the server for the token、seq

* add the qa handler

* add the qa server

* update the readme for the ernie 3.0

* update the code for the paddlenlp

* update the code for qa server

* update the code for the trition serving

* add the function for the compress

* update the code for the paddlenlp

* update the code for the token

* update the code for token cls

* update the code for ernie model
2022-12-22 12:15:22 +08:00
Sijun He
08e6b3c5d5 Use tiny-random model for prompt tests to speed up CI (#4190)
* use small models

* change test_modeling

Co-authored-by: Noel <wanghuijuan03@baidu.com>
2022-12-22 10:59:18 +08:00
WangZhen
ec302264a9 [TIPC]Polish dy2st tipc shell (#4155)
* Polish dy2st tipc shell

* fix errors.

Co-authored-by: xiongkun <xiongkun03@baidu.com>
Co-authored-by: zhang junjun <1834792141@qq.com>
2022-12-21 20:24:27 +08:00
liu zhengxi
526099621c fix 0 dim (#4192) 2022-12-21 19:41:56 +08:00
Linjie Chen
1e63f619a3 Update README.md (#4180)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Apply suggestions from code review

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Update README.md

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-21 17:06:49 +08:00
liu zhengxi
68c4b096b4 FG for Text-To-Text Transfer Transformer (#3763) 2022-12-21 15:48:29 +08:00
Yam
fcfe69281c Add PretrainedConfig to Bart/MBart/CodeGen/UNIMO/UnifiedTransformer (#3998)
* add config to bart and mbart

* add CodeGenConfig

* check code style

* check code style

* add UNIMOConfig

* add UnifiedTransformerConfig

* check code style and fix bugs

* fix conflict introduced by #4035

* using standard_config_map instead of attribute_map while rewrite get_config function

* add attribute num_choices to ErnieMConfig

* check all the attributes between loaded_config and config

* add CONFIG_NAME and CODEGEN_*

* fix pyproject

* use config.attr instead

* delete unnecessary arguments

* delete unnecessary arguments

* add type hints for forward and support embed_scale for bart/mbart

* fix typo of codegen

Co-authored-by: liu zhengxi <380185688@qq.com>
Co-authored-by: 骑马小猫 <1435130236@qq.com>
Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-21 14:09:49 +08:00
wawltor
22635acf30 add the 0 dim tensor (#4183) 2022-12-21 10:14:56 +08:00
Sijun He
d390f282fe Decrease stale -> close days from 30 to 14 (#4167)
Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-20 18:57:30 +08:00
Sijun He
01ec7a9a19 Create CONTRIBUTING.md (#4160)
* Create CONTRIBUTING.md

* styles
2022-12-20 18:16:03 +08:00
westfish
f8d36ed274 fix bug unimo fp16 infer error (#4166)
* fix bug

* update fix

* update unimo infer with summarization
2022-12-20 16:12:23 +08:00
Linjie Chen
c3d6545544 Support set_argument method for UIE (#4163)
* Support set_argument method for UIE

* set schema to None by default

* revert

* update

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-20 12:57:27 +08:00
Jack Zhou
f653728947 [FastTokenizer]Fix json of tokenizers (#4165)
* Fix json of tokenizers

* Add c_wrap

* Update version
2022-12-20 11:41:26 +08:00
Jack Zhou
ab67ff2905 [FastTokenizer] Fix fast_tokenizer import (#4126)
* Fix fast_tokenizer import

* use import_module instead of importlib.import_module

* Add auto tokenizer unittest

* update to __internal_testing__

* Add test
2022-12-20 11:40:38 +08:00
Milen
f96e787f9b Add unified sentiment analysis based on UIE. (#3694)
1. add unified sentiment analysis based on UIE
2. add predicting sentiment analysis with Taskflow
3. add pipeline for sentiment analysis
4. integrate uie-senta-x models into Taskflow and ernie/modeling, support predicting and training based on uie-senta-x
5. refine codestyle for sentiment analysis based on skep
2022-12-20 11:30:04 +08:00
Yam
d6ea3b0cea Add inputs_embeds to GPT (#4164) 2022-12-20 10:17:17 +08:00
Sijun He
ee70111bfb Fix Ernie bugs in examples/information_extraction/waybill (#4156)
* styles

* styles

* fmt on and off

* styles

* styles

* update things

* styles
2022-12-19 15:13:54 +08:00
Linjie Chen
d28675d47e Skip labels not in schema for entity extraction (#4153)
* skip labels not in schema

* skip labels not in schema

* skip labels not in schema
2022-12-19 13:10:32 +08:00
zhang junjun
241879fc8e fix symlink deadlink (#4139)
* fix docprompt deadlink

* fix pretrained_models deadlink
2022-12-19 11:26:18 +08:00
Sijun He
cff51fea2b commit (#4152) 2022-12-19 11:13:05 +08:00
Sijun He
2063b13925 pr (#4140)
Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-16 20:59:51 +08:00
Jiaqi Liu
2482b0ffd2 Adaptive import PTQ in compression API (#4138)
* remove fluid api

* recover fluid api

* support ptq api

* keep input dtype int64
2022-12-16 19:58:46 +08:00
Jiaqi Liu
169e7c7b3f Update ernie tiny model name (#4134)
* update ernie tiny model name

* update name

* fix v1 name

* update model name
2022-12-16 18:06:47 +08:00
Yam
1858416517 add inputs_embeds to Bart/MBart/Unified_Transformer/Unimo/CodeGen (#3769) 2022-12-16 15:15:21 +08:00
Linjie Chen
271f3c15cd Fix uie predictor (#4081)
* fix input names for uie

* update predictor

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-16 12:10:28 +08:00
Sijun He
cc085b5ed9 [CI] Configure tests github actions and add coverage comments (#4131)
* tests

* remove redundant space

* add regex

* pytest xdist

* pytest command

* fix t5

* report-only-changed-files

* give permission

* github token

* github tokens

* try permissions

* pull request target

* permissions

* test codecov
2022-12-16 11:43:57 +08:00
Linjie Chen
aa34d0c443 Update README.md (#4130) 2022-12-15 20:23:42 +08:00
Sijun He
425c15683f fix (#4128) 2022-12-15 20:05:43 +08:00
骑马小猫
b4cf0674f2 [NewFeature] add load_torch scripts (#4121)
* add load_torch scripts

* update unittest for load-torch
2022-12-15 18:57:54 +08:00
Sijun He
324e485d7b Ernie Pretrained Config (#4118)
* ernie config

* remove comments

* style

* fix ernie gram

* fix prompt model

* fix pretraining

* Update run_pretrain.py

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-15 18:05:00 +08:00
Sijun He
b88315c871 commit (#4090)
Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-15 17:01:55 +08:00
LazyFyh
76bdc5fb00 optimize code details pull-request, test=develop (#4102)
* optimize code details pull-request, test=develop

* optimize code details

Co-authored-by: gongenlei <gongel@qq.com>
2022-12-15 15:55:26 +08:00
liu zhengxi
d803166248 fix exp (#4061) 2022-12-15 10:32:33 +08:00
骑马小猫
138efe1016 [New features] add install cli command (#4043)
* complete config testing

* add bert-testing

* add install cli

* add install cli

* complete cli command

* revert changes

* complete cli install
2022-12-14 22:35:39 +08:00
Sijun He
0904221417 [HF] UIE Taskflow load from HF Hub (#4100)
* load from HF hub

* remove print

* fix to static path

* fix static path

Co-authored-by: linjieccc <623543001@qq.com>
2022-12-14 19:20:51 +08:00
Noel
318198e0af [prompt] fix export for soft keyword (#4116)
* [prompt] fix export for soft keyword

* [few-shot] fix export for soft keyword

* [prompt] support default input_spec in PromptTrainer

* [prompt] update by comments
2022-12-14 18:53:57 +08:00
yujun
77661a890d [PPDiffusers] support recompute (#4114)
* support recompute

* update readme
2022-12-14 15:33:51 +08:00
Sijun He
f2a583caa0 Support multi-label setup in Text Classification Taskflow (#3968)
* [NewFeatures]add ci & pypi workflow (#3578)

* add basic ci & pypi workflow

* add Makefile file to enable more custom scripts

* update makefile & workflow

* add manifest.in file

* save requirements

* improve makefile

* add test running command

* complete simple CI test script

* complete simple CI test script

* complete first version of workflow

* failure at first

* remove CI workflow

* update workflows

* add dev-dependency

* complete format & lint

* add paddle dependency

* complete format & lint & test command

* upgrae workflow files

* use pytest to do test

* update need keywords

* change the description

* update lint script

* upgrade workflow

* update parameterized

* update makefile

* fix lint

* update test command in workflow

* fix __init__ lint

* ignore all __init__.py file

* fix script workflow

* udpate flake8 config

* update flake config

* update flake8 config

* remove redefinition of unused

Co-authored-by: Sijun He <sijun.he@hotmail.com>

* Add multi recall of semantic search for pipelines (#3864)

* Add multi recall of semantic search for pipelines

* Update multi recall semantic search README.md

* remove unused imports

* remove unused imports

* Update __init__.py

* remove unused imports

* restore __init__.py

* skip retriever __init__.py

* [trainer] fix bug when batch size=1 (#3960)

* [PPdiffusers] Release ppdiffusers 0.6.3 (#3963)

* release 0.6.3

* release 0.6.3

* style

* code style

* fix test

* remove commented code

Co-authored-by: 骑马小猫 <1435130236@qq.com>
Co-authored-by: w5688414 <w5688414@gmail.com>
Co-authored-by: Noel <wanghuijuan03@baidu.com>
Co-authored-by: yujun <50394665+JunnYu@users.noreply.github.com>
2022-12-14 11:32:06 +08:00
xiongkun
c40e9de302 remove amp training (#4099) 2022-12-14 08:46:17 +08:00
Sijun He
04f947beff Switch bert test to use new PaddleCI model (#4105) 2022-12-14 00:12:25 +08:00
Linjie Chen
8178bba315 Update README.md (#4067)
* Update README.md

* Update README.md

* Update README.md

* update

* Update README.md

* Update taskflow_doc.md

* Update taskflow_doc.md
2022-12-13 20:18:15 +08:00
w5688414
e8c8b6c70c Add requirements for faq system (#4093) 2022-12-13 10:29:33 +08:00
Sijun He
b6e4fd61a9 [HF] make AutoModel compatible with standard config and legacy config (#4083)
* commit

* address comments

* style docstring

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-12 20:26:49 +08:00
Sijun He
a82501d573 fix lint workflow (#4085)
Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-12 19:19:00 +08:00
wawltor
5ddba5db0a Support server client (#4088)
* update the router url

* fix the bug of 2.4.5 branch for simple serving
2022-12-12 16:56:04 +08:00
lugimzzz
ac5180b967 update_uiex_performance (#4080)
Co-authored-by: Linjie Chen <40840292+linjieccc@users.noreply.github.com>
2022-12-12 10:24:57 +08:00
Linjie Chen
0b97209093 fix input names for uie (#4079) 2022-12-12 10:19:56 +08:00
骑马小猫
5146884693 [Bugfix] fix linting workflow (#3973)
* rename workflow

* Update Makefile

* Update lint.yml

* Update get_modified_files.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-11 16:27:37 +08:00
Linjie Chen
cf523c7af2 fix ie_utils import (#4066)
* fix import

* fix import

* fix import
2022-12-09 19:27:54 +08:00
Zhong Hui
b1bfbf22bf [API] Fix matmul api useage. (#4058) 2022-12-09 15:58:35 +08:00
wawltor
c4ee7916af add the uie-x (#3951)
* add the uie-x

* update bbox

* update ocr

* update uie-x

* fix label

* fix reader

* optimize plot

* optimize relation plot

* optimize

* update uie-x params

* update layout analysis

* Update doc parser

* Update README.md

* Update README.md

* Update README.md

* replace fluid api

* replace fluid api

* Update README.md

* Update README.md

* Update README.md

* Update military dataset

* Update label_studio_doc.md

* Update README.md

* Update README.md

* Update README.md

* Update taskflow_doc.md

* move data_converter

* fix

* fix finetune

* fix windows

* fix windows

* fix windows

* fix onnx

* update data converter

* fix compatibility for taskflow

Co-authored-by: linjieccc <623543001@qq.com>
Co-authored-by: Linjie Chen <40840292+linjieccc@users.noreply.github.com>
2022-12-09 15:12:31 +08:00
Jack Zhou
5385d0ddd7 [FastTokenizer] Fix fast_tokenizer not found when using auto tokenizer (#4060)
* Fix fast_tokenizer not found when using auto tokenizer

* faster -> fast

Co-authored-by: Linjie Chen <40840292+linjieccc@users.noreply.github.com>
2022-12-09 14:41:31 +08:00
Zhong Hui
cc92f28381 [CodeStyle] Format trainer code style. (#4057) 2022-12-09 14:08:41 +08:00
骑马小猫
0da3f93ae6 Add config testing (#4041)
* complete config testing

* add bert-testing

* update modeling comon

* fix testing issue

* update testing

* upate hf-config testing

* update test bert common

* Update test_modeling_common.py

* Update test_modeling_common.py

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-09 14:00:24 +08:00
shentanyue
ba9f28079c add fastdeploy+lite more devices support (#4042) 2022-12-09 12:37:23 +08:00
Sijun He
383210a5b9 [Prompt] PromptModelForSequenceClassification and unit tests (#4021)
* split models off

* ready for PR

* allow criterion = None

* add efl test

* add efl test

* fix test

* add to unittests

* debugging

* wip

* ready for review

* address comments
2022-12-09 01:10:53 +08:00
Noel
041a4bea0b [ernie-health] update readme (#4053) 2022-12-08 20:35:18 +08:00
christineaa
00daaecb7a add NoRepeatNGramLogitsProcessor (#3977)
* add NoRepeatNGramLogitsProcessor

* Update generation_utils.py

solve invalid syntax

* Update generation_utils.py

* Update generation_utils.py

* Update generation_utils.py

add no_repeat_ngram_size=None

* Update generation_utils.py

fix code style

* fix code style
2022-12-08 20:10:05 +08:00
Jiaqi Liu
4d736b5f2d fix ernie tiny v2 model config (#4049) 2022-12-08 13:27:42 +08:00
Sijun He
c6f6fee1b4 Increase stale action operations per run (#4047)
Increase stale action operations per run since we have too many issues for the current operations to cover
2022-12-08 10:53:59 +08:00
骑马小猫
07304705dc update github workflow name (#4046) 2022-12-08 10:38:09 +08:00
骑马小猫
75a7f88483 fix model_type word (#4036) 2022-12-08 09:59:07 +08:00
Noel
8d0316d41a [prompt] add unittest for template apis (#4028)
* [prompt] add unittest for template

* [prompt] add prompt unittest in makefile

* [prompt] add comments for truncation in prompt_tokenizer

* [prompt] fix unittest for soft template

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-07 19:25:59 +08:00
Jiaqi Liu
f97e4dcf3b Add ERNIE 3.0 Tiny v2 models (#3983)
* add ernie 3.0 tiny v2 models

* add base v1

* alias v1 tokenizer
2022-12-07 18:52:11 +08:00
Sijun He
cc1cd7de12 Enable text summarization taskflow to load from HF Hub (#4039) 2022-12-07 18:49:45 +08:00
骑马小猫
faed2ed9d3 [NewFeature] add hf config solution (#4035)
* add hf config solution

* add configuration_utils test

* add hf config solution

* add configuration_utils test

* update config

* fix by comment

* fix for merged

* use env name

* use config name

* move config_name to env.py file

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-07 16:58:07 +08:00
liu zhengxi
78d0875f18 support relative path (#4032) 2022-12-07 16:20:31 +08:00
Sijun He
7beda5e339 modify stale (#4033) 2022-12-07 14:24:24 +08:00
Sijun He
b3b4fd0a9d Add triage for all new issue (#4026)
* new issue

* add exempt
2022-12-06 22:33:55 +08:00
Noel
dc2a6c5a57 [examples] use prompt api to re-implement few-shot methods (#3816) 2022-12-06 21:38:35 +08:00
Sijun He
a7cba3696c [CI] Add stale action for issues and PRs (#4012)
* stale.yml

* pr label
2022-12-06 20:02:49 +08:00
Yam
db3bde142c Gpt output loss (#3396) 2022-12-06 16:46:18 +08:00
liu zhengxi
d364d5b40b Add preprocess & capability for custom dataset for mt (#3269) 2022-12-06 14:03:29 +08:00
yujun
5b6563c83f [PPDiffusers] update readme add more weights (#4018)
* update readme add more weights

* update
2022-12-06 13:05:11 +08:00
Sijun He
a7e760fcb4 [HF] Implement save_to_hf_hub for Model and Tokenizer (#3982)
* fix import

* switch from lfs to http

* Apply suggestions from code review

Co-authored-by: Lucain <lucainp@gmail.com>

* add readme logic

Co-authored-by: Lucain <lucainp@gmail.com>
Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-06 12:38:17 +08:00
yujun
2276e28862 release PPDiffusers 0.9.0 (#4017) 2022-12-06 11:32:35 +08:00
骑马小猫
626152d826 [BugFix] Fix offset mapping (#4003)
* enable offset_mapping

* fix bert-like offset-mapping

* remove bpe tokenizer offset-mapping test

* restore fix-offset-mapping

* disable bart tokenizer offset-mapping test

* update bart tokenizer

* update bart test_tokenizer attribute
2022-12-06 11:19:53 +08:00
yujun
649b18a183 [PPDiffusers] Update ppdiffusers 0.9.0 (#3919)
* update

* update ppdiffusers and add tests

* make tests pass

* rm unused docs

* rm kwargs

* use np.float32

* update pipelines inference example

* add pipeline examples & mv inference to examples folder

* fix bug

* update readme

* support HeunDiscreteScheduler & update progress_bar

* make style

* update convert script

* rm skip_prk_steps in ddim

* make style

* update

* rm ddim skip_prk_steps

* fix dpm fp16 add vae slice todo

* add logger in bos_download

* update fastdeploy pipeline & update readme

* update readme pic

* fix euler dtype

* fix euler dtype

* rm unused kwargs

* remove onnx and only keep fastdeploy

* update

* https://github.com/PaddlePaddle/PaddleNLP/pull/3873

* update readme

* update link url

* update readme

* rm scripts/export and update url

* image -> init_image

* update deploy readme

* add sd mega

* table align center

* fix deploy/readme.md

* update deploy code

* fix a small export error

* fix small bug

* ci

* update fd pipeline options
2022-12-06 10:39:42 +08:00
wawltor
0030717cc2 Update server.md 2022-12-05 19:57:16 +08:00
Sijun He
4e56e4890c black format all (#4014) 2022-12-05 19:13:15 +08:00
Sijun He
420bfe3fd8 black format (#4013) 2022-12-05 14:03:56 +08:00
chenxujun
eaef96ff68 Update taskflow.md (#3914)
Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-04 22:05:15 +08:00
DefTruth
b07eed5ca3 [FastTokenizer] Support FastTokenizer on Android (#3999)
* [FastTokenizer] Support FastTokenizer on Android

* Update how_to_build_android.md

* fix code style

* fix code style

* add copyright

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-12-04 11:33:34 +08:00
Sijun He
d73ec67d82 Add codegenJupyterLabExt to README.md of CodeGen (#4002) 2022-12-02 17:53:24 +08:00
骑马小猫
f1318b80e8 remove roformerv2 unittest (#4004)
Co-authored-by: zhang junjun <1834792141@qq.com>
2022-12-02 17:21:01 +08:00
xiongkun
58f64b35bf add script and configs for transformer (#4000)
Co-authored-by: liu zhengxi <380185688@qq.com>
2022-12-02 16:58:35 +08:00
zhang junjun
56e1ad9e7b Remove auto bert_japanese bigbird unittest (#3969) 2022-12-02 16:35:39 +08:00
w5688414
edac625049 Add automatic deploy for pipelines (#3991)
* Add automatic deploy for pipelines

* Add Makefile

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-12-02 15:41:41 +08:00
gmm
f9aafeefa9 【fix benchmark】 (#3984) 2022-12-02 13:33:25 +08:00
Linjie Chen
3771dc3b70 Update README.md (#3993) 2022-12-02 10:54:48 +08:00
chenxujun
1a2a68623d Update taskflow.md (#3955)
modify table tag

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-12-02 10:31:33 +08:00
骑马小猫
7718228e08 [BugFix]fix tokenizer multi-download (#3965)
* fix tokenizer multi-download

* use paddlenlp get_path_from_url

* update model utils
2022-12-02 09:30:23 +08:00
Yam
e2f9c6b24e add T5Config to T5Model (#3856)
* add T5Config to T5Model

* add config.get() to PretrainedConfig

* fix missing ignore_pad_token_for_loss args

* set default values (use_cache, output_attentions, output_hidden_states, return_dict) to None

* add configuration to paddlenlp.__init__

* add configuration of t5 to paddlenlp.transformers.__init__

* add type hinting to T5Config and add test_get_value_with_default_from_config to test_configuration_utils

* give up modifing in question_generation examples since #3875

* expect AttributeError instead of any error
2022-12-02 08:57:29 +08:00
gongenlei
d53f6bfede [Trainer] Add preprocess_logits_for_metrics for trainer (#3961)
* add preprocess_logits_for_metrics for trainer

* update doc
2022-12-01 21:35:24 +08:00
w5688414
f00569edab Don't sort imports of pipelines (#3986)
* Don't sort imports

* Don't sort imports& try again
2022-12-01 21:10:08 +08:00
w5688414
330c5614d5 Update requirements& fix multi recall bugs (#3979) 2022-12-01 18:59:28 +08:00
wawltor
72a54590bc Update README_cn.md 2022-12-01 17:56:56 +08:00
Sijun He
6cf830d464 black format taskflow (#3975) 2022-12-01 16:37:19 +08:00
wawltor
ae60813ad5 Update README.md 2022-12-01 14:43:48 +08:00
wawltor
9bc189df4c Update README.md 2022-12-01 14:42:46 +08:00
wawltor
377adfdf79 fix the taskflow skep & ErnieGram export model (#3970)
* fix the taskflow skep

* fix the output for the ernie-gram
2022-12-01 13:06:00 +08:00
骑马小猫
ed3b2ebb05 [Bugfix] update paddle dependency version (#3972)
* update paddle dependency version

* upgrade ubuntu version

* rollback paddle version

* use ubuntu-20.04
2022-12-01 12:52:21 +08:00
Sijun He
39be9ef2c6 Black Format paddlenlp/transformers (#3967)
* style

* black format only

* roll back accidental taskflw change
2022-11-30 21:09:38 +08:00
Noel
9f6df03a5e [prompt] fix keyerror for truncate keyword (#3933)
* [prompt] fix keyerror for truncate keyword

* [prompt] update code style

* [prompt] fix bug in doc
2022-11-30 19:59:52 +08:00
yujun
b5d9f3bfd1 [PPdiffusers] Release ppdiffusers 0.6.3 (#3963)
* release 0.6.3

* release 0.6.3
2022-11-30 17:34:28 +08:00
Noel
db57a64e39 [trainer] fix bug when batch size=1 (#3960) 2022-11-30 17:18:29 +08:00
w5688414
4d5cd91f53 Add multi recall of semantic search for pipelines (#3864)
* Add multi recall of semantic search for pipelines

* Update multi recall semantic search README.md

* remove unused imports

* remove unused imports

* Update __init__.py

* remove unused imports

* restore __init__.py

* skip retriever __init__.py
2022-11-30 16:26:58 +08:00
骑马小猫
a9f815ea8f [NewFeatures]add ci & pypi workflow (#3578)
* add basic ci & pypi workflow

* add Makefile file to enable more custom scripts

* update makefile & workflow

* add manifest.in file

* save requirements

* improve makefile

* add test running command

* complete simple CI test script

* complete simple CI test script

* complete first version of workflow

* failure at first

* remove CI workflow

* update workflows

* add dev-dependency

* complete format & lint

* add paddle dependency

* complete format & lint & test command

* upgrae workflow files

* use pytest to do test

* update need keywords

* change the description

* update lint script

* upgrade workflow

* update parameterized

* update makefile

* fix lint

* update test command in workflow

* fix __init__ lint

* ignore all __init__.py file

* fix script workflow

* udpate flake8 config

* update flake config

* update flake8 config

* remove redefinition of unused

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-11-30 15:31:16 +08:00
Sijun He
b429aa8a93 Update README v2.4.4 (#3938)
* update readme
2022-11-30 14:22:55 +08:00
wawltor
35bcd10cf2 fix the client requeset for the serving (#3956) 2022-11-30 11:59:13 +08:00
LixinGuo
39175b137b [TIPC] Fix random rank in pdc (#3948) 2022-11-30 11:20:22 +08:00
Jack Zhou
c388c23da6 [PPDiffuers] Fix fd pipeline export model doc (#3952)
* Fix export model

* Fix sd export model
2022-11-29 23:36:39 +08:00
Jack Zhou
45d371b256 Move fd example to ppdifusers (#3813)
* Move fd example to ppdifusers

* Fix sd export_model.py

* Add FastDeployRuntimeModel and is_fastdeploy_available

* Add text_to_img_infer

* Add img to img task

* add inpaint infer

* Modify default inference_steps

* refresh code
2022-11-29 23:10:03 +08:00
Linjie Chen
2fc62b67e2 Revert "Add UIE-X (#3639)" (#3947)
This reverts commit c90a2610c0.
2022-11-29 19:11:42 +08:00
w5688414
8b2d7d59a8 Set default parameters to larger size and fix the file uploading erro… (#3935)
* Set default parameters to larger size and fix the file uploading error when first update data

* Add Swagger API docs

* remove unused imports

* restore qa download function

* Update pipelines/document_stores/elasticsearch.py

* Update ernie_ranker.py

* restore __init__.py
2022-11-29 18:58:44 +08:00
Linjie Chen
c90a2610c0 Add UIE-X (#3639)
* Add taskflow uie-x

* add ie application

* upate label_studio.md

* upate label_studio.md

* upate label_studio.md

* upate label_studio.md

* update label_studio.md

* update

* update

* update

* update

* update label studio

* add_uiex_finetune

* add doc_parser

* Update README.md

* Update README.md

* Update README.md

* Update label_studio

* fix normalize func

* add uie to transformers

* update

* update

* Update README.md

* add_uiex_finetune

* add_uiex_finetune

* add_finetune_uiex

* bug_fix

* add layout analysis

* add_uiex_fintune

* add_readme

* add layout analysis for taskflow

* update utils & layout_analysis

* add utils

* move data distill

* update pdparams

* boxes -> bbox & add text ie

* boxes -> bbox & boxes_list -> bbox_list

* update taskflow.md

* update weights for uie serial models

* update

* add the simple server for the uie-x

* add the uie-x server code

* update the document for the uie-x serving

* add the workers for the simple serving

* Update taskflow.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* temporary disable memory optim for gplinker

* document utils bug fix

* summary_token_num of UIE-X is 4

* add the uie text simple serving

* add the data_distill uie serving

* fix

* bug fix 

bug fix

* default process for a4 size

* update

* update taskflow

* Update README.md

* update the do_ocr api for the serving

* update parser

* Update README.md

* bug_fix

* bug_fix

* bug_fix

* Update README.md

* revert uie-tiny

* add bbox info

* update

* fix

* fix

* add result plot

* update result plot

* update bbox

Co-authored-by: lugimzzz <zhenglujing@baidu.com>
Co-authored-by: lugimzzz <63761690+lugimzzz@users.noreply.github.com>
Co-authored-by: wawltor <fangzeyang0904@hotmail.com>
Co-authored-by: 002711133 <he.huang2@iwhalecloud.com>
Co-authored-by: hehuang139 <ox48@qq.com>
2022-11-29 17:13:26 +08:00
Sijun He
08978b238f Upgrade pre-commit to use isort, black, flake8 instead of yapf (#3925)
* Upgrade pre-commit to use isort, black, flake8

* fix isort profile

* py files

* address comments
2022-11-29 11:46:49 +08:00
yujun
798e9df8ed add fid clip score example (#3860)
Co-authored-by: gongenlei <gongel@qq.com>
2022-11-28 21:14:56 +08:00
gongenlei
6f93f9523e rm print (#3929) 2022-11-28 16:15:14 +08:00
Sijun He
cdb300986a fix missing import (#3927) 2022-11-28 15:44:16 +08:00
wawltor
39a76f9687 Update client.py 2022-11-28 14:45:36 +08:00
Sijun He
fffdf823d4 Support HUGGINGFACE_HUB_CACHE in HF hub download through os env (#3911)
* support hf hub cache

* merge conflict

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-11-28 11:48:49 +08:00
w5688414
300824610b Change rocketqa to simbert for similarity (#3922) 2022-11-28 11:08:56 +08:00
Noel
54409fad80 [prompt] fix bug when no mask token in template (#3924) 2022-11-28 10:49:41 +08:00
Noel
6308169341 [prompt] add maskedlmverbalizer & fix collate_fn (#3889) 2022-11-28 10:29:19 +08:00
w5688414
930a986f4a Add Ernie Search base model into pipelines (#3906)
* Add Ernie Search base version into pipelines

* Add more comments
2022-11-28 10:02:59 +08:00
wawltor
c08d47cf8f Update README.md 2022-11-26 18:28:29 +08:00
wawltor
b0d34c983e Update README.md 2022-11-25 19:16:34 +08:00
Sijun He
58b6b55309 Fix taskflow tests and the FileLock import bug (#3898)
* fix taskflow tests

* add copyright

* pre-commit

* use md5 for lock-file name

* fix imports

* fix gpu test

* reemove print statement

Co-authored-by: wj-Mcat <1435130236@qq.com>
2022-11-25 18:25:55 +08:00
Sijun He
ed778dc9b1 Add library name and version to hf_hub_download for better analytics (#3881)
* add lib name and version for hf hub download

* add hf hub version
2022-11-25 17:29:09 +08:00
gongenlei
14e6813c1e fix load_fp16 model (#3902)
Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-11-25 15:37:58 +08:00
w5688414
cef829187f Update Neural Search README.md (#3817) 2022-11-25 14:39:43 +08:00
骑马小猫
0d0eb1edc1 [Bugfix] enhance offset_mapping to fit more tokenizers (#3858)
* enable offset_mapping

* fix bert-like offset-mapping
2022-11-24 23:32:02 +08:00
骑马小猫
0d931ad176 [Function optimization] use file-lock to enable multi-process downloading (#3788)
* add file_lock unittest

* enable multi-processing downloading

* use small weight file & more process to download

* use global lock file

* fix testing

* modify the docstring

* use self.assertGreater

* change the file name & variable name

* add docstring for testing method

* update internal testing bert url

* update multiprocess testing code

* remove unused importing

* add Optional import

* use the origin method name

* format tokenize_utils_base
2022-11-24 22:59:45 +08:00
骑马小猫
b122d4a811 [Bugfix]: add file checking before os.remove (#3843)
* bugfix: add file checking before removing it

* fix typo

* fix typo

* use shutil.move

Co-authored-by: Sijun He <sijun.he@hotmail.com>
2022-11-24 22:41:12 +08:00
wawltor
ab56f4667b Update README.md 2022-11-24 17:40:58 +08:00
wawltor
2cdab98942 Add server doc (#3891)
* reconstruct the TaskflowHandler

* update the server doc

* update the server doc
2022-11-24 16:21:13 +08:00
westfish
06e0be7fa8 Fix bug qg example (#3890)
* fix bug in qg-example

* bug fix of t5-qg

* update

* update
2022-11-24 16:09:33 +08:00
Zhong Hui
81f0a2ed36 [Fluid] Fix gpt fluid expand_as useage. (#3884) 2022-11-24 15:09:05 +08:00
westfish
21cc3f5099 remove dead link (#3878)
* unsupervised qa pipeline

* remove useless

* reset question-answering/readme.md

* delete useless

* add offline_qa_generation and update codes

* update unsupervised-qa pipelines

* modify readme

* change version

* file support

* remove dead link

* remove note
2022-11-24 14:00:53 +08:00
westfish
fd0646086b fix bug in qg-example (#3875) 2022-11-24 13:09:58 +08:00
Sijun He
46082e3001 Text Classification Taskflow (#3841)
* ready for review

* pre-commit

* break lines

* add comments

* change taskflow formation; address comments

* styles

* address comments
2022-11-24 11:51:17 +08:00
Roc
e5ec740181 Fix missing fluid api (#3861)
* update moe recompute.

* update fluid api to paddle api
2022-11-24 10:17:07 +08:00
Sijun He
e342029f1d Fill mask Taskflow (#3870)
* implementation complete

* add tests

* yapf

* allow from_hf_hub

* isort imports

* address comments
2022-11-24 00:16:49 +08:00
Sijun He
4cc8578404 Enable Dialogue taskflow to load from HF hub (#3865)
* works

* dialogue works

* ready for PR

* fix style

* address comments

* address comments

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-11-23 17:11:45 +08:00
wawltor
fc7cdc025f Update README_cn.md 2022-11-23 11:59:39 +08:00
wawltor
fc3745b781 Update README_en.md 2022-11-23 11:55:54 +08:00
骑马小猫
d4b81b87a6 [Bugfix] fix readthedocs website building error (#3859)
* fix paddle environment

* fix python.version key

* update readthedocs

* upgrade python 3.9

* use python3.8

* use v3

* use v2

* use v2

* use python3.8
2022-11-23 10:05:20 +08:00
wawltor
05b3bd15aa Update README.md 2022-11-22 21:42:18 +08:00
骑马小猫
eeb5cfeed5 add cli requirements to upstream (#3853) 2022-11-22 09:51:06 +08:00
wawltor
5e6bc554bc update the simple_serving document (#3839)
* rename PaddleServing to paddlenlp_serving

* update the uie readme

* update the uie document
2022-11-21 21:14:43 +08:00
wawltor
8c509ddb8a Update README_en.md 2022-11-21 18:23:50 +08:00
wawltor
e35c7c233c Update README_cn.md 2022-11-21 18:23:25 +08:00
Zhong Hui
19c4ca3110 [Trainer] Fix the sharding import (#3831) 2022-11-21 16:33:56 +08:00
wawltor
0c18e3c478 Update README.md 2022-11-21 15:01:37 +08:00
wawltor
6cf3ff06a7 Update README.md 2022-11-21 15:01:22 +08:00
Jack Zhou
303f35a529 fast_tokenizer -> fast-tokenizer-python (#3836) 2022-11-21 14:39:03 +08:00
wawltor
351cb20ef8 add the paddlenlp server (#2845)
* add the paddlenlp server

* remove the code

* update the some logger for the paddlenlp server
2022-11-21 14:01:21 +08:00
Noel
4f56bafdbf [readme] update news for v2.4.3 (#3808)
* [readme] update readme docs for v2.4.3

* Update README_en.md

* Update README_cn.md

* Update README_en.md

* Update README_cn.md
2022-11-21 11:48:26 +08:00
xiongkun
db5c44be24 [tipc-accuracy-test] add test_train_dy2static_python and extract_loss.py (#3801) 2022-11-21 10:47:08 +08:00
Sijun He
b33eadb567 Enable Model and Tokenizer to directly load paddlepaddle models from huggingface hub (#3786)
* wip

* wip

* AutoModel and AutoTokenizer works

* eady for review

* isort and yapf

* fix style

* unit test pass

* fix styles

* add todo

* integration tests

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-11-20 14:40:06 +08:00
yujun
cd78a9ade1 [PPDiffusers] ppdiffuser LDM weight to original LDM weight script (#3809)
* PPDiffusers版的LDM权重转换为原版LDM权重

* typo

* update args

Co-authored-by: gongenlei <gongel@qq.com>
2022-11-19 21:16:17 +08:00
Jack Zhou
de3509c241 Fix windows python (#3824)
Fix windows python lib for fast_tokenizer
2022-11-19 10:21:10 +08:00
Jack Zhou
169d8d1d0e [FastTokenizer] Add python suffix (#3821)
* rename fast_tokenizer

* fast_tokenizer->fast-tokenizer-python
2022-11-19 00:16:15 +08:00
Zhong Hui
6e73ee0019 [Trainer] Update trainer.md for bf16 (#3810)
* Update trainer.md
2022-11-18 18:24:57 +08:00
yujun
8842fbf8a1 [PPDiffusers] update unet attention (#3792)
* update unet attention

* rm _sliced_attention

* update unet attention support _sliced_attention

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-11-18 14:43:09 +08:00
Jack Zhou
d806c2bb45 [FastTokenizer] Add clip python tokenizer (#3805)
* Add clip fast tokenizer

* fix cpp readme
2022-11-18 11:45:35 +08:00
lugimzzz
e002b0df7c bug_fix (#3806) 2022-11-18 10:23:11 +08:00
Jack Zhou
707a94d128 [FastTokenizer] Update fast_tokenizer doc (#3787)
* update link

* rename demo to examples

* add python readme

* update the cmakelist

* add ernie python demo

* add status print after compiling

* Add README for ernie fast tokenizer

* Add clip fast tokenizer cpp readme

* Update docs

* Add some tips

* add deps

* add deps

* update

* update

* update shell
2022-11-17 17:00:41 +08:00
yujun
0ce21eab98 [PPDiffusers] update ldm train code (#3772)
* update ldm train

* add rank==0

* add rank==0

* update trainer

* update

* update

* update

* update

* update trainer code

* update generate pipelines

* update support bf16
2022-11-17 14:33:42 +08:00
Noel
051d4e7ea4 [prompt] remove unused arguments (#3794)
* [prompt] delete unused arguments

* [few-shot] update script for fine-tune
2022-11-17 14:15:17 +08:00
Sijun He
60a51f0f34 Upgrade applications/text_classifications/multi_class to use Trainer API (#3679)
* add trainer to multi_class finetuning

* styles

* fix styles

* log eval metrics

* address comments

* address comments

* precommit

* fix README style

Co-authored-by: lugimzzz <63761690+lugimzzz@users.noreply.github.com>
2022-11-17 13:22:32 +08:00
yujun
bfec1e7ccd Fix #3768 (#3789)
* fix bug
* update
2022-11-17 11:33:53 +08:00
骑马小猫
1d3f26906b add p1 features to six models (#3462)
* update p1 models

* update p1 models

* update p1 models

* complete all p1 method

* add type annotation

* ffix default value

* add type annotation to roformer

* fix variable name bug

* remove position_ids cache in ernie

* revert dtype

* revert dtype

* update ernie test_modeling

* update ernie test_modeling

* update past_key_values testing code

* revert get_default_dtype changes

* fix testing header importing

* update testing metric

* remove position_ids cache

* import precision of logits

* fix yapf for tinybert modeling
2022-11-17 09:41:04 +08:00
骑马小猫
d3d059273a [NewFeature] add paddlenlp command (#3538)
* add cli solution

* add model weight converter command

* add converter

* update cli setup

* update cli

* update search & download

* update table header name

* rename logger msg

* upgrade command arguments

* complete converter

* add comments to online convert

* add comment to cli/main

* add clip converter

* update clip converter

* complete clip converter

* add init_class field

* update converter

* add state-dict checker

* imporve converter gpu memory usage case

* remove unused fields from config

* add remove unused fileds

* add config fields to converter

* add cli

* add convert for stable-diffusion

* remove ppdiffusers converter

* update description of cli

* update exit code

* add cli dependency to dev tag

* fix typo
2022-11-17 07:26:51 +08:00
yujun
7a4355c467 add DPMSolverMultistepScheduler (#3764) 2022-11-16 22:16:29 +08:00
lugimzzz
6f18a48529 link fix in text classification application (#3785)
* link_fix

Co-authored-by: Noel <wanghuijuan03@baidu.com>
2022-11-16 21:01:21 +08:00
w5688414
cd29ed8a11 Add English semantic search of pipelines (#3718)
* Add English semantic search of pipelines

* Optimize semantic_search modeling.py

* Update syntax

* Update semantic search english examples

* Change parameter user_en to use_en
2022-11-16 19:43:29 +08:00
Jack Zhou
95deb20486 [FastTokenizer] faster to fast (#3762)
* Fix docs for faster_tokenizers

* Fix docs for FasterTokenizer

* faster_tokenizer -> fast_tokenizer in code

* Update comments, codes for faster

* use_faster->use_fast

* Add py310 supported

* fix faster->fast

* Add python api for fast_tokenizer.core module

* Add python api for fast tokenizer

* Fix some function signature

* Fix code style
2022-11-16 18:10:47 +08:00
w5688414
5af28bc24a Add Retrieval based multi label classification (#3656)
* Add Retrieval base multi label classification

* Update README& Add Macro fl metric

* Remove unused functions

* Update retrieval based classification README.md

* format the import args

* Update import args format

* format
2022-11-16 17:57:37 +08:00
Noel
d1a08b613a [cblue] fix bug brought by the switch of TransformerEncoder in electra (#3778) 2022-11-16 17:34:38 +08:00
Zhong Hui
38048296ec [Trainer] Fix bugs of resume training (#3780) 2022-11-16 16:37:19 +08:00
duanboqiang
3d105b626d [Trainer] And bf16 autocast (#3781)
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-11-16 16:35:40 +08:00
westfish
b673ee5e29 add ppdiffusers inference and pipelines-doc (#3759)
* add inference and pipeliens-doc

* update doc

* update doc

* update doc
2022-11-16 16:31:41 +08:00
w5688414
39c4f760b1 Add Gradient Cache&Recompute into Neural Search (#3697)
* Add Gradient Cache&Recompute into Neural Search

* Update README.md

* Optimize gradient cache code
2022-11-16 15:58:36 +08:00
wawltor
9ab3ea4a9b Update README.md 2022-11-16 15:40:44 +08:00
Noel
fa04ecbcb4 [prompt] update prompt api & add prefix template (#3724) 2022-11-16 14:11:49 +08:00
LiYuRio
57a1818b18 [Dist] Fix all_reduce (#3702) 2022-11-16 10:49:26 +08:00
duanboqiang
48c8d8897a fix sd fp16 eval bug (#3771) 2022-11-15 21:57:35 +08:00
Noel
e1d807d428 [Trainer] add type checking before calling methods of PretrainedModel (#3770) 2022-11-15 20:41:36 +08:00
lugimzzz
af9461a785 text_classification_application_bug_fix (#3765)
* bug_fix
2022-11-15 18:56:16 +08:00
westfish
010fcd87e7 Add unsupervised-qa pipelines (#3605)
* unsupervised qa pipeline

* remove useless

* reset question-answering/readme.md

* delete useless

* add offline_qa_generation and update codes

* update unsupervised-qa pipelines

* modify readme

* change version

* file support
2022-11-15 14:10:55 +08:00
Zhong Hui
b35b8d6930 [Trainer] support sharding for trainer. (#3352)
* supprt sharding for trainer.

* support sharding for t5.

* add t5-3b

* add bf16 support.

* fix sharding stage2

* support iterable dataset.

* fix save strategy.
2022-11-15 10:56:57 +08:00
duanboqiang
25473a8c54 add ema for sd (#3755) 2022-11-14 19:35:27 +08:00
Jack Zhou
22ae267d95 [FastTokenizer] Add clip fast tokenizer (#3746)
* Add clip fast tokenizer

* Add clip fast tokenizer unittest

* Add ThreadNum Set Get

* Add set, get thread num pybind

* Add pybind of set get thread num

* Add sido foframework  or clip

* Add README

* remve omp

* Add EnccodeBatch for 2 vectors of strings

* Fix AddedToken

* Remove words_idx print

* Add comments

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-11-14 18:05:50 +08:00
Linjie Chen
ec8ef93062 fix eval for UIE (#3753) 2022-11-14 16:37:07 +08:00
Yam
3ca354711f Add embedding inputs to T5 model (#3668) 2022-11-14 16:06:31 +08:00
lugimzzz
b63f356bb8 rename_docprompt_pipeline (#3731) 2022-11-14 14:13:12 +08:00
w5688414
70c8bfc633 Add secondary development for pipelines examples (#3624)
* Add secondary development for pipeline examples

* Fix some statement
2022-11-14 12:54:07 +08:00
Zhong Hui
d52b1e21eb Update README for FewCLUE (#3748) 2022-11-14 12:53:29 +08:00
wawltor
34a25cbe09 Update README_cn.md 2022-11-14 10:10:26 +08:00
Jack Zhou
60fdf4a055 [FastTokenizer]Add ByteLevel Pretokenizer, Roberta Processing, ByteLevel Processing, Split Pretokenizer for CLIP Tokenizer (#3721)
* Add ByteLevel pretokenizer

* Add roberta processing

* FASTERTOKENIZER_DECL->FASTTOKENIZER_DECL

* Add ByteLevelPostProcessor

* Implement Roberta PostProcessor

* Add roberta postprocessor and unittest

* Add split pretokenizer

* Add split pretokenizer

* Add SplitPreTokenizer, RobertaPostProcessor, ByteLevelPrTokenizer, ByteLevelPostProcessor

* normalizer::SplitMode -> core::SplitMode

* Add SplitPreTokenizer pybind

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-11-13 11:56:17 +08:00
Jack Zhou
5f3ab3c447 Add sd export deps (#3739)
* Add toc for sd export

* update doc

* add toc of ppdiffusers

* remove toc

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-11-11 20:50:20 +08:00
yujun
07bb991f63 fix small bug and release 0.6.2 (#3737)
Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-11-11 18:54:49 +08:00
Yam
01bb2b9abe replace framework.png with url (#3736) 2022-11-11 18:36:34 +08:00
骑马小猫
712381bb23 [BugFix] fix value cast in model-utils (#3733)
* fix value cast

* update tensor type

* fix the format
2022-11-11 17:15:21 +08:00
Yam
f97bd562d9 add Bart more output & loss (#3436)
* move function convert_encoder_output to file model_outputs.py

* add more output and loss to bart

* add more test case

* fix judgement condition of single Tensor

* fix judgement condition of single Tensor for T5 model

* adjust transformers_decoder_layer function

* add more output & loss to mbart

* move gc.collect() to testing_utils.PaddleNLPModelTest and replace unittest.TestCase to PaddleNLPModelTest

* commit bart
2022-11-11 15:16:53 +08:00
yujun
e1d10087f4 [PPDiffusers] add compare (#3732)
* add compare

* update

* typo

* typo
2022-11-11 14:50:03 +08:00
Jack Zhou
060e2234f7 rename export.md (#3730)
Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-11-11 14:37:54 +08:00
Yam
34956ca49e add unified transformer more output & loss (#3459) 2022-11-11 14:26:43 +08:00
Jack Zhou
ed266e7a83 Add export readme (#3727)
* Add export readme

* Add export description

* move to export dir

* Add infer description
2022-11-11 14:10:19 +08:00
yujun
87c8ca2d3f [PPDiffusers] add convert scripts and readme (#3723)
* add convert scripts and readme

* update readme

* refomat py

* add diffusers ldm -> ppdiffusers ldm

* mv dir
2022-11-11 13:57:46 +08:00
w5688414
72cc9e12ad Fix batch prediction bug and FAQ README of Pipelines (#3712)
* Fix batch prediction bug of Pipelines

* Change faq dir of pipelines
2022-11-10 20:49:07 +08:00
Jack Zhou
bbf0c39fc5 FasterTokenizer->FastTokenizer (#3719) 2022-11-10 16:52:09 +08:00
westfish
d37fd7f14a add ldm superresolution (#3710)
* add ldm superresolution

* PIL.Image.LANCZOS adapt to different version

Co-authored-by: yujun <50394665+JunnYu@users.noreply.github.com>
2022-11-10 15:36:03 +08:00
gongenlei
a85212ed00 [New Features] Add FID score (#3685)
* add fid

* update doc

* update import

* add code annotation

* update docs

* add hack for bn
2022-11-10 15:01:25 +08:00
chenxiaozeng
767d3552e3 Update doc (#3711)
* add online course info

* add online course info

* update group code
2022-11-10 11:42:02 +08:00
Jiaqi Liu
feb9d8296b Add onnx_format arg for Compression API (#3696)
* update compress api

* remove uie compress in md
2022-11-09 15:26:52 +08:00
yujun
e97f670440 support EulerAncestralDiscreteScheduler (#3708) 2022-11-08 20:59:25 +08:00
Yam
6289d9c0d3 add Codegen output & loss (#3465) 2022-11-08 19:59:44 +08:00
Sijun He
7b4cf36b90 Add Chinese and English version of CODE_OF_CONDUCT.md (#3687)
* add CoC

* rename

* v2.1
2022-11-08 19:07:50 +08:00
骑马小猫
a50fbbcc30 [BugFix] fix astype error when dynamic-to-static mode (#3701)
* fix astype warning

* update model_utils for dynamic-to-static

* add comment & imporve Makefile
2022-11-08 18:58:28 +08:00
yujun
9e2a0a8a9f [ppdiffusers] add text_to_image_laion400m example (#3693)
* add text_to_image_laion400m

* add write_filelist
2022-11-08 14:56:58 +08:00
wawltor
f74de55082 fix the taskflow skep large model (#3695) 2022-11-07 21:37:07 +08:00
BinChen
e785bb1163 box2example ori_boxes+ (#3677)
Co-authored-by: x-shadow-man <1494445739@qq.com>
2022-11-07 10:32:14 +08:00
yujun
ce31a77f90 [PPDiffusers] Fix ppdiffusers bug and support ZH stablediffusion (#3663)
* fix win download bug, etc

* add attention mask support zh model

* pad to max length

* update NEG_NF

* update diffusers readme

* fix windows download

* fix windows download
2022-11-06 16:49:04 +08:00
sserdoubleh
58a5a9dcfd Fix FT malloc size for beam search. (#3662)
Co-authored-by: liu zhengxi <380185688@qq.com>
2022-11-04 19:28:09 +08:00
wawltor
6387410b5a Update README.md 2022-11-04 18:29:38 +08:00
Yam
1a53c35887 Add Unimo output loss (#3676) 2022-11-04 16:48:47 +08:00
Yam
fd6ef4058e Revert "Unimo output loss (#3450)" (#3673)
This reverts commit 6471ce331a.
2022-11-04 16:09:39 +08:00
gongenlei
1f2b2c5d58 fix download url (#3670) 2022-11-04 11:10:40 +08:00
gongenlei
7b6454908a Rm debug info (#3667)
* rm debug info

* rm unused import
2022-11-03 19:19:07 +08:00
Jiaqi Liu
02b4383b7e Fix UIE README (#3665)
* fix uie reamde

* test=document_fix
2022-11-03 17:27:04 +08:00
Yam
6471ce331a Unimo output loss (#3450) 2022-11-03 15:51:11 +08:00
Jiaqi Liu
61acf19460 Fix UIE eval (#3653)
* fix uie eval

* fix debug mode
2022-11-03 14:22:15 +08:00
Sijun He
c38902e3a8 Adding inputs_embeds argument and switch to paddle.nn.TransformerEncoder for Electra models (#3401)
* add inputs_embeds input arguments to all electra models

* save past_key_value for next PR

* remove unused input_shape

* fix yapf style check

* address comments

* fix style

* fix unit test

* address comment

Co-authored-by: Guo Sheng <guosheng@baidu.com>
Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-11-03 13:33:09 +08:00
ymyjl
1fc23a8888 [Tutorial] Add torch migration tutorial (#3641)
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-11-03 10:42:47 +08:00
骑马小猫
afeb623588 [BugFix] fix typo (#3651)
* fix typo

* revert scripts

* remove torch description
2022-11-02 20:27:12 +08:00
w5688414
ff546f6d9a Fix FAQ docx ui upload parsing support and reformat docx.py (#3645)
* Fix FAQ docx ui upload parsing support and reformat docx.py

* Add more comments

* Optimize concatenate texts
2022-11-02 17:48:12 +08:00
gongenlei
81bb7d1433 Fix download url on Windows (#3640)
* add pegasus

* rm debug info

* fix decode

* update pegasus

* add faster pegasus

* refactor unimotext summary

* add pegasus summary app

* add requirements

* add pegasus to taskflow

* support inference and deploy

* add FG perf and sample

* update taskflow

* add docs

* rm ProcessInfo.json

* update export model

* update serving doc and shell

* update unimo-text doc

* docs: FasterTransformer-->FasterGeneration

* update docs

* fix: url is error when windows download community model

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-11-02 17:23:02 +08:00
chenxiangzhen
6eb6937b69 Update predict.py (#3602)
Delete unnecessary package

Co-authored-by: w5688414 <w5688414@gmail.com>
2022-11-02 16:54:29 +08:00
westfish
228c58a494 fix bug about template 3 (#3646) 2022-11-02 16:00:06 +08:00
Jiaqi Liu
e94af7978a Add compression for UIE (#3496)
* add compression for uie

* update uie readme

* update reamde, recover evaluate.py

* fix resource check

* fix qat ernie-m

* requirement

* update

* update

* delete export_model.py

* delete model export in readme

* set start_positions and end_positions to default for UIE
2022-11-02 14:23:01 +08:00
WangZhen
83a9c3893a [TIPC]Add transformer_big_bs4096 static .sh (#3622)
* Add transformer_big_bs4096 static .sh

* Format shell
2022-11-01 15:43:58 +08:00
lugimzzz
bdd659d266 add bad case analysis for text classification (#3385)
* bad case analysis
2022-11-01 09:43:32 +08:00
lugimzzz
b52c2ea5d2 add soft link from examples to application (#3587) 2022-10-31 20:56:46 +08:00
骑马小猫
2483d4fb85 [Bug fix] update the name of pypi server (#3627)
* update yaml

* update yaml scripts

* deploy dev version

* remove test pypi

* update name of pypi
2022-10-31 20:41:31 +08:00
骑马小猫
7bc85cdfb2 [Bug Fix] update pypi workflow (#3626)
* update yaml

* update yaml scripts

* deploy dev version

* remove test pypi
2022-10-31 19:30:47 +08:00
骑马小猫
513a8328d9 update yaml (#3621) 2022-10-31 17:14:08 +08:00
骑马小猫
3e2ddd182c [NewFeature] add ppdiffusers CD workflow (#3604)
* add ppdiffusers version control

* add ppdiffusers version control

* enable should deploy checking

* revert pipeline ui changes

* ignore version file

* 🔥 update version to 0.6.2

* gi

* bump version

* upate

* deploy package to testpypi

* re-trigger the ci
2022-10-31 16:44:34 +08:00
WangZhen
b90ed42dff Add bs5120 for transformer big tipc config (#3600) 2022-10-31 14:40:56 +08:00
Linjie Chen
b705fa481d Support finetune for uie-m (#3227)
* support finetune for uie-m

* update

* Update utils.py

* support finetune and evaluate for en model
2022-10-31 11:11:20 +08:00
lastrei
cf478ba6ee fix typos (#3607)
Co-authored-by: Linjie Chen <40840292+linjieccc@users.noreply.github.com>
2022-10-31 10:15:43 +08:00
Wang-ck123
9eda9a46c4 Fix docs (#3409)
设置return_dict=False后才能使用idx下标,否则无法使用,运行报错。
2022-10-30 00:56:24 +08:00
chenxiaozeng
1f88c41d14 add PPDiffusers info in README. (#3608)
add PPDiffusers info in README.
2022-10-29 14:50:51 +08:00
liu zhengxi
7f650ac0ca fix missing comma (#3606) 2022-10-28 19:51:34 +08:00
骑马小猫
b6c3589ea6 add bert config solution (#3174)
* add bert config solution

* change num_labels to num_classes

* add unittest for configuration

* update bert model

* update bert config

* update bert test modeling

* update test modeling

* update bert testing and model

* add roberta config

* update bert config

* upate bert-modeling

* update bert modeling

* update code style

* remove unrelated codes

* fix community related code

* update pretrained config

* update configuration name

* add compatibility codes

* add automodel test & improve downstream model test

* remove parse_args & kwargs

* update roberta & bert

* add warning for only-one weight file

* use config to init BertEmbedding & BertPooler

this change will be upgraded when TinyBertConfig is completed

* fix codestyle

* 调整bert pretrained

* use attribute to access the value

* remove ignored keys on loading

* fix stub file bug & add use_cache to configuration_utils

* fix roberta pretrain

* upgrade the  docs and extension of import_utils

* fix default value of `use_cache`

* update type hinting

* update docstring of BertForXXX model

* update warning string

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-10-28 19:30:18 +08:00
吴高升
c2e1dc4852 Fix the file upload multiple times of Pipelines (#3568) 2022-10-28 17:19:06 +08:00
yujun
1c5e127866 [PPDiffusers] rename ppdiffusers (#3601)
* rename ppdiffusers

* rename diffusers_paddle
2022-10-28 16:52:59 +08:00
Roc
c8bc4405fc [MOE] use adamw from paddle.optimizer (#3598) 2022-10-28 14:51:31 +08:00
westfish
05e7432ef7 update PaddleNLP v2.4.2 readme.md (#3597)
* update readme

* update readme.md

* update
2022-10-28 14:34:26 +08:00
liu zhengxi
d390dc95e8 Lift restrictions to support more d_inner_hid (#3592)
* lift restrictions

* code style

* add state_dict
2022-10-28 13:59:01 +08:00
WangZhen
b262611f37 [TIPC]Fix dy2st tipc gpt 8 error (#3586)
* Fix dy2st tipc gpt 8 error

* Fix transformer benchmark dy2st config error

Co-authored-by: yujun <50394665+JunnYu@users.noreply.github.com>
2022-10-28 13:05:32 +08:00
feifei-111
78c8615791 Added 4 scripts for benchmark (#3585) 2022-10-28 09:56:59 +08:00
yujun
16aa2ba5b1 [WIP] Add diffusers_paddle (#3445)
* add paddle version diffusers

* add examples but need to test them

* support download from bos

* update diffusers according to https://github.com/JunnYu/diffusers/pull/1

* install & test text_invert dreambooth etc

* update examples and test pass

* add textual_inversion readme and update text to image readme

* update examples

* update https://github.com/JunnYu/diffusers/pull/2

* fix a small bug

* import bug

* fix missing seqlen

* _diffusers_paddle_version

* fix bug

* https://github.com/JunnYu/diffusers/pull/3

* update docs, add dreambooth readme, fix bug

* dreambooth support save every 500 step

* update onnx

* update

* type paramaters

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-10-27 17:15:39 +08:00
liu zhengxi
21345f8d2e Fix some unit tests' issue (#3553) 2022-10-27 16:20:56 +08:00
gongenlei
c9c5c15a66 Add pegasus (#3275)
* add pegasus

* rm debug info

* fix decode

* update pegasus

* add faster pegasus

* refactor unimotext summary

* add pegasus summary app

* add requirements

* add pegasus to taskflow

* support inference and deploy

* add FG perf and sample

* update taskflow

* add docs

* rm ProcessInfo.json

* update export model

* update serving doc and shell

* update unimo-text doc

* docs: FasterTransformer-->FasterGeneration

* update docs

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-10-27 15:11:51 +08:00
westfish
d57e350f9e Merge pull request #3560 from westfish/qg-example
add qg models and update readme
2022-10-27 13:14:45 +08:00
westfish
295d68e940 Merge branch 'develop' into qg-example 2022-10-27 11:59:12 +08:00
lugimzzz
947007f552 fix dead link in text classification (#3566) 2022-10-27 11:44:01 +08:00
westfish
14c934c1a1 update readme 2022-10-27 03:19:10 +00:00
westfish
e98231f911 add unimo-large/without-template result 2022-10-27 03:15:10 +00:00
Zhong Hui
d1506f8a38 Update modeling.py (#3559) 2022-10-27 10:52:43 +08:00
westfish
94864bc48e rename v2.pdparams to full_domain.pdparams 2022-10-26 12:04:29 +00:00
吴高升
b0f7650ecf Add GIF visualization for pipeline examples (#3561) 2022-10-26 19:47:01 +08:00
westfish
cd5a2e35a6 update readme 2022-10-26 11:27:33 +00:00
westfish
91d5c527dd update taskflow.md and unimo-text/readme.md 2022-10-26 10:21:13 +00:00
westfish
fca7ca25da update taskflow 2022-10-26 09:55:09 +00:00
westfish
b0ba2e1e79 add qg models and update readme 2022-10-26 09:40:05 +00:00
Chenxiao Niu
553ba12211 [MLU] add transformer config support. (#3541) 2022-10-26 17:15:53 +08:00
USTCKAY
122824885c [CustomDevice]add custom NPU support for rnn (#3521)
* [CustomDevice]add custom NPU support for rnn

* delete 'npu' choice of device

* change 'Custom NPU' to 'Ascend NPU'

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-10-25 20:02:19 +08:00
吴高升
211e8204dd Fix README.md of Retrieval based classification (#3551) 2022-10-25 17:07:56 +08:00
wawltor
47f7c36e1e Add the expoort model for the paddlenlp (#3516) 2022-10-25 16:53:08 +08:00
吴高升
7eac0586bc Update docx parsing for Pipelines (#3546) 2022-10-25 14:36:46 +08:00
liu zhengxi
a0f5a8ebcd add support for libpaddle.so (#3545) 2022-10-25 11:53:58 +08:00
chenxiaozeng
636e3430fc add online course info (#3543)
* add online course info

* add online course info
2022-10-25 11:39:35 +08:00
lugimzzz
d52d8e5ea1 update docprompt pipeline example (#3542)
* update docprompt pipeline example
2022-10-24 19:21:50 +08:00
lugimzzz
97fe71d000 Add docprompt example in pipelines (#3534)
* add_docprompt_example_in_pipelines
2022-10-24 15:24:53 +08:00
Sijun He
1bad94989f improve setup.py for easier dev environment setup (#3495)
* setup.py file

* addback newline

* style

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-10-24 14:35:13 +08:00
吴高升
04a742106e Fix dead links of pipelines&FAQ Finance (#3540) 2022-10-24 13:28:06 +08:00
westfish
1076b890de fix text summarization taskflow cannot load self-defined model (#3533)
* fix text summarization taskflow cannot load self-defined model

* update taskflow

Co-authored-by: gongenlei <gongel@qq.com>
2022-10-24 11:33:47 +08:00
Jiaqi Liu
219b6abd15 fix tinybert readme bug (#3535) 2022-10-24 11:05:38 +08:00
吴高升
fb0cb9b35b Add ERNIE-ViLG models into Pipelines (#3512)
* Add ERNIE-ViLG models into Pipelines

* Add more comments

* Add missing text_to_image_generation.yaml

* Rename the files

* Add output_dir parameters& Update README.md

* Update README.md
2022-10-21 15:58:03 +08:00
iamWHTWD
293c8308af add xpu to choices (#3527) 2022-10-20 20:58:44 +08:00
westfish
e14487780b Merge pull request #3524 from westfish/qg-example
fix prediction bug in qg example
2022-10-20 17:46:13 +08:00
westfish
39b49c928f Merge branch 'develop' into qg-example 2022-10-20 17:38:29 +08:00
westfish
38fcccbd86 fix bug in prediction 2022-10-20 09:07:47 +00:00
westfish
31dc47aed5 Merge branch 'qg-example' of github.com:westfish/PaddleNLP into qg-example 2022-10-20 08:57:49 +00:00
Linjie Chen
8f3e4e51e3 Update README.md (#3518)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
2022-10-20 00:49:17 +08:00
WangZhen
7476962a6c Add more Dy2St model for TIPC (#3485)
Co-authored-by: yujun <50394665+JunnYu@users.noreply.github.com>
2022-10-19 19:58:05 +08:00
Linjie Chen
b1ac71b2f5 Add file check for custom model (#3506) 2022-10-19 16:22:17 +08:00
Linjie Chen
1ac55f0325 Update README.md (#3503) 2022-10-19 10:28:16 +08:00
chenxiaozeng
0497ce7984 Update README.md (#3502) 2022-10-18 21:43:19 +08:00
Linjie Chen
0a402ca287 Add README.md for Document Intelligence (#3498)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
2022-10-18 17:34:52 +08:00
Jiaqi Liu
a12481fc30 updae compress usage in multi label classification (#3494) 2022-10-17 19:13:14 +08:00
Linjie Chen
3e7d4d8140 Add symbolic link for ERNIE-Layout (#3484)
* add symbolic link for ernie_layout

* Update README.md

* Update README.md

* Update README.md
2022-10-17 18:15:10 +08:00
吴高升
ce67b4fc41 Add windows serving support for faq finance (#3491)
* Add windows serving support for faq finance

* Remove unused comments
2022-10-17 17:51:02 +08:00
Noel
839b2d09bb [fewshot] fix dead links in README (#3492) 2022-10-17 17:19:51 +08:00
westfish
db915e756a Bug fix uie utils (#3490)
* fix bug the result variable is not defined

* update
2022-10-17 16:32:18 +08:00
Jiaqi Liu
217a25cf01 supports strategy 'qat' (#3271) 2022-10-17 15:39:58 +08:00
liu zhengxi
c00d28fcd8 Add MBart unit tests (#3323) 2022-10-17 13:45:12 +08:00
Zhong Hui
90c6f1da59 fix gpt with paddle.matmul (#3483) 2022-10-17 11:46:14 +08:00
Linjie Chen
f43cfd0d79 Update README.md (#3474)
* Update README.md

* Update README.md

* Update README.md

* Update README.md
2022-10-14 18:29:13 +08:00
gmm
caa37ce8d8 【benchmark】fix benchmark log (#3469) 2022-10-14 16:30:48 +08:00
Linjie Chen
988204dfbf Update README.md and optimize DocPrompt postprocess (#3441)
* Update README.md

* optimize sort

* update

* Update

* Update

* Update

* Update

* Update

* Update

* update

* update

* Add english docs and rename ernie_layout

* Add english docs and rename ernie_layout

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* Update taskflow.md

* update
2022-10-14 14:08:49 +08:00
yujun
a6b46912d2 [NEW Features] feature_extraction and processor support from_pretrained (#3453)
* update

* add import
2022-10-13 19:33:31 +08:00
westfish
a3e92bbb04 Merge pull request #3438 from westfish/qg-taskflow
add qg-taskflow
2022-10-13 18:06:25 +08:00
westfish
426b75778f Merge branch 'develop' into qg-taskflow 2022-10-13 17:41:05 +08:00
yujun
6011ed8573 Fix #3446 (#3457)
* update Pillow version

* compare version
2022-10-13 15:58:38 +08:00
westfish
b1e373c6db Merge branch 'qg-taskflow' of github.com:westfish/PaddleNLP into qg-taskflow
20221012
2022-10-13 07:29:43 +00:00
westfish
e83abbb47f fix some typos in qg-example readme 2022-10-13 07:27:48 +00:00
westfish
361d826fbd fix typos in readme.md 2022-10-13 04:25:01 +00:00
westfish
63b3c312ec Merge branch 'develop' into qg-taskflow 2022-10-13 11:03:59 +08:00
westfish
c65dbb42f8 Merge pull request #3381 from westfish/uie_reader_memory_overflow
fix uie dataloader memory overflow
2022-10-13 11:00:43 +08:00
westfish
4c4f961b89 Merge branch 'develop' into uie_reader_memory_overflow 2022-10-13 10:53:19 +08:00
liu zhengxi
db1f9919c3 refine gpt (#3447) 2022-10-12 22:13:40 +08:00
westfish
7fbd726ccf modified according to zeyang's comments 2022-10-12 13:29:49 +00:00
westfish
50cd2197f1 Merge branch 'develop' into uie_reader_memory_overflow 2022-10-12 16:14:38 +08:00
Sijun He
e544a04f8a Support past_key_values argument for Electra (#3411)
* unit test pass; fix yapf

* change docstring

Co-authored-by: 骑马小猫 <1435130236@qq.com>
Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-10-12 15:31:13 +08:00
吴高升
ddb59bfb56 Add batch prediction for pipelines (#3432)
* Add batch prediction for pipelines

* Fix some hardcode problem& Update comments
2022-10-12 12:19:21 +08:00
吴高升
ee696c397d Update FAQ Finance Paddle Serving dependencies (#3430) 2022-10-12 12:03:09 +08:00
qipengh
0b4985dda2 [MLU] support SQuAD_Bert with mlu device (#3434) 2022-10-12 11:27:10 +08:00
吴高升
907144f8ee Add multi type files index update example for pipelines (#3439) 2022-10-11 21:44:42 +08:00
westfish
aa1bef4890 fix code style 2022-10-11 11:42:40 +00:00
westfish
01be7792c8 add qg-taskflow 2022-10-11 10:38:37 +00:00
wawltor
70b6e5043a remove the tcn for the paddlenlp (#3435) 2022-10-11 18:24:51 +08:00
Chenxiao Niu
031e2bf8f6 support mlu training (#3431)
* support mlu training

* [mlu] add mlu config in rnn and ernie-1.0 README.
2022-10-11 16:30:01 +08:00
westfish
eee364e7f8 Merge pull request #3410 from westfish/qg-example
add qg example
2022-10-11 15:41:19 +08:00
westfish
289d8214b1 Merge branch 'develop' into qg-example 2022-10-11 15:39:29 +08:00
westfish
a8f08c8ed5 adjust the position of the experiment' result 2022-10-11 03:19:23 +00:00
wawltor
9182f34818 Update README_cn.md 2022-10-10 21:56:31 +08:00
Noel
1e81d90f1f [few-shot] fix script for multi_class and fix input type for windows (#3426) 2022-10-10 20:07:25 +08:00
westfish
3f9ea47d15 modified according to zeyang's comments, 20221010 2022-10-10 11:49:26 +00:00
Noel
b6a718bc87 [prompt] add doc (#3362) 2022-10-10 19:37:11 +08:00
lugimzzz
0cb7fe99f7 support paddle serving http deploy for text classification (#3378)
* add_http_deploy
2022-10-10 16:06:07 +08:00
westfish
3109311e58 rewrite unimo-text/predict.py to retrain only the prediction function 2022-10-10 07:50:39 +00:00
Linjie Chen
507084013c fix bug of debug mode (#3417) 2022-10-10 14:34:08 +08:00
alkaid
c987531a2a Update taskflow.py (#3424)
fix typo
2022-10-10 14:33:31 +08:00
yujun
6b54c4e523 fix pillow deperate warning (#3404)
Co-authored-by: gongenlei <gongel@qq.com>
2022-10-10 10:16:33 +08:00
westfish
9c6300d6a5 update qg example readme 2022-10-09 13:32:06 +00:00
骑马小猫
fcb477de4f [BugFix]Fix ernie tokenizer unittest (#3423)
* fix bert unittest bug

* change token_labels -> sequence_labels

* update ernie tokenizer max_input_size
2022-10-09 20:55:29 +08:00
骑马小猫
c5c06ce0bb fix bert unittest bug (#3422)
* fix bert unittest bug

* change token_labels -> sequence_labels
2022-10-09 19:52:42 +08:00
westfish
c92632bfe0 modified according to zeyang's comments 2022-10-09 09:28:41 +00:00
westfish
4f70f7297b modified according to zeyang's comments 2022-10-09 09:04:02 +00:00
yujun
2dfdfa04a2 fix bigru crf offset index error (#3418) 2022-10-09 15:28:11 +08:00
chenxiaozeng
c297ab07b1 Update README_cn.md (#3413) 2022-10-09 14:54:37 +08:00
westfish
fdc9a1b1f2 rewrite run_gen.py to train.py and predict.py in unimo-text 2022-10-09 04:05:28 +00:00
westfish
116790b58f normalize t5 naming 2022-10-09 03:31:33 +00:00
westfish
e08cd026d6 delete .sh files in t5 dir 2022-10-09 03:09:43 +00:00
westfish
afcfb6712d delete useless scripts 2022-10-08 14:11:08 +00:00
westfish
3db00167e8 add qg example 2022-10-08 13:56:03 +00:00
liu zhengxi
e5189e973b fix gpt ut (#3407) 2022-10-08 20:56:19 +08:00
yujun
d6f460e54a Update artist model activateion (#3106)
* update

* rename
2022-10-08 10:45:02 +08:00
吴高升
6a0be69064 Update README.md of neural search (#3391) 2022-09-30 21:50:38 +08:00
westfish
0eb379261a codestyle 2022-09-30 16:36:17 +08:00
sneaxiy
d6f1c61fb6 fix gpt N4C32 dp script bug (#3392) 2022-09-30 00:48:49 +08:00
Yam
985a9a41c0 complete t5 more output (#3370) 2022-09-29 20:04:16 +08:00
Haohongxiang
bc23b8b0c2 [Dygraph] Support sharding stage2/3+dp in GPT-3 model (#2471)
* add sharding+dp

* update

* code style check

Co-authored-by: gongenlei <gongel@qq.com>
2022-09-29 15:56:04 +08:00
Linjie Chen
2cfeadf114 Add ERNIE-LayoutX (#3183)
* Add ernie-layoutx

* simplify code

* simplify code

* support batch input

* add word_boxes support

* Update docs

* update

* Update README.md

* Udpate README.md

* Update README.md

* Update README.md
2022-09-29 13:05:29 +08:00
duanyanhui
3abb3589a8 [TIPC] Add scripts for npu and xpu, test=develop (#3377)
* add scripts for xpu and npu

* add npu/xpu args

* add script for xpu

* add npu/xpu args to predict.py

* fix codestyle ci bug

* add copyright

* fix copyright_checker
2022-09-29 12:07:23 +08:00
Elvis Stuart
be4b6c2a0e 【Hackathon + GradientCache】 (#1799)
* gradient_cache

* gradient_cache

* gradient_cache

* gradient_cache

* data

* train_for_gradient_cache

* add

* add

* add

* 修改

* 修改

* update

* update

* update

* update

* Update README_gradient_cache.md

* Update README_gradient_cache.md

* Update README_gradient_cache.md

* feat: modified the code

* fix: delete useless code

* feat: added requirements.txt

* feat: modify readme

* feat: modify some code

* feat: code style

* feat: add function

* feat: add licence

* feat: add comments

* Update README_gradient_cache.md

* feat: modify readme

* feat: modify readme

* fix: copyright

* fix: yapf

* feat: modify readme

* feat: modify readme

* feat: delete useless code

* feat: add new explain

Co-authored-by: 吴高升 <wugaosheng@mails.ccnu.edu.cn>
Co-authored-by: 吴高升 <w5688414@gmail.com>
2022-09-29 11:46:46 +08:00
骑马小猫
3b6b183503 [BugFix] fix supporting OrderedDict bug in paddle.jit module (#3364)
* convert keys to `__dict__`

* use fields to get keys

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-09-29 11:08:14 +08:00
liu zhengxi
131750a5bc Add codegen unittests (#3348)
* add codegen unittests

* fix codegen

* update
2022-09-29 10:32:36 +08:00
gongenlei
fe2543d981 Improve CodeGen (#3371) 2022-09-29 01:31:40 +08:00
Septilliony
18e2e1188b Update README_en.md (#3375)
edit typo

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-09-28 23:55:07 +08:00
westfish
759ec97e70 add warning 2022-09-28 21:06:37 +08:00
westfish
829f445169 fix dataloader memory overflow 2022-09-28 16:09:48 +08:00
liu zhengxi
521fd43191 MBART supports freeze multi-lingual model when dy2sta (#3367) 2022-09-27 21:05:56 +08:00
骑马小猫
abf217e9f3 add t5 encoder model (#3376) 2022-09-27 19:50:33 +08:00
zhengya01
252a9c0133 fix tipc log for benchmark and upate bigru_crf config (#3373)
* fix tipc log

* fix tipc log and upate bigru_crf config
2022-09-27 12:59:03 +08:00
gongenlei
adf6fcad61 Fix erniegen no model_config_file (#3321)
* fix

* rm save_pretrained
2022-09-26 20:20:15 +08:00
gongenlei
0e159ad0c5 Fix gpt example attention mask (#3240)
* add hf ds and upgrade example

* fix attention mask

* update

* update attention mask

* fix static attention mask
2022-09-26 15:02:58 +08:00
Roc
07e5c553e6 [MoE] Fix distributed wait api (#3365) 2022-09-26 13:07:03 +08:00
Zhong Hui
b4b1bdc3ed [BugFix] Fix amp usage for evaluation. (#3303)
* fix eval of amp usage.

* fix
2022-09-24 22:08:56 +08:00
吴高升
0711a60584 Fix the semantic search example mistakes (#3363)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-09-24 22:07:50 +08:00
Jiaqi Liu
fb69d1500f supports distribute (#3361) 2022-09-23 23:38:14 +08:00
吴高升
3d83e742fd Fix the README description of Pipelines & Neural Search (#3353)
* Fix the README description

* Update Pipelines README.md

* Update Docker README.md

* Add more details for ranking model
2022-09-23 19:22:21 +08:00
Liujie0926
24fb15e4ef [Benchamrk] Fix fuse_transformer option of TIPC (#3358) 2022-09-23 16:17:31 +08:00
liu zhengxi
90491a00a5 unimo unittests (#3349) 2022-09-23 15:14:18 +08:00
liu zhengxi
62f55d0e25 [FasterGeneration] MBart supports dy2sta (#3356) 2022-09-23 14:08:39 +08:00
Jiaqi Liu
85d7ac6afe Compression API supports ELECTRA (#3324)
* supports electra

* fix typo
2022-09-23 10:55:08 +08:00
骑马小猫
07994a19cf upgrade-modeling-output (#3305)
* upgrade-modeling-output

* fix codestyle
2022-09-22 19:29:28 +08:00
zhoujun
b525401826 support layoutxlm re dygraph to static (#3325)
* support layoutxlm re dygraph to static

* fix error
2022-09-22 17:07:03 +08:00
吴高升
ad6fe2403f Upgrade Neural Search README.md (#3350) 2022-09-22 15:20:54 +08:00
WangZhen
2f57f9b036 Fix TIPC log path (#3347) 2022-09-22 14:22:54 +08:00
吴高升
675bfa14a4 Update retrieval based classification README.md (#3322)
* Update retrieval based classification README.md

* Revert predict.py

* Update cpu predict script

* restore gpu config
2022-09-22 13:13:49 +08:00
骑马小猫
c64ed99efd [New Model]add t5-encoder-model (#3168)
* add t5-encoder-model

* update t5model

* update t5encoder & test modeling

* update t5

* update type hinting

* update cache type annotation
2022-09-21 20:50:44 +08:00
Noel
68d7946293 [few-shot] fix typo and failed links (#3339)
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-09-21 17:57:45 +08:00
Roc
8dc205c918 [MoE] Fix recompute & communication api (#3338)
* update moe recompute.
2022-09-21 17:33:17 +08:00
zhengya01
7708822b76 fix tipc log (#3337) 2022-09-21 15:56:48 +08:00
gongenlei
17ca23a15e update CodeGen doc (#3299)
* update doc

* update doc

* update docs

Co-authored-by: 骑马小猫 <1435130236@qq.com>
2022-09-21 14:31:30 +08:00
吴高升
a4065c9917 Remove unused function of Pipelines (#3330) 2022-09-21 14:14:24 +08:00
zhengya01
e9d24e5e4e update tipc log (#3333) 2022-09-21 13:12:27 +08:00
yujun
2080001221 Merge pull request #3302 from JunnYu/update_ernie_task_tipc
Update ERNIE Task TIPC script
2022-09-21 09:53:08 +08:00
liu zhengxi
aae81be26d Merge branch 'develop' into update_ernie_task_tipc 2022-09-21 09:50:03 +08:00
Thomas Young
31a8dc5c24 Replace OMP with std::thread (#3309)
* fix bug and codestyle

* save change

* change code style

* fix conflict

* change h file

* Update tokenizer.cc

Co-authored-by: zhoushunjie <zhoushunjie@baidu.com>
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-09-20 20:27:23 +08:00
wawltor
df9e6473ec Update __init__.py 2022-09-20 16:24:46 +08:00
Linjie Chen
d5587376de Update README_en.md (#3320)
* Update README_en.md

* Update README_en.md

* Update README_en.md

* Update README_en.md

* Update README_en.md

* Update README_en.md

* Update README_en.md
2022-09-20 16:12:02 +08:00
吴高升
929e019712 Add Docker compile Support for Pipelines (#3315)
* Add Docker compile Support

* change cuda to uppercase
2022-09-20 15:29:24 +08:00
吴高升
8a3a1aa8ae Add FAQ and missing json output files (#3298) 2022-09-20 13:02:18 +08:00
lugimzzz
77b65d3999 optimize_sparse_strategy (#3311) 2022-09-20 11:01:36 +08:00
yujun
611b7c543d update 2022-09-19 20:13:55 +08:00
yujun
0befe965af update ernie task tipc 2022-09-19 15:36:06 +08:00
lugimzzz
938edda04f optimize train.py (#3300) 2022-09-19 15:20:29 +08:00
Jiaqi Liu
f6e0068a45 Compression API Supports ERNIE-M and more Pretrained models (#3234)
* update compression doc

* update compression doc

* support more models and update compression api

* update inputspec info, avoid error
2022-09-19 11:26:41 +08:00
Linjie Chen
b8e12c5a33 fix bug of relation example is empty (#3295) 2022-09-19 10:33:43 +08:00
吴高升
e893a6304e Add Milvus2.1 Support and Update pipielines qa ui (#3283)
* Add Milvus Support and Update pipielines qa ui

* Remove unused comments
2022-09-19 01:02:39 +08:00
Jack Zhou
2baa92a84a fix ft build script (#3293) 2022-09-18 14:30:24 +08:00
Jack Zhou
a4749e1f50 Add ft compile doc and scripts (#3292)
* Fix the mac compile

* Add cpp, python lib building scripts

* Remove cache in cpp lib

* Add compile docs
2022-09-18 00:24:14 +08:00
WangZhen
9a25764763 [TIPC]Support @to_static train for base-transformer (#3277)
* [TIPC]Support @to_static train for base-transformer

* Fix to_static args
2022-09-17 09:04:29 +08:00
yujun
1e919ba45d fix import error (#2853) 2022-09-17 00:57:18 +08:00
Jack Zhou
338fe2afec Add use_faster flag for uie of taskflow. (#3194)
* Add use_faster flag for taskflow

* Add empty line

* Add doc of uie

* remove faster_tokenizer tmp

* merge
2022-09-17 00:55:08 +08:00
lugimzzz
eb05f409b1 add_dataset_link (#3286) 2022-09-17 00:54:10 +08:00
Zhong Hui
7fdfbf2b2b update link typo (#3236) 2022-09-16 22:32:08 +08:00
yujun
7ce1b5cf35 update docs wechat code (#3284) 2022-09-16 22:31:34 +08:00
Jack Zhou
20ab09baa0 Update ft version to 0.2.0 (#3285) 2022-09-16 22:30:39 +08:00
Jack Zhou
0bdb7b5141 remove glog/logging.h (#3280) 2022-09-16 21:31:43 +08:00
Jack Zhou
46f395ae1d Fix ft substr bug (#3279)
* optimize cmakelist

* Add substr pos check
2022-09-16 21:31:10 +08:00
吴高升
0f464e8303 Upgrade FAQ finance to Milvus 2.1 (#3267)
* Upgrade FAQ finance to Milvus 2.1

* Update text format for faq

* Update feature_extract.sh
2022-09-16 13:31:56 +08:00
Zhong Hui
fb4eec74d0 [Trainer] Support recompute for trainer. (#3261)
* support recompute for trainer.
2022-09-16 12:07:22 +08:00
liu zhengxi
8ca5cd8256 Add unit tests for UnifiedTransformer (#3177) 2022-09-16 10:18:14 +08:00
Zhong Hui
b1ad85171e [DOC] Update highlights of README.md (#3278)
* Update README.md

* Update README.md
2022-09-15 17:04:07 +08:00
Zhong Hui
37a68609f0 [DOC] Add ernie-1.0-base-zh-cw benchmark results. (#3248) 2022-09-15 15:05:40 +08:00
吴高升
8fc38d6201 Update README.md and Rename dir to FAQ directory (#3272) 2022-09-15 12:13:19 +08:00
Linjie Chen
87613d4c25 Update debug mode for relation prompt (#3263)
* update debug mode for relation prompt

* update

* update
2022-09-14 20:11:48 +08:00
liu zhengxi
135e9fa753 update t5 tests (#3266) 2022-09-14 16:36:36 +08:00
骑马小猫
28f0b9195b [BugFix]update vocab_size in init_config (#3260)
* update vocab_size in init_config

* make update_init_config more common

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-09-14 15:41:51 +08:00
骑马小猫
e1f700a0a2 [IssueTemplate] Add issue template (#3251)
* update issue-template

* remove old issue template

* add id field to template

* update github issue template
2022-09-14 12:44:13 +08:00
Zhong Hui
815ddfb72b [CodeStyle] Add copyright for python file. (#3259)
* Add copyright for python files.
2022-09-14 10:57:52 +08:00
lugimzzz
8f5f965fa8 analysis_module_bug_fix (#3246) 2022-09-14 10:49:40 +08:00
liu zhengxi
64c695aec1 Add unit tests for T5 (#3115) 2022-09-14 10:33:19 +08:00
骑马小猫
2173cf358b [ModelingOutput] add tinybert/Electra/XLNet/ALBERT/ERNIE-M more output & loss (#3148)
* complete tinybert more output & loss

* complete tinybert/erniem output

* complete xlnet unittest

* complete the electra unittest

* complete albert more modeling output

* complete albert more modeling output

* complete ernie-doc model more output

* revert ernie-doc modeling

* update more output

* update model testing

* convert paddle.is_tensor -> isinstance

* update tinybert & electra models
2022-09-14 10:11:10 +08:00
Jiaqi Liu
363269affb update output dirname of compression api (#3252) 2022-09-13 15:46:22 +08:00
Linjie Chen
4ce8fd9a9b fix bug of label dimension smaller than 1 (#3238) 2022-09-09 16:45:07 +08:00
吴高升
3e66b0cd02 Update README.md & Add more data into csv& change UI (#3237) 2022-09-09 16:32:33 +08:00
Zhong Hui
94dd90ae88 [Pre-Training] ERNIE-CW pre-training tasks docs. (#3111)
* add ernie-large config

* update

* update clue finetune.

* unused delete.

* update

* support no nsp for enrie.

* fix evaluation

* fix amp o2 save_dtype bugs.

* extand ernie.

* fix ernie pretrain with ## vocab.

* extend vocab

* support custom tokenizer.

* add some comments.

* fix bugs.

* add comments.

* fix bug.

* fix run_pretrain_static logging.

* fix all gather.

* fix a100

* fix

* fix bugs

* fix save

* tmp commit for pre-process.

* Update README.md

* Update README.md

* add amp o1 support

* ernie cw readme.

* fix

* throw error when dataset is invalid.

* update document.

* refine readme.

* fix

* refactor

* refator2

* Add pre-training introduction.

* update  image width.

* refine doc

* fit table width.

* fix c++ style

* fix table

* refine docs

* refine model_zoo/ernie-1.0/README.md

* readfine readme.

* fix link

* fix bug

* fix documents.

* add weight.

* fix config
2022-09-09 15:33:26 +08:00
Linjie Chen
6b59ba2ef2 fix data distill for UIE (#3231)
* fix data distill

* update

* add evaluate_teacher
2022-09-09 15:23:42 +08:00
lugimzzz
8b827f410e Optimize text classification deploy (#3217)
* optimize_deploy

* optimize_deploy

* update_readme
2022-09-09 14:59:00 +08:00
骑马小猫
f4e1b67d62 [Unittest]add roformerv2 unittest (#2994)
* add roformerv2 unittest

* update roformer-v2 testing

* update config to accelerate testing

* remove comment

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-09-09 14:01:26 +08:00
骑马小猫
2f84f9791e Merge pull request #3220 from wj-Mcat/remove-unused-code
[Improvement] remove model_config_file and resource_files_names
2022-09-08 22:37:28 +08:00
wj-Mcat
93d9c67ec4 Merge branch 'remove-unused-code' of github.com:wj-Mcat/PaddleNLP into remove-unused-code 2022-09-08 19:44:30 +08:00
wj-Mcat
51fa58f11c update three models 2022-09-08 19:43:59 +08:00
骑马小猫
b50fa0dd22 Merge branch 'develop' into remove-unused-code 2022-09-08 19:26:00 +08:00
骑马小猫
f32a6cab0d Merge pull request #3114 from wj-Mcat/fix-multi-inhert
fix multi-layer-inherit of PretrainedTokenizer
2022-09-08 17:58:21 +08:00
骑马小猫
0ea3cc4b5e Merge branch 'develop' into fix-multi-inhert 2022-09-08 17:42:58 +08:00
gongenlei
332da6ba34 Update codegen params and doc (#3228)
* update decoding

* update doc
2022-09-08 17:07:46 +08:00
gongenlei
f0c64b8666 not default to gpu (#3218) 2022-09-08 15:30:19 +08:00
骑马小猫
848268d284 Merge pull request #3130 from wj-Mcat/add-modeling-output
[ModelingOutput] update modeling output and unittest
2022-09-08 14:15:09 +08:00
Guo Sheng
fbd155d602 Merge branch 'develop' into add-modeling-output 2022-09-08 13:50:38 +08:00
paopjian
635eb8cabd 源码安装htbuilder,避免windows安装失败 (#3221)
Co-authored-by: 吴高升 <w5688414@gmail.com>
2022-09-08 13:31:00 +08:00
骑马小猫
3dfadff339 Merge branch 'develop' into remove-unused-code 2022-09-08 12:20:06 +08:00
Linjie Chen
f05794c4b0 Update bos url for UIE (#3222)
* Update bos url

* Update README.md

* Update README.md
2022-09-08 11:32:28 +08:00
Jack Zhou
23979e704b Remove boost library. (#3215)
* Remove boost library.

* add conditional include for gtest

* Add test, demo exclude
2022-09-08 09:15:31 +08:00
chenxiaozeng
6fa2df53d2 Update README_cn.md (#3219) 2022-09-08 00:05:22 +08:00
骑马小猫
88435c2701 Merge branch 'develop' into remove-unused-code 2022-09-07 21:06:49 +08:00
wj-Mcat
a837aeead6 remove model_config_file and resource_files_names 2022-09-07 21:00:47 +08:00
wj-Mcat
9570637275 fix conflicts 2022-09-07 19:44:36 +08:00
骑马小猫
63ad917675 Merge branch 'develop' into fix-multi-inhert 2022-09-07 19:20:50 +08:00
骑马小猫
447c0146f5 [ModelingOutput]add more output for skep model (#3146)
* update return_dict/label in skep model

* complete skep add-more-output

* refactor simple code

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
Co-authored-by: Guo Sheng <guosheng@baidu.com>
Co-authored-by: liu zhengxi <380185688@qq.com>
2022-09-07 17:59:09 +08:00
骑马小猫
cbc07032f9 Merge pull request #3210 from JunnYu/add_stable_diffusion_licence_and_reset_default_args
Add StableDiffusion LICENSE
2022-09-07 16:03:03 +08:00
Guo Sheng
9f858e6bf5 Merge branch 'develop' into add_stable_diffusion_licence_and_reset_default_args 2022-09-07 15:47:22 +08:00
wawltor
824982dade Update README_cn.md 2022-09-07 15:18:12 +08:00
wawltor
ead43829e3 Update README_cn.md 2022-09-07 15:05:48 +08:00
Guo Sheng
98f6df61ae Merge branch 'develop' into add_stable_diffusion_licence_and_reset_default_args 2022-09-07 15:03:07 +08:00
wawltor
9ab5a91df6 Update README_cn.md 2022-09-07 14:49:13 +08:00
kztao
12c605af45 Fix windows dtype bug of neural search (#3182)
* Fix windows dtype bug of neural search

* Fix windows dtype bug of neural search

Co-authored-by: 吴高升 <w5688414@gmail.com>
2022-09-07 14:44:14 +08:00
Guo Sheng
bd8fa1a972 Merge branch 'develop' into add_stable_diffusion_licence_and_reset_default_args 2022-09-07 14:42:11 +08:00
wawltor
9b51a64069 Update README_cn.md 2022-09-07 14:30:04 +08:00
骑马小猫
60a475e157 [ModelingOutput]update roformer unittest (#3159)
* add roformer unittest

* add roformer unittest

* update test_modeling

* use relative import

* reduce model config to accelerate testing

* remove input_embedding from pretrained model

* revert slow tag

* update local branch

* update get_vocab method

* update get_vocab method

* update test_chinese method

* change absolute import

* update unittest

* update chinese test case

* add roformer more output testing

Co-authored-by: Guo Sheng <guosheng@baidu.com>
Co-authored-by: liu zhengxi <380185688@qq.com>
2022-09-07 13:32:51 +08:00
wawltor
a6ab9c896b Update README_cn.md 2022-09-07 12:15:53 +08:00
wuhuachaocoding
0ed8de72bc [Recompute] Update recompute for hybrid parallel interface. (#3211)
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-09-07 11:22:24 +08:00
bruce0210
c6abe76ab9 Update README.md (#3209)
Improve and fix the text content of case 1.

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-09-07 07:03:28 +08:00
Guo Sheng
c7287ce9dc Merge branch 'develop' into add_stable_diffusion_licence_and_reset_default_args 2022-09-06 21:49:40 +08:00
chenxiaozeng
4f10afa914 Update README_cn.md (#3212)
add v2.4 features description.
2022-09-06 21:31:53 +08:00
chenxiaozeng
b7437055f0 Add finance course (#3207)
* add finance course group code

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-09-06 21:07:51 +08:00
limingshu
19e03c4e71 Move token_num fetch out of train cycle (#3089) 2022-09-06 20:46:14 +08:00
吴高升
b88fc4ea5b Update setup.py and README Examples (#3208) 2022-09-06 20:02:02 +08:00
yujun
58e5e7e4bb add license 2022-09-06 19:28:05 +08:00
骑马小猫
9d9b00bb75 [Bug Fix]update tokenizer utils (#3204)
* update tokenizer utils

* update example

* remove debug code

* test=document_fix

* test=document_fix

* test=document_fix
2022-09-06 19:13:45 +08:00
gongenlei
ceded4b4dd fix params (#3205) 2022-09-06 15:08:21 +08:00
骑马小猫
da23449878 Merge branch 'develop' into add-modeling-output 2022-09-06 14:17:11 +08:00
Roc
b72aa7e5bf [GPT-3/MOE] Adapt recompute for latest paddle (#3191) 2022-09-06 13:56:34 +08:00
吴高升
9729a475ee Change Pipeline's name & Fix dense qa config & Add FAQ (#3202) 2022-09-05 20:45:21 +08:00
Noel
2c82f0327c [trainer] Fix bug when resume_from_checkpoint (#3201) 2022-09-05 19:01:39 +08:00
yujun
caaa102f64 add disco diffusion stable diffusion into taskflow (#3198)
* add disco diffusion stable diffusion into taskflow

* update num_return_images in taskflow readme

* update text2image taskflow readme

* rename text2image_generation text_to_image

* rename
2022-09-05 17:44:15 +08:00
gongenlei
aafd5a9178 Add text summary application (#2971)
* add train script

* add text summarization taskflow

* add faster_generation and device choice

* add doc and doploy for text_summarization

* add BLEU4

* update readme

* update train.py

* fix bug in summarization taskflow

* update taskflow and doc

* fix inference and serving

* fix serving

* update default model

* update taskflow doc

* update doc

* update doc

* update taskflow example

Co-authored-by: westfish <westfish@126.com>
2022-09-05 16:48:42 +08:00
吴高升
319c56e6d4 Add CrossEncoder and Integrate it into pipelines (#3196)
* Add CrossEncoder and Integrate it into pipelines

* Add CrossEncoder README.md
2022-09-05 16:37:02 +08:00
gongenlei
ea28142590 Update codegen doc (#3193)
* update doc

* update cod

* update perf
2022-09-05 16:28:25 +08:00
吴高升
54df619236 Add Retrieval based multi class classification (#3180)
* Add Retrieval based multi class classification

* Update README.md and dtype

* Update README.md
2022-09-05 15:54:45 +08:00
Linjie Chen
6f953a928f Add UIE-M (#3192)
* Add UIE-M

* Update README.md

* Update taskflow.md

* Update README.md

* Update README.md
2022-09-05 15:34:50 +08:00
lugimzzz
ab2bd216c1 bug_fix (#3184) 2022-09-05 15:16:40 +08:00
吴高升
47a2ea50d4 Integrate Neural Search models into Pipelines (#3172)
* Integrate Neural Search models into Pipelines

* Adjust the format

* Update Neural Search Recall and Upgrade docx for Pipelines
2022-09-05 13:47:15 +08:00
吴高升
920e1e8fe0 Fix dtype bug of text similarity (#3188) 2022-09-05 12:42:44 +08:00
Linjie Chen
5401f01af8 Add data distillation for UIE (#3136)
* Add data distill for UIE

* Update README.md and remove unsed code

* Update README.md and doccano process

* Update data distillation example

* fix entity extraction

* update

* update

* add data_distill.py

* Update README.md
2022-09-05 10:58:06 +08:00
吴高升
a51c757af1 Update faq.md for faiss run error for pipelines (#3186)
* Add Benchmark README.md& Optimize Pipelines README.md

* Update faq.md for faiss run error

* Add API models README.md and Update FAQ.md
2022-09-05 10:57:03 +08:00
骑马小猫
e49344f5ec [BugFix] Add max model input sizes (#3127)
* add max_model_input_sizes

* update roberta tokenizer

* update wrong word

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-09-05 00:05:39 +08:00
yujun
8fde089f40 Add disco diffusion ernievil vitb16 (#3118)
* update ernievil2

* update ernievil2 auto model

* update

* update model and tokenizer

* update

* typo

* update copyright and add model max length

* update model name and method name

* fix

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-09-02 21:42:35 +08:00
yujun
d789b4f154 [NEW MODEL CLIP] Add disco diffusion clip vitb32 (#3072)
* add clip model

* update params name

* add docs

* typo

* update clip and add clip+dd

* add vision_heads and vision_mlp_ratio

* typo and update docs

* update default args and add resnet 50 101 and use old pillow

* add resnet50 101 and update tokenizer

* update seed

* add __init__.py

* add openai/clip-vit-large-patch14 and update imagegeneration demo

* update attention mask and update copyright

* add stable diffusion and docs & add CLIPTextModel and CLIPVisionModel

* del clip.vision_model

* update PNDMScheduler and add set_scheduler

* update copyright order
2022-09-02 21:25:40 +08:00
gongenlei
53bdc2d456 Add FasterCodeGen/FasterGPTJ (#3017)
* add FasterCodeGen/FasterGPTJ

* remove useless

* fix output and hypeparams

* fix review comment

* fix

* rm split

* add perf and sample

* fix: memory allocator

* add memory perf

* update convert_params

* add perf doc

* fix

* update perf

* add finetune and doc

* update hyper params

* update docs

* add license

* use apply_logits_mask_kernelLauncher

* ker_curand_setup_bsz_one for bsz=1

* rm const for constant

* rm ret

* update license

* fix kernel

* use apply_logits_mask_kernelLauncher

* add blank_lines

* match new paddle

* update seed and add TODO
2022-09-02 13:00:02 +08:00
lugimzzz
7614879da2 update text classification readme (#3161)
* update_readme
2022-09-02 10:01:51 +08:00
Jack Zhou
b82cbe8045 Add README for faster tokenizer (#3179)
* Add main features of faster tokenizer on readme

* Add quick start part

* Add FAQ

* Remove pipline intro tmp
2022-09-01 22:16:58 +08:00
Jack Zhou
d759e87383 Add faster tokenizer mac python package (#3171)
* update cmake

* adjust platform case

* Fix cmake

* Fix readme
2022-09-01 14:23:51 +08:00
Jack Zhou
d56c71470e Backup hf dataset (#3057)
* Add imdb hf datasets

* Adjust thucnews load
2022-08-31 19:28:20 +08:00
wj-Mcat
2ed52ed88b Merge branch 'add-modeling-output' of github.com:wj-Mcat/PaddleNLP into add-modeling-output 2022-08-31 08:02:21 +00:00
wj-Mcat
13a13aff17 remove unrelated requirements 2022-08-31 08:02:01 +00:00
Jack Zhou
e08964bb58 Add handle chinese char wordpiece (#3164)
* Add handle_chinese_char for wordpiece tokenizer

* Remove unicode/char.h

* add max_input_chars_per_word
2022-08-31 11:22:11 +08:00
wj-Mcat
3a90faa916 update refactor code 2022-08-30 11:52:02 +00:00
Roc
a087e0c21f [MoE] Fix changes of _C_ops usage for paddle develop version. (#3163) 2022-08-30 17:31:53 +08:00
吴高升
5bfa11c5e1 Update text similarity for taskflow.md (#3162) 2022-08-30 16:06:10 +08:00
吴高升
a8886f898c Add Benchmark README.md& Optimize Pipelines README.md (#3160) 2022-08-30 15:08:07 +08:00
Jack Zhou
09d8ad519b Remove faster_tokenizer include src directory (#3156)
* remove include src directory

* remove words_idx print

* Add FasterTokenizer.cmake

* remove useless cmake comments

* Fix readme

* Add faster_tokenizer
2022-08-30 14:04:59 +08:00
liu zhengxi
2083256f16 Transformer add activate option (#3158) 2022-08-30 12:20:03 +08:00
Linjie Chen
cece39407d fix the bug that device_id invalid in fp16 mode (#2959)
* fix device_id invalid for fp16 mode

* remove unused code

* add device_id for uie_predictor
2022-08-30 10:08:24 +08:00
Zeyu Chen
536f3c34c1 Update README 2022-08-30 09:44:54 +08:00
lugimzzz
724da5570c optimize_text_classification_readme (#3132)
* optimize_readme

* optimize_readme

* optimize_readme

* optimize_readme

* optimize_readme
2022-08-29 21:50:57 +08:00
liu zhengxi
e8f8eca101 Add GPT ut (#3133) 2022-08-29 10:24:19 +08:00
骑马小猫
c19efe5f34 Merge branch 'develop' into fix-multi-inhert 2022-08-29 09:54:40 +08:00
吴高升
1abe10bb74 Add FAQ tutorials for pipelines (#3151) 2022-08-26 18:45:32 +08:00
Jack Zhou
66b33fd330 Fix mac x64 (#3137)
* Fix mac x64

* update WITH_TESTING default value

* Fix linux aarch64 libdl not found

* Fix typo

* remove plat-name

* Add platname

* Add CPP demo readme.md
2022-08-26 16:54:00 +08:00
吴高升
f89d26ec5f Add FAQ applications for pipelines (#3102)
* Add FAQ applications for pipelines

* Optimize FAQ function
2022-08-26 11:29:29 +08:00
yujun
e549b57367 add t5 zeroshot demo and add new weights (#3116)
Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-25 23:23:28 +08:00
骑马小猫
58e785a7e7 Merge branch 'develop' into fix-multi-inhert 2022-08-25 20:22:32 +08:00
骑马小猫
0861160e57 Merge branch 'develop' into add-modeling-output 2022-08-25 20:16:30 +08:00
wj-Mcat
26daca4cf1 update label/loss 2022-08-25 12:09:05 +00:00
Noel
2887ae8071 [Trainer] unify the way of printing logs as logger (#3144) 2022-08-25 20:04:36 +08:00
吴高升
f5636731f4 Add Docker images& Docker compose files for pipelines (#3135)
* Add Docker images& Docker compose files for pipelines

* Update README.md
2022-08-25 18:09:01 +08:00
yujun
a24c852c63 update bert tipc amp level O2 (#3080) 2022-08-25 17:36:35 +08:00
yujun
674ac4eba4 add ernie-tiny benchmark (#3100) 2022-08-25 17:18:53 +08:00
lugimzzz
debad267f1 Change Prune Module by Compression API in Text Classification Application (#3087)
* change_prune_module_by_compression_API
2022-08-25 16:07:48 +08:00
Zhong Hui
3b89d63f35 [ERNIE] Quick fix for model no_sync. (#3138) 2022-08-25 14:12:38 +08:00
wj-Mcat
200af6de8d complete ernie/roberta/roformer unittest 2022-08-25 02:45:09 +00:00
吴高升
08b51e7ab6 Add Docx Image display support for pipelines and Update Docker config (#3097)
* Add Image display support for pipelines and Update Docker config

* Remove unused comments

* restore pipelines_version

* Add more comments for docx.py

* Add more comments for docx
2022-08-25 10:42:15 +08:00
Jack Zhou
b40a3c05d8 Add mac arm64 compile (#3134)
* add mac arm64 compile

* Add no-narrowing warning
2022-08-24 21:34:15 +08:00
wj-Mcat
d4b41227bb complete ernie label loss 2022-08-24 13:07:19 +00:00
Jack Zhou
893987dd7f Add faster tokenizer dir (#3125)
* Add faster_tokenizer dir

* add todo comments
2022-08-24 19:43:32 +08:00
wj-Mcat
0f133c04ac update roformer modeling testing 2022-08-24 08:37:49 +00:00
liu zhengxi
98eab225f3 fix onnx compile (#3131) 2022-08-24 16:13:54 +08:00
wj-Mcat
522becff95 update roberta unittest 2022-08-24 07:25:47 +00:00
littletomatodonkey
d3ace6c5e3 fix vi-layoutxlm model name (#3129) 2022-08-24 14:59:13 +08:00
wj-Mcat
d6f58c836f update ernie modeling test 2022-08-24 06:57:59 +00:00
wj-Mcat
b1629c0cdf update requirements.txt 2022-08-24 06:35:49 +00:00
wj-Mcat
75c29031c2 merge master branch 2022-08-24 06:32:18 +00:00
wj-Mcat
7b50b5450a update bert model unittest 2022-08-24 06:29:58 +00:00
yujun
949c848522 Refactor RoFormer Model (#3049)
* update roformer

* update

* use CausalLMOutputWithCrossAttentions

* typo

* update docs

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-23 23:25:55 +08:00
Jiaqi Liu
a032b304af update compression doc (#3103) 2022-08-23 19:53:10 +08:00
Jack Zhou
2c294008b9 Fix faster tokenizer multithreads bug (#3119)
* Add imdb hf datasets

* Adjust thucnews load

* upgrade faster_tokenizer

* Revert "Adjust thucnews load"

This reverts commit 677e33a710.

* Revert "Add imdb hf datasets"

This reverts commit 72402f1d0e.

* Add CharToBytesOffsetConverter

* Change return value of CharToBytesOffsetConverter

* Fix some omp directive

* fix some multithreads bug
2022-08-23 19:12:47 +08:00
Jiaqi Liu
084416868f fix semantic search modeling (#3094) 2022-08-23 18:03:15 +08:00
wj-Mcat
52a18de38f fix multi-layer-inherit 2022-08-23 03:01:51 +00:00
Linjie Chen
4ec0b62f77 update parameters for wordtag (#3108) 2022-08-23 10:16:10 +08:00
Noel
70bc0b06c1 [few-shot] Update README (#3104)
* [few-shot] add input_spec in train.py

* [few-shot] add early-stopping

* [few-shot] update readme

* [prompt] fix optimization problem in soft verbalizer
2022-08-22 21:00:51 +08:00
Linjie Chen
7852629d28 disable ir optim for nptag (#3107) 2022-08-22 20:07:17 +08:00
liu zhengxi
08636b3a1e Add unit tests for generation models (#3018) 2022-08-22 18:52:54 +08:00
lugimzzz
f1634e5b16 add analysis module in text classification application (#3011)
* add_analysis_module

* add_analysis_module

* add_analysis_module

* change_argument_format

* add_analysis_module

* add_evaluation_result_for_analysis_module
2022-08-22 18:16:15 +08:00
骑马小猫
813e5c901b [UnitTest] Add ernie gram unittest (#3059)
* add ernie gram unittest

* update ernie-gram unittest

* update local branch

* update ernie-gram

* update model_name

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-22 16:53:06 +08:00
骑马小猫
22bd3aaa53 [Unittest]Add roformer unittest (#2991)
* add roformer unittest

* add roformer unittest

* update test_modeling

* use relative import

* reduce model config to accelerate testing

* remove input_embedding from pretrained model

* revert slow tag

* update local branch

* update get_vocab method

* update get_vocab method

* update test_chinese method

* change absolute import

* update unittest

* update chinese test case

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-22 16:12:34 +08:00
Zhong Hui
bfc8700136 [GPT] Update default lr of args.py (#3101) 2022-08-22 14:13:33 +08:00
Roc
2be8555763 [Benchmark] fix random rank in pdc (#3052) 2022-08-22 12:51:47 +08:00
Zhong Hui
ec893dd053 [Pre-Training] Enhance ERNIE pre-training with additional chinese char (#2667) 2022-08-22 12:07:04 +08:00
骑马小猫
203b6a80d4 add skep unittest & fix skep modeling (#2941)
* add skep unittest & fix skep modeling

* remove dumplicated viterbidecoder importing

* disable ViterbiDecoder from paddle.text temporary

* enable bpe tokenizzer in testing

* add slow to from_pretrained

* complete skep unittest

* update skep modeling & fixtures

* revert relative import

* reduce model config

* remove parameterized pacakge

* update skep unittest

* add <unk> to init function

* revert test_internal_consistency func

* add get_vocab method to skep tokenizer

* add Dict typing hint

* change importing style

* remove unused bpe file

* update the training example

* update get_vocab

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-22 10:32:54 +08:00
tianxin
a1e6a4644c update Pipelines README (#3053)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-08-21 10:24:17 +08:00
yujun
07cb2cdc94 [Update Ernie] if type_vocab_size == 0 we do not use token type id (#3075)
* add use_token_type_id option

* if type_vocab_size > 0 use token type id

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-20 11:41:48 +08:00
吴高升
a2de0bf9ce Update search tutorials for pipelines and README (#3092)
* Update search tutorials for pipelines and README

* Restore the missing bash scripts
2022-08-19 20:03:07 +08:00
吴高升
4bbf1b08ff Add text semantic matching for taskflow (#3003)
* Add text semantic matching for taskflow

* Incorporate text semantic search into text similarity

* Add rocketqa base

* Update taskflow docs

* Add rocketqa based models for taskflow

* Text similarity support paddle inference

* remove unused comments
2022-08-19 18:18:04 +08:00
yingyibiao
ff437f6c19 [Unittest]Add unittest for Electra and XLNet model (#3031)
* add unittest for electra tokenizer

* add xlnet

* add unittest for electra modeling

* add unittest for electra modeling

* update unittest for xlnet tokenizer

* update unittest for xlnet modeling

* fix

* fix
2022-08-19 17:10:17 +08:00
骑马小猫
e1f575bb0e update opt sample & decoding (#3064)
* update opt sample & decoding

* fix type linting

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-19 13:30:11 +08:00
骑马小猫
61b76c5f68 [Unittest] add ernie-m unittest (#2964)
* add ernie-m unittest

* update ernie_m-tokenizer

* --amend

* update erniem

* update ernie-m tokenizer

* add slow decorator

* update ernie-m tokenizer & reduce ernie-m model testing size

* update test case in ernie-m

* remove __call__ & change do_lower_case to false

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-18 21:49:51 +08:00
yingyibiao
869dd96117 [Unittest] Add unittest for RoBERTa, ALBERT and ERNIE (#2972)
* add roberta tokenizer unittest

* add roberta tokenizer unittest

* add roberta modeling unittest

* add unittest for albert modeling

* add albert unittest

* add ernie unittest

* upgrade unittest for albert tokenizer

* upgrade unittest for ernie tokenizer

* fix unittest for ernie tokenizer
2022-08-18 19:53:01 +08:00
Noel
451ccacec8 [prompt] fix hash problem while exporting model (#3062) 2022-08-18 17:36:28 +08:00
liu zhengxi
5c4b1f937c fix custom op d2s (#3081) 2022-08-18 15:46:50 +08:00
吴高升
8b692d0b60 Add ernie 3.0 based rocketqa into pipelines (#3078)
* Add ernie 3.0 based rocketqa into pipelines

* Add create index bash

* remove unused codes
2022-08-18 12:11:04 +08:00
Zhong Hui
a549c894fc [ERNIE] Fix shape for static graph mode (#3068)
* fix shape
2022-08-17 17:24:54 +08:00
Jiaqi Liu
493dc101eb update auto model function, and update compression script for token cls and qa tasks. (#3070) 2022-08-17 15:44:24 +08:00
Roc
e05adbf229 [MoE] Fix inner final_state_adamw api usage. 2022-08-17 14:13:57 +08:00
liu zhengxi
b10aa7a84b fix bart tokenizer (#3058) 2022-08-17 09:51:40 +08:00
Jiaqi Liu
9954750b8c add compress api doc (#3020) 2022-08-16 16:44:42 +08:00
Noel
a15da5fcf6 [prompt] add prompt and text classification examples (#2894)
* [prompt] add prompt (manual & soft)

* [few-shot] add multi-class example

* [ernie] add input_embeds to ernie, fix special token mask

* [few-shot] add multi-label and hierachical examples

* [few-shot] add deployment

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-08-16 12:06:56 +08:00
chenxiaozeng
84a6f28899 update group code (#3055) 2022-08-16 10:30:46 +08:00
Yu Wu
10225001b2 Add label studio to doccano file format conversion function (#2694)
* add label studio to doccano file format conversion function

* add label studio to doccano file format conversion function

* add description in readme
2022-08-16 10:21:56 +08:00
dongfangshenzhu
56a8957945 run_qa.py add xpu chioce of device,*test=kunlun (#3046)
* run_qa.py add xpu chioce of device,*test=kunlun

* run_qa.py add xpu chioce of device,*test=kunlun
2022-08-16 08:05:12 +08:00
吴高升
42ec8e31b4 Upgrade run_system.py to milvus 2.1 for neural search (#3047)
* Upgrade run_system.py to milvus 2.1 for neural search

* recover server port
2022-08-15 17:10:14 +08:00
yujun
bf0d3ab433 update text2image taskflow (#3040)
Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-15 14:59:16 +08:00
tianxin
a85059fed3 Update Pipelines README.md (#3043) 2022-08-15 14:18:20 +08:00
吴高升
f61e7cac75 Add ERNIE 3.0 based rocketqa DualEncoder models (#3033)
* Add rocketqa DualEncoder models

* Add DualEncoder docs test=document_fix
2022-08-15 11:40:51 +08:00
吴高升
baa47b644d Add ERNIE 3.0 based RocketQA Ranker models (#3019)
* Add ERNIE 3.0 based RocketQA Ranker models

* Update Docs Introduction
2022-08-12 18:56:30 +08:00
Guo Sheng
8980d64f5f Add label and loss support for BERT/RoBERTa/ERNIE (#3013)
* Add label and loss support for BERT/RoBERTa.

* Add label and loss support for ERNIE.

* Update api docs.
2022-08-12 17:13:49 +08:00
Jack Zhou
115d69d4c2 Fix faster_tokenizer arm64 compile (#3016) 2022-08-11 20:34:30 +08:00
骑马小猫
6952b91cff [Unittest]add tinybert unittest (#2992)
* update tinybert unittest

* remove dataclass-json & fix get_input_embedding

* update tinybert

* add max_model_input_size feature

* fix relative importing

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-11 19:40:57 +08:00
Jiaqi Liu
4c54f6d3e2 Update compression API (#2777) 2022-08-10 20:49:02 +08:00
Guo Sheng
3f0d6ce515 Make BERT support past_key_values. (#2801)
* Make BERT support past_key_value_caches.

* Fix BERT past_key_values_length setting.

* Add use_cache argument in BERT.

* Update docs of output_hidden_states in BERT.

* Add past_key_values and use_cache for ERNIE.

* Add past_key_values and use_cache in RoBerta.

* Support to get cache from None when use_cache is True.
Add unittest for BERT cache.

* Add signature check for test_hidden_states_output.

* Make cache be tuple if getting from None when use_cache is True.
2022-08-10 19:11:07 +08:00
吴高升
377ecb22c0 Move pipelines to the root dir (#3012)
* Move pipelines to the root dir

* Add missing files
2022-08-10 18:54:08 +08:00
yujun
6b3f40ced9 Add Text2Image into Taskflow (#2988)
* add text2image taskflow

* update readme

* update readme

* update text2image taskflow

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-10 16:35:55 +08:00
Zhong Hui
7ce81e1b6a [Recompute] Support ernie for dygraph recompute. (#2849) 2022-08-10 15:08:19 +08:00
吴高升
2a4a2fb69f Add Docker Support for pipelines (#2997) 2022-08-10 12:50:52 +08:00
littletomatodonkey
54eda93fdd add support for wo visual backbone (#2935)
* add support for wo visual backbone

* add re hidden states

* fix hidden save

Co-authored-by: yingyibiao <yyb0576@163.com>
Co-authored-by: Jiaqi Liu <709153940@qq.com>
2022-08-10 11:06:12 +08:00
Linjie Chen
8dc6c98c32 fix tokenizer encode bug for layoutxlm (#3006) 2022-08-10 10:26:04 +08:00
gongenlei
c097614233 support multi gpus (#3004) 2022-08-10 07:16:06 +08:00
吴高升
bb1729b267 Fix faiss index batch_size bug on python3.7 and update es config for … (#2965)
* Fix faiss index batch_size bug on python3.7 and update es config for pipelines

* Fix the nltk download bug and Add FAQ for mac support

* Remove update_batch_size for fais
2022-08-09 21:54:43 +08:00
吴高升
085ac53cad Add and upgrade to Milvus2.0 support for neural search (#2945)
* Add Milvus2.0 support for neural search

* Add milvus search file and remove unused blanks and code

* Add milvus_util.py
2022-08-09 18:33:00 +08:00
yujun
145333e7b4 Add EasyNLP Text2Image model (#2968)
* add artist

* update tokenizer

* support faster generation

* update

* update

* update config
2022-08-09 14:46:51 +08:00
骑马小猫
70e6a31d13 [NEW MODEL]add OPT model (#2659)
* add opt model

* update opt modeling

* complete all of test

* remove remote file link from opt configuration

* enable auto model with opt

* remove pretraining and criterion

* remove OPTLMHeadModel

* remove `remove_final_layer_norm`

* add example for opt text generation

* improve auto model & tokenizer

* keep the same code style

* revert changes fixed by #2764

* remove unused character

* use transformer-decoder-layer in opt

* align demo with huggingface website

* add opt op operations

* update faster entry

* add opt convert_param supporting

* add Makefile to manualy build faster transformer

* fix fp16 usage

* add performance & sample

* update opt modeling docstring

* update opt by comments

* remove Makefile && recover CMakeLists.txt

* update metric of opt

* update opt perf image

* update opt example

* remove opt & gpt image file to reduce size of repo

* remove bart file

* remove bart file to reduce the size of repo

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-09 13:48:06 +08:00
liu zhengxi
101a02c283 [FT] Custom op supports eager mode (#2795)
* custom op supports eager mode

* ut support eager

* compatibility

* bart

* encoder & decoder

* force decoding

* update

* alter import

* delete dir

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-09 12:10:43 +08:00
lugimzzz
00a3551f7b Data augmentation API name change & bug fix (#2956)
change_data_aug_name
2022-08-09 10:56:44 +08:00
Noel
40423017cd [duee] fix bug brought by using autotokenizer (#2985) 2022-08-08 17:42:48 +08:00
Guo Sheng
52531dde9e Add unittest for more outputs in test_modeling_common.py (#2962)
* Add unittest for more outputs in test_modeling_common.py

* Change test import.
2022-08-08 11:45:11 +08:00
yujun
63b556eb78 [NEW MODEL]Add DALL-E mini Model (#2917)
* add dalle-mini model

* update

* support auto

* decode->generate

* add dalle-mega v26

* update url

* update url

* update url

* add dallebart tokenizer into autotokenizer

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-08 10:41:14 +08:00
Jack Zhou
516f54942b Fix faster wordpiece empty string input (#2975) 2022-08-07 20:56:27 +08:00
BasicCoder
14d2c93df5 remove duplicate code in valid text input (#2977)
only need do once valid
2022-08-06 14:09:09 +08:00
liu zhengxi
3e863a3e2c Mv ernie-gen (#2970)
* mv ernie-gen

* delete useless code
2022-08-05 15:03:07 +08:00
吴高升
36ccdcd2d6 Add retrieval based classification (#2836)
* Add retrievalbase classification

* Add requirements and update readme

* Update readme

* refine the dataset structure

* Update readme

* Update text data format
2022-08-05 10:08:41 +08:00
gongenlei
a7bebbf1f9 feat: add more device (#2963) 2022-08-04 15:27:38 +08:00
Jack Zhou
d97d952cc4 Add dllexport for faster_tokenizer api (#2926)
* Add dllexport for api

* Fix faster_tokenizer c++ demo

* Add FASTERTOKENIZER_LIB definition

* Add ICU_DLL_DIR

* Add third_party lib

* Fix path

* Fix windows link path

* Add IMPORTED_IMPLIB

* Add icuuc icudt import lib

* Add icu windows
2022-08-04 14:55:09 +08:00
Linjie Chen
79e71a51e3 Update README_en.md (#2958)
* Update README_en.md

* Update README_en.md
2022-08-04 11:49:38 +08:00
吴高升
1c812c88d8 Fix random generate question ui error and search results re display of pipelines (#2954)
* Fix random generate question ui error of pipelines

* Fix ui search results re display bugs of pipelines
2022-08-03 21:14:11 +08:00
lugimzzz
e98716f8a7 Add data augmentation strategy (#2930)
* data_augmentation_strategy
2022-08-03 19:52:11 +08:00
yujun
7795eeb874 share word_embeddings weight (#2953)
Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-08-03 17:55:59 +08:00
gongenlei
1e68ed1dc5 [Doc] Add more doc for CodeGen (#2946)
* add more doc for codegen

* update pic link

* update doc
2022-08-03 16:05:11 +08:00
lugimzzz
54929a2db9 optimize text classification application (#2868)
* optimize_text_classification

* optimize_text_classification

* optimize_text_classification

* optimize_text_classification

* optimize_text_classification

* optimize_text_classification

* optimize_text_classification

* optimize_text_classification
2022-08-03 14:51:46 +08:00
吴高升
4c3518c38c Remove unused setup.py and Update readme.md of pipelines (#2939)
* Remove unused setup.py and Update readme.md

* Add pip proxy
2022-08-03 11:41:00 +08:00
liu zhengxi
30757bea4d Fix FT sampling performance issue (#2910) 2022-08-03 09:35:15 +08:00
Weilong Wu
7d0c831749 fix test_tipc/train logic (#2879) 2022-08-02 19:59:25 +08:00
Milen
72344b205b add hf dataset builder for cote, chnsenticorp, seabsa16 (#2901)
* initial commit

* refine readme

* refine codestyle

* refine readme

* refine readme

* fix model saving bug

* initial commit

* initial commit

* initial commit

* add seabsa16 and cote hf datasets builder

* add chnsenticorp hf datasets builder

* rm test_datasets.py

* remove diffcse

* add cote, seabsa16 and  chnsenticorp of hf datasets builder

* modify these examples with hf datasets

* refine codestyle for hf_datasets builder

* refine codestyle for predict.py

* recover original examples

* modify ChnSentiCorp description

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-08-02 18:49:56 +08:00
wawltor
42693bf57e Update README_cn.md 2022-08-02 16:05:19 +08:00
wawltor
e69926326c update Readme.md for the version of 2.3.5 2022-08-02 16:04:48 +08:00
Jiaqi Liu
c195224a8f add hf datasets (#2839) 2022-08-02 14:04:17 +08:00
Haohongxiang
6b4b62d4c6 [MoE] Fix fluid api bugs for paddle 2.3 (#2937) 2022-08-02 13:15:00 +08:00
Jack Zhou
37888772f0 Fix deadlink of ERNIE-DOC (#2933) 2022-08-02 11:14:23 +08:00
吴高升
86a373e35c Fix the dead links (#2934) 2022-08-01 20:52:58 +08:00
吴高升
445ad52979 Add Windows system support of pipelines (#2903)
* Add Windows system support of pipelines

* Fix the utf-8 on windows messy code

* Support delete index and update indexing data of pipelines

* Add numba dependency
2022-08-01 18:22:13 +08:00
吴高升
1c498bc8a5 Add Mac system support of pipelines (#2885)
* Add Mac system support of pipelines

* Add cpu requirements

* Add mac es faq and change to a small dataset of dureader

* adjust semantic search example
2022-08-01 17:18:50 +08:00
gongenlei
123c4c7816 add hf ds and upgrade example (#2925) 2022-08-01 13:03:03 +08:00
Milen
7932dd2924 add DiffCSE model (#2643)
* initial commit

* refine readme

* refine codestyle

* refine readme

* refine readme

* fix model saving bug

* initial commit

* initial commit

* initial commit

* use common metric instead of eval_metrics.py and remove unuseful code

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-08-01 11:26:43 +08:00
liu zhengxi
84e8026113 Backup DuConv for hf dataset (#2924)
* backup duconv

* update license

* typo
2022-07-29 21:07:47 +08:00
yingyibiao
8292c719ff [BugFix] Deal with greek letter "sigma" when return offset_mapping (#2897)
* deal with greek letter sigma

* update comments
2022-07-29 17:48:51 +08:00
Jack Zhou
912e0274a1 Fix ernie-m tokenizer defalut args (#2916) 2022-07-29 16:39:03 +08:00
wawltor
95c5e00137 Update ----.md 2022-07-29 15:22:26 +08:00
zhiyongLiu1114
77a1111cf2 add func get_special_tokens_mask() (#2875)
* add func get_special_tokens_mask() instead of using that in superclass which will lead to conflict with func build_inputs_with_special_tokens()

* add func get_special_tokens_mask() instead of using that in superclass which will lead to conflict with func build_inputs_with_special_tokens()

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-07-29 12:01:23 +08:00
吴高升
112830ba2a Fix windows dtype bug of neural search (#2911) 2022-07-28 20:24:56 +08:00
lugimzzz
842954c200 add data augmentation strategy (#2805)
* add_data_augmentation_strategy

* add_data_augmentation_strategy

* add_data_augmentation_strategy

* add_data_augmentation_strategy

Co-authored-by: wawltor <fangzeyang0904@hotmail.com>
2022-07-28 17:06:57 +08:00
Jack Zhou
721190efcd Upgrade ERNIE-M Tokenizer (#2840)
* Update ERNIE-M Tokenizer

* Add offset mapping of ernie-m

* Add sequence pretokenizer

* Add sequence pretokenizer pybind

* Fix some offset mapping problem

* Add sequence normalizer, pretokenizer json

* Add some comment for split_rule or filtered_token

* fix get_offset_mapping for ernie-m

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-07-27 22:58:17 +08:00
吴高升
92ca5dc5b9 Chnage test_pairwise.csv to dev_pairwise.csv of neural search (#2902) 2022-07-27 22:29:13 +08:00
Jiaqi Liu
a149af9a5a fix auto usage (#2883) 2022-07-26 21:13:21 +08:00
Noel
3787da1f15 [ehealth] move deployment to cblue (#2881) 2022-07-26 20:13:09 +08:00
liu zhengxi
8609c92cb1 fix #2665 (#2877) 2022-07-26 17:20:42 +08:00
吴高升
174ce23ac6 Update requirements.txt and README of pipelines (#2842)
* Update requirements.txt and README of pipelines

* Restore semantic search readme

* Remove question answering faq

* Add bash files

* remove pdftotext and update readme

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-07-26 16:07:04 +08:00
Linjie Chen
0722c85fed Add UIE english model (#2855)
* add uie-base-en

* add example usage

* fix uie_predictor

* Update README.md
2022-07-26 10:28:54 +08:00
Noel
8ab6d87c9f [duie] fix NameError brought by using AutoTokenizer (#2867) 2022-07-25 19:59:01 +08:00
Noel
5848a9c482 [ernie-health] add onnxruntime deployment (#2329) 2022-07-25 19:27:47 +08:00
yingyibiao
e568e07329 fix get_offset_mapping error for Ernie tokenizer (#2857) 2022-07-25 10:12:31 +08:00
Guoxia Wang
4d18e4d648 [GPT] Optimize dataset_utils C++ compile (#2846) 2022-07-21 20:05:28 +08:00
wawltor
c677a526ec Update README_cn.md 2022-07-21 14:04:29 +08:00
yingyibiao
8e2f1dced5 Add unittest for bert modeling and tokenizer (#2624)
* add unittest for bert modeling

* add unittest for bert modeling

* update

* update bert tokenizer unttest

* update bert tokenizer unttest

* update

* fix relative import

* add set_input_embeddings

* update

* update

* fix vocab bug

* delete print statements

* fix get_offset_mapping bug
2022-07-21 10:35:55 +08:00
LixinGuo
5f2115e4c5 add gpt3 fp32 for benchmark (#2838) 2022-07-19 20:17:30 +08:00
yingyibiao
7f3c63af22 fix readthedocs (#2834) 2022-07-19 17:09:32 +08:00
buchongyu
583a058c62 fix MARKDOWN dead link (#2817) 2022-07-19 15:02:26 +08:00
gongenlei
e645d83474 add codegen doc (#2791) 2022-07-19 12:09:26 +08:00
Liujie0926
9d11665e7b [CE] Update hybrid_parallelism gpt run_benchmark.sh to CE (#2829) 2022-07-18 18:57:19 +08:00
Yuang Liu
fe9d03c49f [GPT-3] Optimize gpt-3 with fused op (#2650)
* use fuse in benchmark
* optim dygraph benchmark
2022-07-18 14:00:35 +08:00
Jack Zhou
0c93356e7e Fix re2 windows cmake (#2800) 2022-07-18 12:09:52 +08:00
yeliang2258
0a618c70f9 Fix deploy doc (#2811)
* fix deploy doc

* update doc

* update paddle2onnx doc
2022-07-15 16:09:48 +08:00
gongenlei
7745db00b4 test=document_fix (#2804) 2022-07-15 00:16:51 +08:00
骑马小猫
48d52c5423 fix resize token embedding method (#2763)
* fix resize token embedding

* fix embedding len & raise error issue

* fix linting issue

* add vocab_size

Co-authored-by: yingyibiao <yyb0576@163.com>
Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-07-14 21:01:17 +08:00
骑马小猫
6e1372fda7 improve auto model error message (#2764)
* improve auto model error message

* fix linting of error message of auto modeling

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-07-14 19:14:00 +08:00
gongenlei
0fd17f81bd Add CodeGen to taskflow (#2754)
* feat: add codegen to taskflow

* add faster flag

* add docs

* update doc
2022-07-14 15:33:52 +08:00
Yuang Liu
51a8c85867 fix oom for bert large under fp32 (#2798) 2022-07-14 13:26:57 +08:00
yeliang2258
b3087c4b4c Update Ernie3.0 deploy backend (#2780)
* fix some bugs

* update ernie_predictor, supprot all quantize model on cpu and gpu

* update code

* fix

* update comment

* update code

* update info

* update code, fix bugs

* update code

* update doc

* update doc

* update doc and remove useless code

Co-authored-by: Jiaqi Liu <709153940@qq.com>
2022-07-14 10:47:36 +08:00
Jack Zhou
b4c9dc9686 update faster_tokenizer version and tokenizer warnning log (#2792) 2022-07-13 22:44:30 +08:00
Linjie Chen
f1f3eb7b5c fix windows dtype to int64 (#2784) 2022-07-13 19:36:18 +08:00
吴高升
46de583283 Update faq question for inbatch model loading simcse checkpoint and o… (#2786)
* Update faq question for inbatch model loading simcse checkpoint and optimize the code and readme

* Update Readme of neural search
2022-07-13 15:48:18 +08:00
lugimzzz
063eb2c9f0 change text classification local dataset format from tsv to txt (#2788)
* change_local_data_format

* change_local_dataset_format
2022-07-13 13:59:48 +08:00
Jack Zhou
50f666a5c9 Fix faster_tokenizer windows compile (#2744)
* uint -> uint32_t

* fix dependency of icu

* update icu cmake

* Fix uint->uint32_t

* use utf8 instead of unicode character in metaspace

* Fix icu cmake

* Add some cxx flag for windows

* Remove BertPreTokenizer from BertConverter

* Change DBUILD_SHARED

* adjust python.h pos

* remove BUILD_SHARED of re2

* Fix windows package

* Add windows python dll path setting

* Add windows python dll path setting

* Add icu dll copy

* Add faster_tokenizer.libs module

* Fix icu path

* Fix wordpiece save

* use emplace_back instead of push_back to avoid error in windows

* Fix special tokens pretokenization

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-07-13 11:36:55 +08:00
wawltor
9a7394b5ca update log for the text classification (#2789) 2022-07-13 10:02:51 +08:00
吴高升
3910c52631 Fix ImagetoTextConverter missing bug of pipelines for semantic search (#2768)
* Fix ImagetoTextConverter missing bug of pipelines

* Remove specified version of opencv
2022-07-12 21:16:52 +08:00
wawltor
98c4f399a2 Update README.md 2022-07-12 20:03:38 +08:00
wawltor
54444bbb6d Update README.md 2022-07-12 20:03:02 +08:00
wawltor
80e64b1774 Update README.md 2022-07-12 20:01:52 +08:00
tianxin
e822ee47a8 Update RGL README (#2782) 2022-07-12 16:58:20 +08:00
wawltor
45f23301fd Update README.md 2022-07-12 12:09:01 +08:00
wawltor
bd4e266ac7 Update README.md 2022-07-12 12:08:00 +08:00
wawltor
60e354aa72 Update README.md 2022-07-12 11:55:34 +08:00
Jack Zhou
c339b03d90 Upgrade paddlenlp.ops.einsum (#2778) 2022-07-11 21:52:19 +08:00
Noel
2ced97a583 [few-shot] Add RGL implementation to examples (#2651)
* [RGL] update implementation and README
2022-07-11 20:54:42 +08:00
Jiaqi Liu
2e34b1669f Fix question matching typo (#2775) 2022-07-11 15:51:14 +08:00
Guo Sheng
548d59aeb6 Support more model outputs for BERT/ERNIE/RoBERTa (#2665)
* Support more model outputs for BERT.

* Make more task classed support more outputs.

* Convert list to tuple automatically in ModelOutput.

* Support more model outputs for ERNIE.

* Support more model outputs for Roberta.

* Add embedding output to all hidden states.

* Clean import in model_output.py

* Make output of BERT/ERNIE/RoBerta be tensor instead of tuple when the size of tuple is one.

* Make monkey patches for forward of PretrainedModel compatible with the latest forward.

* Add compatibility for patches of paddle.nn.Transformer

* Fix dygraph to static graph with more outputs.

* Fix setattr for subclass of TransformerEncoder such as Electra.
2022-07-11 14:55:28 +08:00
wawltor
cf055c8239 update text_classification readme 2022-07-11 12:08:43 +08:00
wawltor
5813bfd60e update text_classification readme 2022-07-11 12:06:22 +08:00
yingyibiao
cfd5466861 Fix model downloads recording mechanism (#2766)
* change model downloadng record mechanism

* change model downloadng record mechanism
2022-07-08 18:32:46 +08:00
Jack Zhou
b5d0d22b38 Fix init_removed of update_range in faster_tokenizer (#2758) 2022-07-07 20:10:36 +08:00
wawltor
8a5443b311 Update README.md 2022-07-07 19:12:57 +08:00
Aurelius84
00f05b8456 [Dy2Stat] Adapt to while transformer refactor logic (#2756) 2022-07-07 18:22:21 +08:00
lugimzzz
ae17eed919 optimize text classification (#2727)
* optimize_text_classification

* optimize_text_classification

* optimize_text_classification

* optimize_text_classification

Co-authored-by: wawltor <fangzeyang0904@hotmail.com>
2022-07-07 16:13:21 +08:00
Jiaqi Liu
167464c778 Fix import error (#2752) 2022-07-07 14:48:15 +08:00
yingyibiao
e95bd9384c Pass max_position_embeddings arg to MultiHeadAttentionWithRotary class (#2745) 2022-07-06 14:35:22 +08:00
littletomatodonkey
38f806d025 fix layout model for relation build (#2742) 2022-07-06 14:22:55 +08:00
吴高升
de777fd789 Add c++ and pipeline Paddle Serving Support of ranking model for neural search (#2721)
* Add c++ and pipeline Paddle Serving Support for neural search

* Add serving code structure for ranking

* slightly small fix of ranking readme and bash files

* Add recall and rank system pipeline

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-07-06 13:54:05 +08:00
Jiaqi Liu
f9231425af update ernie model to 3.0 (#2728) 2022-07-06 10:43:28 +08:00
piotrekobi
a0c9e1d84f Enable CPU BF16 acceleration in ERNIE 3.0 (#2730)
* Add --enable_bf16 argument to ernie-3.0

* Fix code style

* Fix codestyle properly (hopefully)

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-07-06 10:37:06 +08:00
吴高升
960fe9e0c3 Merge pull request #2736 from w5688414/pip1
Fix the max_seq_len bug of pipelines for semantic search
2022-07-06 09:56:42 +08:00
tianxin
a88cd55765 Merge branch 'develop' into pip1 2022-07-06 09:17:39 +08:00
Jack Zhou
17b76a4a64 Add bpe & unigram tokenizer (#2536)
* Add Metaspace pretokenizer

* Add bpe, BPEWord and BPE Cache structure

* Add bpe vocab, merges getter

* Remove const from Tokenize

* Add bpe tokenizer impl

* Add bpe json

* Add BPE::Save

* Add shared_mutex for BPE Cache

* Add bpe pybind api

* Fix bpe tokenizer impl

* Fix SequenceNormalizer pybind constructor

* Add SentencePieceBPEFasterTokenizer

* Fix the BPE tokenizer bug

* Add SentencePieceExtractor

* Add sentencepiece_pb2 and SpmConvertor

* add protobuf deps

* Add PrefixMatcher of sentencepiece normalizer

* Add sentencepiece normalizer

* Add precompiled pybind

* Add simple string view

* Fix icu cmake

* use static lib instead of shared lib for icu

* Add precompiled normalizer

* Fix precompiled normalizer

* Add json for PrecompiledNormalizer

* Add PrecompiledNormalizer pybind

* Add ernie-m faster convertor

* Add unigram definition

* Add make_unique; Add Unigram constructor

* Add override impl of unigram

* Add lattice

* Add Tokenize of Unigram

* Add pybind interface of Unigram

* Fix postprocessor of ErnieM

* Fix replace normalizer bug

* Fix EncodeOptimized

* Fix check_number_comma for ernie_m faster tokenizer

* Fix some unigram bug

* remove \p{Cn}

* double -> float

* Fix MapChar

* Fix unigram offset mapping

* fresh  format of cpp code in faster tokenizer

* namespace tokenizers -> namespace faster_tokenizer

* Add paddlenlp namespace in faster tokenizer

* remove useless line
2022-07-05 19:58:53 +08:00
w5688414
96b6999ca7 Fix the max_seq_len bug of pipelines for semantic search 2022-07-05 10:03:42 +00:00
littletomatodonkey
989155cd19 fix error when relation is empty (#2732)
Co-authored-by: yingyibiao <yyb0576@163.com>
2022-07-05 14:48:29 +08:00
Guo Sheng
068a8d9777 Fix Electra inference. (#2735) 2022-07-05 13:46:39 +08:00
Linjie Chen
8cbf0f44f6 Update README_en.md (#2734)
* Update README_en.md

* Update README_en.md

* Update README_en.md
2022-07-05 11:39:26 +08:00
zhoujun
7eba09149d add dy2static support of LayoutLMv2 SER and LayoutXLM SER (#2695)
* add dy2static support of LayoutLMv2 and LayoutxLM

* format code

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-07-05 11:19:12 +08:00
wawltor
c5f14a66d2 Update README_cn.md 2022-07-05 11:00:31 +08:00
wawltor
803b41ed4b Update README_cn.md 2022-07-05 10:59:40 +08:00
Zhong Hui
85f76e50f1 [TRAINER] Optimize logs for benchmark. (#2684) 2022-07-05 10:41:27 +08:00
Guo Sheng
2517583397 Update some fluid api usage and fix a typo. (#2719) 2022-07-04 21:23:58 +08:00
Linjie Chen
9000712ed0 fix bug of file updating (#2707)
* fix bug of file updating

* revert change
2022-07-04 19:02:13 +08:00
lugimzzz
0ca48c5553 add multi classification application (#2675)
* add_multi_classification

* add_multi_classification

* add_multi_classification

* add_multi_classification

* evaluate_on_test_and_dev

* add_triton_server

* add_triton _server

* add_triton_server

* add_doccano_for_text_classification

* modify_multi_classification

* modify_multi_classification

* modify_multi_classification
2022-07-04 17:27:18 +08:00
gmm
93974f0d97 [fix benchmark] add benchmark model epochs (#2722) 2022-07-04 15:57:50 +08:00
wawltor
b192b848e5 Update modeling.py 2022-07-02 22:26:18 +08:00
吴高升
f6a8a5a261 Merge pull request #2709 from w5688414/pipeline1
Add faiss dependancy and Add utf-8 faq hint of pipelines
2022-07-02 11:03:52 +08:00
吴高升
24edee6549 Merge branch 'develop' into pipeline1 2022-07-02 10:51:38 +08:00
Guo Sheng
131bb80da2 Clean the usage of paddle.fluid (#2691) 2022-07-01 23:42:56 +08:00
tianxin
aebb717023 fix README typo of pipelines semantic search for set device: --device gpu/cpu (#2702) 2022-07-01 21:39:28 +08:00
w5688414
13e500bf5f Update faq section font size to 4 level title 2022-07-01 09:23:43 +00:00
吴高升
1f078ef9e4 Merge pull request #2710 from w5688414/neural_search
Fix droput prediction bug and Add faq for milvus indexing of neural search
2022-07-01 16:44:10 +08:00
吴高升
94b74c03ec Merge branch 'develop' into neural_search 2022-07-01 16:43:48 +08:00
w5688414
157ced55fb Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into pipeline1 2022-07-01 08:31:30 +00:00
w5688414
1d5e425a8c Update faq readme 2022-07-01 08:30:57 +00:00
w5688414
06368eca6d Fix droput prediction bug and Add faq for milvus indexing 2022-07-01 08:24:27 +00:00
lastrei
b0a60615c1 add infer predict function for PET (#2690)
* add infer predict function for PET

add infer predict function for PET

* Update predict.py

* Delete predict.py

* Create test.txt

* add infer predict function for PET

add infer predict function for PET

* Delete test.txt

* Create README.md

* Delete predict.py

* fix review

fix review

* Update README.md

* Delete predict.py

* Add files via upload

* Delete predict.py

* Add files via upload

* codestyle fix

Co-authored-by: wawltor <fangzeyang0904@hotmail.com>
2022-07-01 16:21:38 +08:00
w5688414
40734bb3af Add faiss dependancy and Add utf-8 faq hint 2022-07-01 08:00:31 +00:00
wawltor
67d512b240 Update infer.py 2022-07-01 10:26:01 +08:00
Roc
5e3a588de4 [Benchmark] Adapted for benchmark ips for MOE (#2700)
* Adapted for benchmark ips
2022-06-30 20:36:14 +08:00
wawltor
7fa724472c update the document for the pet (#2692) 2022-06-30 17:36:40 +08:00
Linjie Chen
0650e01bbe Update README.md for UIE (#2679)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
2022-06-30 12:09:26 +08:00
lugimzzz
683d14ed55 add multi label classification application (#2661)
* add_multi_label_classification

* add_multi_label_classification

* add_multi_label_classification

* modify_hierarchical_classification

* evaluate_on_test_and_dev
2022-06-30 10:31:27 +08:00
wawltor
4718676968 Update README_en.md 2022-06-29 21:32:31 +08:00
wawltor
4e31451d30 Update README_cn.md 2022-06-29 21:16:42 +08:00
Jiaqi Liu
7dfacbdfb3 remove fluid api (#2682) 2022-06-29 19:24:49 +08:00
Haohongxiang
4d40a2ea80 [MOE] fix bugs of PR-2633 (#2683) 2022-06-29 17:41:44 +08:00
lugimzzz
737a300030 Merge pull request #2591 from lugimzzz/add_new_dataset
add cail2018 small dataset
2022-06-29 14:17:47 +08:00
lugimzzz
f5cb6b85fb Merge branch 'develop' into add_new_dataset 2022-06-29 14:16:39 +08:00
Jiaqi Liu
77873b0fe9 Update ernie-3.0 readme (#2678)
* udpate ernie-3.0  readme

* udpate ernie-3.0  readme
2022-06-29 13:53:19 +08:00
吴高升
95f963339c Remove ernie-1.0 pretraining of neural search (#2652)
* Remove ernie-1.0 pretraining of neural search

* Update Readme of neural search

* Delete domain apaptive pretraining readme
2022-06-29 13:26:07 +08:00
Jiaqi Liu
7ffd30e6ed Remove hard code on Trainer compress (#2668)
* remove hard code on trainer compress

* model.init_config[init_class]->model.__class__.__name__
2022-06-28 19:56:32 +08:00
lastrei
9230a1eaa7 add export infer model function for PET (#2671)
* Add files via upload

add export infer model for PET

* Update export_model.py

* Update export_model.py
2022-06-28 18:57:23 +08:00
吴高升
d7ae773f79 Update Evaluate while training to find the best model (#2663)
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-06-28 17:00:02 +08:00
Jiaqi Liu
0fb361753f optimize ernie 3.0 readme, add faster tokenizer (#2594) 2022-06-28 15:15:11 +08:00
Zhong Hui
2710b7d454 [BugFix] Remove is_init_py of RandomGenerator (#2658) 2022-06-28 10:28:06 +08:00
gongenlei
c19372bca1 [CodeGen] Add CodeGen model for code generation (#2641)
* feat: add CodeGen model

* update copyright
2022-06-28 10:19:34 +08:00
sneaxiy
42311124dc fix dir error (#2660) 2022-06-27 22:37:14 +08:00
Linjie Chen
a5760045d2 Add uie-mini, uie-micro and uie-nano for UIE (#2604)
* add uie-mini, uie-micro and uie-nano

* update README.md

* Update README.md
2022-06-27 19:47:46 +08:00
gongenlei
dbf57dd77a doc: update MBartForConditionalGeneration docstring (#2655) 2022-06-27 18:55:43 +08:00
yujun
7e1a4332d5 override xlm's tokenize method (#2551)
Co-authored-by: gongenlei <gongel@qq.com>
2022-06-27 16:06:07 +08:00
骑马小猫
ad36a14f73 fix skep tokenizer and samefile (#2648)
* fix skep tokenizer

* change samefile to abspath

Co-authored-by: Guo Sheng <whucsgs@163.com>
2022-06-27 13:16:29 +08:00
Zhong Hui
40417bf8de [CodeStyle] Remove some code with paddle.fluid (#2633)
* remove fluid
2022-06-27 11:48:41 +08:00
lugimzzz
08f0633296 add hierarchical text classification (#2501)
* add_hierarchical_classification

* modify_wos_dataset

* optimize_codes

* add_paddle_serving

* add_paddle_serving

* add_paddle_serving
2022-06-27 11:20:27 +08:00
Guo Sheng
38629479f5 Revert "Support more model outputs for BERT/ERNIE/RoBERTa (#2583)" (#2647)
This reverts commit dab5e26f3e.
2022-06-27 11:18:48 +08:00
lugimzzz
eb43ab76b4 add_cail2018_small_dataset 2022-06-27 02:50:17 +00:00
Guo Sheng
dab5e26f3e Support more model outputs for BERT/ERNIE/RoBERTa (#2583)
* Support more model outputs for BERT.

* Make more task classed support more outputs.

* Convert list to tuple automatically in ModelOutput.

* Support more model outputs for ERNIE.

* Support more model outputs for Roberta.

* Add embedding output to all hidden states.

* Clean import in model_output.py
2022-06-27 00:34:33 +08:00
ZeyuChen
9fda199877 Update paddlenlp logo link 2022-06-26 21:38:23 +08:00
骑马小猫
7838255d9a fix chinese bert tokenizer unexpected parameter (#2625)
Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-06-26 17:20:37 +08:00
Linjie Chen
03dcbeff74 Support evaluation for each class separately (#2626)
* add batch_size for predictor and support evaluate separately

* fix typos and update README.md

* update uie_predictor

* replace separated to debug flag

* compatible with classification tasks

* update debug mode

* update debug mode
2022-06-24 18:18:26 +08:00
yingyibiao
c92810b1ff Support resize_position_embeddings for layoutlm-models (#2513)
* support resize_position_embeddings for layoutlm-models

* modify resize_position_embeddings
2022-06-24 16:44:43 +08:00
骑马小猫
497dedd63b add _entity_file field to LukeTokenizer (#2631)
* add _entity_file field

* remove none resouce file checking

* use with keyword to do open file operation

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-06-24 15:37:13 +08:00
Guo Sheng
14b476893c Fix special token settings in PretrainiedTokenizer. (#2629) 2022-06-24 11:14:34 +08:00
liu zhengxi
0315365dba fix gpt-3 on pdc (#2618) 2022-06-23 15:12:32 +08:00
LiYuRio
8dd2e2a41d inference support amp (#2505)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-06-23 12:20:19 +08:00
Roc
634c2e7759 [GPT-3] Fix reader of gpt-3 static graph for pipeline mode (#2564) 2022-06-23 10:17:33 +08:00
Linjie Chen
fc0313b3e4 fix UIE evaluation (#2558) 2022-06-22 20:06:56 +08:00
wawltor
761c295d25 update uie document for the probs of train and valid datasets 2022-06-22 14:36:25 +08:00
Jack Zhou
baf322f20a Use AdamW with lr_ratio setting instead of AdamWDL (#2576)
* Use AdamW with lr_ratio setting instead of AdamWDL

* remove AdamWDL

* remove AdamWDL docs

* Add AdamWDL

* restore adamwdl docs

* Fix adamwdl bug

* Remove fluid
2022-06-21 19:58:36 +08:00
wawltor
1710fb26c4 update the Taskflow document 2022-06-21 16:28:11 +08:00
Jiaqi Liu
397319997b fix clue chid eval bug, and add faster tokenizer for tinybert (#2574) 2022-06-21 14:32:03 +08:00
lugimzzz
805ecf3a23 add_cail2018_small_dataset 2022-06-21 04:01:26 +00:00
吴高升
070322f6e1 Fix default model loading bug of neural search (#2588)
* Fix default model loading bug
2022-06-20 21:46:52 +08:00
westfish
156b6761e8 add resize_token_embeddings to Class PretrainedModel (#2423)
* add resize_token_embeddings to Class PretrainedModel

* update resize_token_embeddings

* update_new_embedding_weight_setting

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-06-20 20:30:41 +08:00
骑马小猫
b3d93484e2 checking existence of file before copy (#2578)
* checking existence of file before copy

* update save_resources

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-06-20 19:41:09 +08:00
Jiaqi Liu
ae97b77778 Update CLUE result and pictures (#2532)
* add some result for ernie3.0

* update table

* update readme

* fix table

* update

* fix black

* fix img

* update picture and table for ernie 3.0  and clue

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-06-20 19:03:04 +08:00
Roc
7f5f43aa31 [Benchamrk] Fix gpt-3 TIPC script for hybrid parallel. (#2530)
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-06-20 14:44:45 +08:00
wawltor
536ab141f5 Add the WordTag-IE tool (#2540)
* add the wordtag-ie

* add the document for the wordtag ie taskflow

* add the wordtag ie document

* update the parameter for the wordtagie

* update the example for the wordtag-ie

* update the taskflow and wordtag-ie document
2022-06-20 10:35:00 +08:00
taixiurong
662ec5aaa4 [BugFix] Fix save models when reach max_steps for bert (#2556) 2022-06-18 11:41:59 +08:00
freeliuzc
7833edf910 Update installation.rst (#2543)
* Update installation.rst

增加“使用Docker镜像体验PaddleOCR”章节

* Update installation.rst

fix bug
2022-06-17 21:28:16 +08:00
liu zhengxi
0ebb047b98 [Benchmark] Add more bs setting for bert base (#2563) 2022-06-17 19:35:41 +08:00
gongenlei
222fc3154a [FasterBART] Suppport dygraph to static and inference (#2519)
* suppport d2s and inference

* default to beam_search

* add comments

* update tokenizer usage

* rm disable_faster_encoder
2022-06-17 18:50:07 +08:00
gongenlei
5901915881 Fix sampling decoding when model without parallel (#2561)
* fix sampling error

* fix sampling error

Co-authored-by: liu zhengxi <380185688@qq.com>
2022-06-17 18:41:36 +08:00
骑马小猫
417ccafef9 Improve tokenizer (#2521)
* fix tokenizer isfile checking code

* save model_config file when calling from_pretrained

* add unittest for testing all of models & tokenziers

* add test code for from_pretrained

* add name in todo & add docstring in test method

* save tokenizer config & additional resource files

* add unit test for multprocessing writing file

* remove return

* using the class-scope method to save config file

Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-06-17 18:29:04 +08:00
Guo Sheng
42bf0f78a6 Fix AddToken settings in tokenizers (#2534)
* Fix AddToken settings in tokenizers.

* Fix _build_special_tokens_map_extended
2022-06-17 16:01:44 +08:00
gongenlei
2f366e4d50 fix tokenize (#2549) 2022-06-17 12:40:48 +08:00
曾小健
7f7f7d09f9 Update trans_to_json.py (#2544)
Bug fix:如果不加,win报如下错误,加进去就好了。
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 45: illegal multibyte sequence
2022-06-17 00:07:48 +08:00
liu zhengxi
f10575dea9 Update fluid APIs (#2469)
* update fluid apis

* update
2022-06-16 22:25:14 +08:00
曾小健
4a23b50ade Update evaluate.py (#2537)
fix typo of in_batch_negative evaluate.py
2022-06-16 15:57:37 +08:00
Yuang Liu
bc84454065 [Benchmark] Optimize Bert using fused_ffn and fused_attention (#2523)
* framework for fused transformer

* fused ffn and fused attention

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-06-16 14:21:10 +08:00
yujun
07bafdc688 [NEW MODEL] Add_XLM_model (#2080)
* Add-XLM-model

* use try_import

* tensor.shape -> paddle.shape

* add xlm xnli example

* add copyright

* add missing args

* en->language

* en->language

* en->language

* update xlm example readme

* update tokenizer and readme

* update xlm tokenizer

* update

* update

* codestyle

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-06-16 11:21:43 +08:00
Jiaqi Liu
d95cfc314f Add UER-py and HFL Chinese RoBERTa models (#2437)
* Fix clue grid search bug

* fix

* fix cmrc2018 filename

* Update run_mrc.sh

* add uer-roberta

* update model name for roberta models

* update uer

* update ernie 3.0 run_qa.py

* remove useless symbols

* make tinybert support faster_tokenizer, add rbt4, UER-py/RoBERTa-6L768H

* add rbt6

* add org name

* fix table format

* Add org name for rbt
2022-06-15 15:42:20 +08:00
Zhong Hui
be6a077d59 [ERNIE] Add split args on readme. (#2518)
* Update README.md

* Update README.md

* Update run_gb512_s1m.sh

* Update run_gb512_s1m_static.sh

* Update run_gb512_s1m_trainer.sh

* Update run_gb512_s1m_static.sh
2022-06-15 15:41:42 +08:00
Zhong Hui
835aed06d8 [DOC] Update domain_adaptive_pretraining README.md (#2522) 2022-06-15 14:58:27 +08:00
Zhong Hui
e135626896 [ERNIE-1.0] Fix bug for load checkpoint while using amp 02 save_dtype (#2479) 2022-06-15 11:07:48 +08:00
Zhong Hui
a93bdffb47 [Trainer] Support constant and consine lr scheduler (#2511)
* support constant and consine lr scheduler

* fix doc

* delete

* add doc
2022-06-14 23:06:52 +08:00
Jack Zhou
6ccc0be765 Add template postprocess module for faster_tokenizer (#2516)
* Add template postprocessing

* add template json

* move template.cc to faster_tokenizers

* Add template processing pybind

Conflicts:
	faster_tokenizer/faster_tokenizer/src/core/CMakeLists.txt

* tmp template pybind

* Fix template processor pybind __init__

* Fix template processing overflowing bug

* fix from_json of template piece
2022-06-14 23:05:55 +08:00
LiYuRio
1f446ff575 [GPT-3] Add GPT configs 89B and 175B (#2504)
* Add configs for 89B and 175B
2022-06-14 19:07:06 +08:00
Jack Zhou
d99b333543 Fix bert offset mapping (#2508) 2022-06-14 17:43:53 +08:00
Roc
b07a41787f Fix benchmark gpt (#2509)
* update scripts

* fix dp2mp2pp2 in benchmark
2022-06-14 17:43:21 +08:00
Haohongxiang
4d384e513c add benchmark of sharded moe (#2507) 2022-06-14 16:05:18 +08:00
LixinGuo
baf0247996 benchmark change hybrid_parallelism gpt N4C8 to N4C32 (#2499) 2022-06-14 11:17:15 +08:00
Jack Zhou
5bc1b98624 faster_tokenizers->faster_tokenizer (#2503)
* faster_tokenizers->faster_tokenizer

* update version

* FasterTokenizers->FasterTokenizer

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-06-14 10:18:50 +08:00
heliqi
5cd8fd5b29 add tokencls triton inference server for ernie-3.0 (#2502)
* add triton service for ernie-3.0

* modify triton code

* Optimize the triton server code

* Optimize the triton server code

* triton server add tokencls
2022-06-14 00:33:28 +08:00
WangXi
016db3c15c [GPT-3] Add fused_multi_transformer for inference (#2500) 2022-06-13 20:58:39 +08:00
liu zhengxi
7c06b02e31 update yapf (#2464) 2022-06-13 20:04:14 +08:00
yeliang2258
837d06ad58 Add model_path_correction func (#2498)
* add model_path_correction

* fix bug
2022-06-13 19:56:21 +08:00
Zhong Hui
7b971c442b fix-albert-pad-token-id (#2495) 2022-06-13 19:53:00 +08:00
Zhong Hui
43c6c46ae2 [Benchmark] update clue result of ernie (#2492)
* update clue result

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
2022-06-13 15:13:10 +08:00
lidanqing
d33892863e Add ernie-3.0 mkldnn fp32 and int8 support (#2468)
* add ernie-3.0 mkldnn fp32 and int8 support

* fix code style

* fix doc

* update
2022-06-13 12:36:50 +08:00
Jack Zhou
31deea6c98 Add faster wordpiece tokenizer (#2297)
* Add faster wordpiece model, still need to implement tokenize and construct trie.

* Add trie constructor

* Fix naming style

* implement trie constructor

* Add utils function for faster wordpiece

* Add faster wordpiece python api

* Fix reference to pointer

* FasterWordPiece TokenToId

* Add IsChineseOrPunction api

* Add Failure structre

* Add FailureVocabToken

* Add failure_array constructors

* Add FasterWordPiece Tokenize

* Implement TryHandleContinuingSubWordPrefix

* remove faster_wordpiece_tokenizer

* Fix FasterWordpiece

* add faster_wordpiece

* Fix pybind exception

* Part I: Add trie and failure array constructor of End2End faster wordpiece

* Part II: Add End2End faster wordpiece

* Fix faster wordpiece end2end version

* fix use_faster_wordpiece_with_pretokenization

* Fix save api

* Fix SetWithPretokenization

* Add copyright

* Fix Normalization update_offset; Add unittest for faster wordpiece tokenizer

* Fix the overflowing offset setting

* Fix the pair encoding truncate

* faster_tokenizers->faster_tokenizer

* Add replace normalizer json

* Add replace normalizer json unittest

* Add strip normalizer json

* Add unicode normalizer json

* Add Lowercase, Sequence json

* Fix Sequence json

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-06-10 23:31:45 +08:00
lugimzzz
79412aa3fc add Web of Science(WOS) dataset(a hierarchical text classification dataset) (#2467)
* add_wos_dataset

* add_wos_dataset
2022-06-10 22:32:03 +08:00
吴高升
b8881b5519 fix winindows bugs (#2482)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-06-10 22:29:26 +08:00
Linjie Chen
dbda1f50a6 revert update on predictor (#2483) 2022-06-10 21:58:48 +08:00
Roc
617fee64dc add benchamrk for hybrid parallel GPT (#2459)
* update scripts

* Update run_benchmark.sh
2022-06-10 17:58:20 +08:00
Roc
681d5e21b5 调高max_iter/max_epochs, 解决benchmark性能波动问题 (#2475)
* 调高max_iter/max_epochs, 解决benchmark性能波动问题

* revert max_epochs of dp/gpt
2022-06-10 17:53:47 +08:00
liu zhengxi
d1c683dbfd rename filename (#2480) 2022-06-10 17:44:44 +08:00
Linjie Chen
ce61f68323 fix bug of doccano conversion (#2477)
* fix doccano annotation

* fix predictor
2022-06-10 17:12:06 +08:00
Linjie Chen
94bb8db332 fix bug of offset overlapping (#2453)
* fix bug of prompt offset

* add comments

* add comments

* update variable name

* fix grammar

* fix dtype

* fix dtype
2022-06-10 14:13:27 +08:00
Linjie Chen
647dc69c74 Support to use doccano to label aspect-level classification task (#2457)
* add aspect cls labeling

* add aspect-level cls task

* change logger level

* remove unused comments

* Update README.md

* change logger level

* Update README.md

* resolve conflict

* resolve

* Update predictor

* Update README.md
2022-06-10 11:50:14 +08:00
wawltor
ececddb03e Update README.md 2022-06-10 10:36:55 +08:00
liu zhengxi
b72d37f13d Support FasterTransformer compiled with paddle inference lib with onnx (#2463)
* add onnx support

* update readme
2022-06-09 22:45:50 +08:00
tianchunfeng
80d22aafd2 a typo for PaddleNLP v2.2 release date . (#2461)
2022.12.12 **PaddleNLP v2.2**发布 =>  2021.12.12 **PaddleNLP v2.2**发布
2022-06-09 22:44:49 +08:00
Haohongxiang
636e2e5efb [MoE] Support Eager Dygraph and Group Sharded Parallel in MoE model (#2392)
* support eager moe
* support eager sharded moe
2022-06-09 15:08:33 +08:00
zche4846
0fae3067aa 【Hackathon No.77】基于ERNIE_DOC完成长文本分类任务 (#1845)
* add ernie_doc example

* add README file

* bug fix

* bug fix

* space to tabs

* trim trailing space

* trim trailing space

* trim trailing space

* trim trailing space

* end of file line

* end of file line

* end of file line

* yapf

* yapf

* yapf

* yapf

* change copyright info

* delete redundant code & modify copyright info & compatibility improvement.

* editing docstrings & rewriting memories initiation method for static mode.

* code style fix

* editing docstrings for variable 'memories'

Co-authored-by: yingyibiao <yyb0576@163.com>
Co-authored-by: Jack Zhou <zhoushunjie@baidu.com>
2022-06-09 14:55:55 +08:00
wawltor
db33f19a01 Update taskflow.md 2022-06-09 13:07:42 +08:00
Roc
e4de45f3e0 Add MOE benchmark (#2404)
* add scripts

* set --resume unreqired

* update
2022-06-09 11:18:24 +08:00
gongenlei
2027317693 fix: close file for unittest (#2445) 2022-06-08 21:55:27 +08:00
Beacontownfc
b34c318a5c Add rembert to auto (#2450)
* add rembert to auto

* recover

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-06-08 19:03:09 +08:00
yeliang2258
9af11bb465 change cpu count func (#2448) 2022-06-08 18:01:32 +08:00
yingyibiao
9805556535 Fix RoBERTa docs (#2446)
* fix docs

* fix docs
2022-06-08 15:33:56 +08:00
Zhong Hui
cec1caf485 delete old style code for ernie hybrid parallel. (#2429) 2022-06-08 01:09:54 +08:00
yingyibiao
1b904b7cb0 fix deadlinks (#2427) 2022-06-07 18:18:24 +08:00
yingyibiao
64ac2f404b remove Model suffix (#2426) 2022-06-07 16:11:02 +08:00
骑马小猫
3ec1d35f7f fix tokenizer isfile checking code (#2424)
* fix tokenizer isfile checking code

* fix code  style
2022-06-07 10:30:23 +08:00
yeliang2258
75edf33e3b Fix datas to data (#2410)
* fix datas to data

* update code

* change all_data to texts in triton deploy
2022-06-06 21:10:45 +08:00
yingyibiao
0e76981a54 fix deadlink (#2419) 2022-06-06 20:18:29 +08:00
Linjie Chen
f6b3ccac92 fix data type for ddparser output (#2422) 2022-06-06 20:17:55 +08:00
Linjie Chen
5abaaecd93 fix bugs in doccano.py and task.py (#2417)
* optimize code

* optimize code
2022-06-06 14:03:20 +08:00
ZeyuChen
41daa257de Remove old news 2022-06-05 13:43:33 +08:00
tianxin
7d1d6fe3ac specify protobuf version (#2406)
* update pipeline README

* specify protobuf version
2022-06-02 20:23:38 +08:00
Guo Sheng
8fdf42d9db Update requirements. (#2407) 2022-06-02 20:23:27 +08:00
Linjie Chen
6ab0ee3872 revert version control for scipy (#2405)
* revert version control for scipy

* revert
2022-06-02 19:16:25 +08:00
骑马小猫
2a6b6c6c18 fix issue: #2387 to make tokenizer more robust (#2395)
* fix issue: #2387

* format code

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-06-02 18:04:56 +08:00
Linjie Chen
0432c12691 Add version control for scipy on windows (#2403) 2022-06-02 17:39:49 +08:00
Roc
dc1b8238fb add scripts (#2398) 2022-06-02 17:25:35 +08:00
Zhong Hui
d911bf2bf2 Change to pretrained weight to ernie-1.0-large-zh-cw (#2400)
* change to ernie-1.0-large-pp-zh

* change to ernie-1.0-large-zh-cw
2022-06-02 17:21:23 +08:00
Linjie Chen
f428a8c046 add version control for scipy (#2396) 2022-06-02 16:17:32 +08:00
heliqi
0a94ab4360 add triton service for ernie-3.0 (#2350)
* add triton service for ernie-3.0

* modify triton code

* Optimize the triton server code

* Optimize the triton server code
2022-06-02 16:07:31 +08:00
Severus Q
56783d90b3 update wordtag doc (#2393) 2022-06-02 14:39:54 +08:00
Haohongxiang
75735a8585 [MoE] Add MoE model pretrain and support MoE+DP (#2385)
* support moe+dp
2022-06-02 11:10:44 +08:00
yeliang2258
f982df890a fix paddle2onnx postprocess bug (#2386) 2022-06-02 04:06:59 +08:00
Jiaqi Liu
c367f8f38e Optimize clue grid search tools (#2313)
* optimize clue grid search

* update grid search

* update logger

* new warmup file

* fix grd search filename bug, optimize warmup, fix logger, fix logger extractor

* fix log

* update grid search tools

* add seed in argument list

* optimize

* update grid search according to comments

* avoid recomputing when running again.

* add num_proc args

* update readme

* update readme and extract script

* update grid search doc

* add index for readme

* fix index format
2022-06-01 22:05:02 +08:00
kev
058a43aae4 fix bug: 'dict_keys' object is not subscriptable when 'load_from_hf' in 'load_dataset' (#2364)
* fix bug: NPTag postprocess

* fix bug: 'dict_keys' object is not subscriptable when load_dataset(path)

Co-authored-by: wangkaifu <wamgkaifu@yinxiang.com>
2022-06-01 17:33:07 +08:00
Zhong Hui
9a80a9c303 change ernie-3.0-xbase-zh dropout to 0.1 (#2382) 2022-06-01 17:17:09 +08:00
吴高升
99673ad382 Fix the WR bug and recall script bug (#2381)
* Fix the WR bug and recall script bug

* Cast pad type to int64

* Cast the input type to int 64

* Cast padd to int64
2022-06-01 16:40:53 +08:00
Zhong Hui
25b41ea854 Delete pretraining_data_prepare of bert (#2379)
* delete pretraining_data_prepare

* Update README.md
2022-06-01 15:52:47 +08:00
Jiaqi Liu
3082fc07f6 Add ERNIE 3.0-Mini/Micro/Nano clue result (#2373)
* update ernie-3.0-tiny-clue-result

* black acc value

* update ernie3.0 readme

* update format of table
2022-06-01 14:32:07 +08:00
Bin Lu
e1014ee6fa update layoutxlm/modeling.py (#2285)
Co-authored-by: yingyibiao <yyb0576@163.com>
2022-06-01 00:31:59 +08:00
WangXi
1a8c099139 gpt fused attention and feedforward (#2277)
* gpt add fuse attn ffn

* add fuse args

* update doc

* use FusedFeedForward and FusedMultiHeadAttention from paddle

* pre-commit
2022-05-31 23:51:06 +08:00
yingyibiao
38efa7947d Reformat XLNet modeling.py for converting to static (#2066)
* modify xlnet

* modify xlnet

* modify xlnet

* modify xlnet
2022-05-31 23:48:38 +08:00
tianxin
e608d9056a update pipeline README (#2366) 2022-05-31 23:35:35 +08:00
yingyibiao
d34b51d66e [Docs] Update names of pretrained model weights (#2374)
* modify bert

* modify distilbert

* modify electra

* modify gpt

* modify gpt

* modify roberta
2022-05-31 23:13:37 +08:00
wawltor
910da2e308 update the parameter for the wordtag (#2375)
* update the parameter for the wordtag

* update the url of new format
2022-05-31 23:13:17 +08:00
Milen
ba69fd7e9c optimize code in ocr and mrc module (#2377)
* initial commit

* modify _calc_img_embeddings to support running without img embedding.

* remove commented code

* delete README

* refine readme.md

* change question

* modify layoutxlm to support traing without image embedding

* modify _calc_img_embeddings in layoutxlm to support training without img_embeddings

* modify _calc_img_embeddings in layoutxlm to support training without img_embeddings

* refine .gitignore

* refine Rerank with pre-commit

* refine Extraction with pre-commit

* refine code and readme details

* refine coding

* refine code style about imports

* refine README

* set CUDA_VISIBLE_DEVICES 0

* refine code style

* refine readme

* refine readme

* delete ocr parsing file

* refine readme

* refine readme

* refine README.md

* refine readme

* refine readme

* refine readme

* optimize ocr and mrc module

* refine code style

* set params with argparse

* rename max_seq_length to max_seq_len

Co-authored-by: yingyibiao <yyb0576@163.com>
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-05-31 22:46:17 +08:00
heliqi
d5bd2d9b5a fix token_cls postprocess bug (#2376) 2022-05-31 22:16:21 +08:00
Zhong Hui
3b3f09b979 add ernie-1.0-large-zh (#2372) 2022-05-31 20:37:28 +08:00
Linjie Chen
8c86f33dd0 Add deploy for UIE (#2307)
* Add deploy for UIE

* add paddle inference

* add infer

* add onnxruntime predictor for taskflow

* remove unused file

* Update predictor

* Update predictor

* Update README.md

* fix codestyle

* fix codestyle

* update num_threads default value

* update tokenizer

* update tokenizer

* Update README.md

* Update README.md and remove num_threads
2022-05-31 20:31:10 +08:00
Guo Sheng
d0bbb9070d Update paddle version compare for DataLoader patch. (#2362) 2022-05-31 13:15:00 +08:00
Jiaqi Liu
47b32efb86 fix couplet windows dtype bug (#2351) 2022-05-30 13:04:10 +08:00
Milen
4a6b26c14b refine readme (#2310)
* initial commit

* modify _calc_img_embeddings to support running without img embedding.

* remove commented code

* delete README

* refine readme.md

* change question

* modify layoutxlm to support traing without image embedding

* modify _calc_img_embeddings in layoutxlm to support training without img_embeddings

* modify _calc_img_embeddings in layoutxlm to support training without img_embeddings

* refine .gitignore

* refine Rerank with pre-commit

* refine Extraction with pre-commit

* refine code and readme details

* refine coding

* refine code style about imports

* refine README

* set CUDA_VISIBLE_DEVICES 0

* refine code style

* refine readme

* refine readme

* delete ocr parsing file

* refine readme

* refine readme

* refine README.md

* refine readme

* refine readme

* refine readme

Co-authored-by: yingyibiao <yyb0576@163.com>
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-05-26 20:02:13 +08:00
Zhong Hui
54115c9e0f [ERNIE-2.0] Add ernie-2.0-base-zh ernie-2.0-large-zh (#2279)
* add ernie-2.0-base-zh ernie-2.0-large-zh

* fix ernie xbase.
2022-05-26 19:59:08 +08:00
Linjie Chen
25acac7f64 fix padding for 1-D array (#2333) 2022-05-26 19:47:24 +08:00
ShenLiang
7c3a7e4e3b [GPT-3][dygraph] Fix pipeline in new dygraph (#2314)
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-05-26 16:29:14 +08:00
Noel
f08ad860fe [uie] update uie-medical-base parameter (#2327)
* [uie] update uie-medical-base parameter

* [uie] update uie-medical-base link
2022-05-26 15:28:48 +08:00
Linjie Chen
ea2925d2aa fix typos (#2322) 2022-05-26 14:02:40 +08:00
yeliang2258
81bb1e7915 add onnx model support in infer.py (#2319) 2022-05-26 11:07:56 +08:00
Jack Zhou
3e76bb1f69 Fix the error when using AutoTokenizer to load ernie model (#2315) 2022-05-25 22:38:42 +08:00
Linjie Chen
1c3472a4af fix dimension conversion (#2312) 2022-05-25 18:25:03 +08:00
Linjie Chen
2e1b4d2d40 Update negative examples generation strategy (#2304)
* Update negative examples generation

* remove uie-medical-base
2022-05-25 15:33:17 +08:00
yujun
aebd26eb21 [NEW Model] Add GAU-alpha model (#2088)
* add gau_alpha model

* a.shape[-2] -> paddle.shape(a)[-2]

* update token type id

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-05-25 15:20:34 +08:00
gongenlei
a1df427c5b add ErnieMForMultipleChoice (#2293) 2022-05-24 23:27:18 +08:00
Jiaqi Liu
461fc20d9c fix clue chid log bug (#2298) 2022-05-24 12:51:53 +08:00
Yantao
c21d13ea43 doc: fix typo in README_cn.md (#2299)
fix one typo in README_cn.md
Python百余被 -》 Python百余倍
2022-05-24 12:50:38 +08:00
lilong12
b19c8e449f [Benchmark] Modify the batch size to consistent with other configurations (#2296) 2022-05-24 10:51:45 +08:00
Linjie Chen
a5f91d8c37 Update negative example generation method for UIE (#2264)
* Update negative example generation method

* Update comments

* Update doccano.md

* Update READMD.md

* Update README.md

* Update README.md

* Update README.md

* remove uie-medical-base

* Compatible with doccano >= 1.6.2

* Update args
2022-05-24 09:59:38 +08:00
liu zhengxi
5d2cfd49ac add bs64 fp16 & fp32 benchmark (#2291) 2022-05-23 21:11:49 +08:00
Jiaqi Liu
76b56f3967 Make CLUE benchmark run automatically (#2229)
* make clue class auto run

* make mrc task run automatically

* fix code styke

* optimize running time

* add extract script

* add clue auto run

* add grid search readme

* fix grid search bug

* add ppminilm qa and multiple choice class

* fix cmrc launch bug

* delete useless file

* rename file  name

* fix print error

* delete useless script

* fix extract result

* update readme

* update dataset process

* fix cache argmument
2022-05-23 20:58:35 +08:00
Milen
89e93cc7a1 refine readme (#2292)
* initial commit

* modify _calc_img_embeddings to support running without img embedding.

* remove commented code

* delete README

* refine readme.md

* change question

* modify layoutxlm to support traing without image embedding

* modify _calc_img_embeddings in layoutxlm to support training without img_embeddings

* modify _calc_img_embeddings in layoutxlm to support training without img_embeddings

* refine .gitignore

* refine Rerank with pre-commit

* refine Extraction with pre-commit

* refine code and readme details

* refine coding

* refine code style about imports

* refine README

* set CUDA_VISIBLE_DEVICES 0

* refine code style

* refine readme

* refine readme

* delete ocr parsing file

* refine readme

* refine readme

* refine README.md

Co-authored-by: yingyibiao <yyb0576@163.com>
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-05-23 20:50:40 +08:00
lilong12
790cd014dc [Benchmark] Keep the benchmark script names to be consistent with the run mode (#2286) 2022-05-23 16:54:00 +08:00
ZeyuChen
8bea40f836 Update README and setup.py 2022-05-23 13:27:59 +08:00
ZeyuChen
a3a8321747 Update README and setup.py 2022-05-23 13:19:10 +08:00
ZeyuChen
2a994320e3 Optimize Chinese README 2022-05-22 16:17:49 +08:00
lilong12
b02f6c615f update (#2278) 2022-05-20 20:08:38 +08:00
liu zhengxi
2453f2fc5f set shuffle false (#2270) 2022-05-20 20:02:06 +08:00
Jiaqi Liu
3aa2c30f2c fix compress trainer export (#2276) 2022-05-20 20:01:31 +08:00
lilong12
ac08a5b7fd Modify some benchmark configurations (#2269) 2022-05-20 17:05:51 +08:00
Zhong Hui
b114842121 Add ernie xbase model. (#2262) 2022-05-20 15:56:06 +08:00
Jiaqi Liu
4d14ab7209 add ERNIE3.0-Mini/Micro/Nano models (#2267) 2022-05-20 15:55:03 +08:00
gongenlei
7d48acd907 adapt to new tokenizer (#2261) 2022-05-20 10:48:43 +08:00
liu zhengxi
6ac63220c7 fix deploy (#2266) 2022-05-20 10:46:27 +08:00
WangXi
ee5aa26331 [GPT-3] Add gpt-3 dist inference demo scripts. (#2265) 2022-05-20 10:41:41 +08:00
Noel
5773fa2d45 Merge pull request #2263 from LemonNoel/fix_electra
[electra] Fix do_lower_case attribute error
2022-05-20 10:15:17 +08:00
Noel
1e18e09f8d Merge branch 'develop' into fix_electra 2022-05-20 09:59:59 +08:00
Huijuan Wang
3e55cb4656 [electra] fix do_lower_case attribute error 2022-05-19 22:33:52 +08:00
Zeyu Chen
ad73c59af8 Update README.md 2022-05-19 20:17:13 +08:00
Zeyu Chen
6716b91220 Update README_cn.md 2022-05-19 19:07:12 +08:00
Zeyu Chen
f917e188ae Switch to Chinese README 2022-05-19 18:48:57 +08:00
Zeyu Chen
f942c42085 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2022-05-19 18:39:41 +08:00
Zeyu Chen
da68bd43be Update README 2022-05-19 18:39:36 +08:00
lilong12
e672bb4528 Add benchmark for hybrid parallelism gpt-3 in static mode (#2222)
* add hybrid benchmark for static gpt-3

* add hybrid benchmark for static gpt-3

* delete unused file

* update README

* update

* add run script

* update README

* update

* update

* update

* update

* update

* update
2022-05-19 18:27:38 +08:00
lilong12
cd43cc6f3a [GPT-3] Typo fix update (#2250) 2022-05-19 17:40:51 +08:00
Linjie Chen
1de6933c99 Update doccano.md (#2239)
* Update doccano.md

* Update doccano.md

* Update doccano.md

* Update doccano.md
2022-05-19 15:51:23 +08:00
yingyibiao
1f5bc06c99 Update readthedocs API structure (#2242)
* update readthedocs API structure

* add english docs

* Delete paddlenlp.datasets.rst

* add

* delete
2022-05-19 15:51:02 +08:00
WangXi
e3aee9bd38 [GPT-3] Support tensor model parallel in static graph. (#2245)
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-05-19 15:50:25 +08:00
wawltor
83f37a17c8 Update README.md 2022-05-19 15:42:50 +08:00
qingqing01
778049750f [GPT-3] Support generation code for GPT-3 in static graph. (#2188)
* Support GPT-3 generation in static graph
* Support batch generation and fix code style
2022-05-19 15:10:51 +08:00
yingyibiao
1fdf30828c fix deadlinks (#2241) 2022-05-19 11:32:34 +08:00
Zhong Hui
1ed25f223f [DOC] fix dead links. (#2240) 2022-05-19 11:26:33 +08:00
liu zhengxi
c2e5cc8dcf update (#2235) 2022-05-19 10:41:52 +08:00
Milen
172389f87a add Doc-VQA applications (#2214)
* initial commit

* modify _calc_img_embeddings to support running without img embedding.

* remove commented code

* delete README

* refine readme.md

* change question

* modify layoutxlm to support traing without image embedding

* modify _calc_img_embeddings in layoutxlm to support training without img_embeddings

* modify _calc_img_embeddings in layoutxlm to support training without img_embeddings

* refine .gitignore

* refine Rerank with pre-commit

* refine Extraction with pre-commit

* refine code and readme details

* refine coding

* refine code style about imports

* refine README

* set CUDA_VISIBLE_DEVICES 0

* refine code style

* refine readme

* refine readme

* delete ocr parsing file

* refine readme

Co-authored-by: yingyibiao <yyb0576@163.com>
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-05-19 00:08:38 +08:00
Zeyu Chen
1d433b1cce Update README_en.md 2022-05-18 23:39:08 +08:00
Zeyu Chen
acf3832733 Update README 2022-05-18 23:34:21 +08:00
Zeyu Chen
e0b74d18d1 Update README 2022-05-18 23:24:38 +08:00
Zeyu Chen
75922448cd Update README 2022-05-18 23:11:20 +08:00
Linjie Chen
12f60e322b replace deprecated params for nptag (#2233) 2022-05-18 22:07:50 +08:00
yingyibiao
cd0b6988db Fix deadlinks (#2230)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-05-18 22:07:27 +08:00
liu zhengxi
a847d88bdf Fix deadlink (#2231)
* fix ddl

* fix link
2022-05-18 22:05:55 +08:00
Zeyu Chen
cc8134555b Update README 2022-05-18 21:30:11 +08:00
Jiaqi Liu
52c72730a5 Add UER RoBERTa L6-H768 CLUE Result (#2226)
* add uer clue result

* fix model order in table

* fix model name

* fix dead link

* fix model name

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-05-18 21:02:48 +08:00
liu zhengxi
bac1d83c31 [Bug Fix] Fix benchmark caused by recently dir and requirements change (#2228)
* fix benchmark

* more steps for bigru crf
2022-05-18 20:58:17 +08:00
Linjie Chen
86d9837c12 Update README.md and taskflow.md for UIE (#2217)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
2022-05-18 19:58:27 +08:00
lilong12
bf811e1c32 use executor for mp (#2223) 2022-05-18 18:34:58 +08:00
Zhong Hui
ec3c633c96 [Pretrained weight] Change ernie-1.0 to ernie-1.0-base-zh (#2224)
* ernie-1.0 -> ernie-1.0-base-zh

* change name of some readme.
2022-05-18 17:40:48 +08:00
Zeyu Chen
953d17837f Update README 2022-05-18 17:38:10 +08:00
Zeyu Chen
11e4743aad Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2022-05-18 17:38:02 +08:00
Zeyu Chen
a65de1d757 Update README 2022-05-18 17:36:59 +08:00
liu zhengxi
32f0aebe18 mv tp dp (#2218) 2022-05-18 16:28:10 +08:00
Zeyu Chen
1115a70164 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2022-05-18 15:35:24 +08:00
Zeyu Chen
9dac2dc5fe Update README 2022-05-18 15:34:53 +08:00
Jiaqi Liu
928ef683a4 Fix CLUE bug (#2215)
* fix clue

* add max_steps params
2022-05-18 15:32:02 +08:00
yingyibiao
eb4a63027e fix bugs (#2216) 2022-05-18 15:22:31 +08:00
Jack Zhou
78afe1d250 Add commit id when packaging (#2211) 2022-05-18 14:44:06 +08:00
Milen
453aa70b4b modify _calc_img_embeddings in layoutxlm to support training without img_embeddings (#2208)
* modify layoutxlm to support traing without image embedding

* modify _calc_img_embeddings in layoutxlm to support training without img_embeddings

* modify _calc_img_embeddings in layoutxlm to support training without img_embeddings

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-05-18 13:42:42 +08:00
lugimzzz
e7bb926f3c fix bug while opening vocab.bpe on windows (#2209) 2022-05-18 13:32:54 +08:00
lugimzzz
db44190ab9 Add ERNIE 3.0 AI Studio tutorial (#2196)
* add_ernie3.0_tutorial_link

* add_ernie3.0_tutorial

* add_ernie_3.0_tutorials

* add_ernie_3.0_aistudio_tutorials

* add_ernie_3.0_tutorial_notebook
2022-05-18 12:53:39 +08:00
Roger
5a07b12784 [duuie] fix max_seq_len bug in duuie code (#2207)
* [duuie] fix max_seq_len bug in duuie code
* add kwargs for t5-bert-tokenizer
* use add_special_tokens=False return_token_type_ids=None for span/name encode

* [duuie] fix max_seq_len bug in duuie code
* add kwargs for t5-bert-tokenizer
* use add_special_tokens=False return_token_type_ids=None for span/name encode

* [duuie] fix max_seq_len bug in duuie code
* add kwargs for t5-bert-tokenizer
* use add_special_tokens=False return_token_type_ids=None for span/name encode
2022-05-18 12:52:32 +08:00
Jack Zhou
7ba4523395 Add decoder module for faster tokenizers (#2204)
* Add wordpiece decoder cpp impl

* Add decode api in tokenizer

* Add decode_batch and decode python api

* Add decoder property

* Fix decode, decode_batch pybind

* Add _decoder for faster_tokenizer

* Fix decoder bug

* pointer to reference
2022-05-18 12:50:21 +08:00
lilong12
d9431a8026 [GPT-3] Fix saved pp program (#2195) 2022-05-18 10:24:59 +08:00
Linjie Chen
7ca4114d95 fix nptag preprocess bug (#2199) 2022-05-18 00:24:40 +08:00
tianxin
3ff2bdf86c fix Code Style (#2202)
* parse args from command_line

* fix Code Style
2022-05-18 00:24:18 +08:00
tianxin
63fcabed34 parse args from command_line (#2201) 2022-05-17 22:11:05 +08:00
Zeyu Chen
2f836d3d99 Update README 2022-05-17 21:29:29 +08:00
Zeyu Chen
ecb3abcab5 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2022-05-17 21:14:29 +08:00
Zeyu Chen
f1ebb09480 Update README 2022-05-17 21:13:27 +08:00
Zeyu Chen
f90a9bfdde Update English README 2022-05-17 21:01:19 +08:00
Noel
cc4932e2da [cblue] move cblue to ernie-health directory (#2197) 2022-05-17 20:27:56 +08:00
Zeyu Chen
2e1f4be8e8 switch to English README 2022-05-17 20:07:37 +08:00
Zeyu Chen
52a83248de Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2022-05-17 20:07:00 +08:00
Zeyu Chen
90191811dc Update README and add language switch README 2022-05-17 20:06:33 +08:00
Zeyu Chen
853f7c1241 Update README and add language switch README 2022-05-17 20:05:41 +08:00
Zeyu Chen
9686c3bfa6 Update README and add language switch README 2022-05-17 20:05:27 +08:00
DanielYang
02ebee1e48 Update README_en.md 2022-05-17 19:35:36 +08:00
Zeyu Chen
9d8df779f8 Update README 2022-05-17 19:19:20 +08:00
Zeyu Chen
e93523da24 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2022-05-17 18:40:00 +08:00
Zeyu Chen
61774d5441 Update README 2022-05-17 18:39:33 +08:00
lilong12
6a36a51c53 [GPT-3] fix bug for hybrid training for gpt-3 static mode (#2190)
* fix epoch compute for pp

* add note and early_stop
2022-05-17 17:51:21 +08:00
Linjie Chen
5e2e27300d Support export the doccano file in JSONL format (#2187)
* Support export the doccano file in JSONL format

* add uie medical base

* Update model weights
2022-05-17 17:46:01 +08:00
Jiaqi Liu
1d2f32b538 Update TinyBERT modeling and CLUE results (#2159)
* tinybert support multiple choice and questionanswering

* fix tinybert, position id

* add tinybert result

* Add roformer small clue result

* fix black

* fix black

* fix doc

* fix model name

* fix model name

* fix model name
2022-05-17 16:03:13 +08:00
Zhong Hui
33a08ed31d [FIX] Quick fix gpt missing max_seq_len (#2192)
* fix gpt compile.

* bugfix
2022-05-17 16:01:49 +08:00
Jack Zhou
9b1584e20c Move faster_ernie to faster_tokenizers directory (#2189)
* move faster_ernie to faster_tokenizers

* keep the faster_tokenizer performance
2022-05-17 16:01:21 +08:00
Zhong Hui
d23267adf1 fix gpt compile. (#2191) 2022-05-17 15:45:01 +08:00
吴高升
5ee1c6c19e Update semantic search to faiss (#2180)
* Update semantic search to faiss

* Update semantic search
2022-05-17 11:44:34 +08:00
yeliang2258
2128037d73 remove useless title (#2183) 2022-05-17 10:26:03 +08:00
liu zhengxi
fbd0543df0 [Bug Fix] Fix benchmark caused by moving BERT/GPT to model_zoo (#2166)
* fix benchmark caused by model_zoo
2022-05-17 09:47:04 +08:00
Zeyu Chen
94538b3aa2 Update README.md 2022-05-16 23:44:26 +08:00
Jiaqi Liu
2b6ba44e51 Update ERNIE 3.0 readme (#2167)
* update readme

* update ernie 3.0  readme, add compress api doc

* add doc for compression api
2022-05-16 23:15:46 +08:00
Linjie Chen
27033792a4 Update README.md (#2177)
* Update README.md

* fix codestyle

* fix codestyle

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: zhoushunjie <zhoushunjie@baidu.com>
2022-05-16 23:14:52 +08:00
tianxin
e4e0baa047 Update Pipelines README (#2175)
* Update README

* Update Pipelines README
2022-05-16 22:21:09 +08:00
Zeyu Chen
f08343f586 Remove faster forlder in examples 2022-05-16 21:47:36 +08:00
Zeyu Chen
912edcadd2 remove stale changelog 2022-05-16 20:56:14 +08:00
Zeyu Chen
72d9d1ba1f Update README.md 2022-05-16 20:34:19 +08:00
wawltor
5be65fbee8 Update README.md 2022-05-16 20:08:16 +08:00
DanielYang
841a864d84 Update README.md 2022-05-16 19:37:48 +08:00
Tong Zhu(朱桐)
9765848dbd Optimize schema construction for UIE Task (#2170)
- remove import but unused os lib
- use `_schema_tree` attribute to displace multiple times of schema tree construction
- remove `schema_tree` arg in `_multi_stage_predict`
- add early check & return in `_multi_stage_predict`
- rename `id` var in `_multi_stage_predict` to `idx` to avoid mixing with python built-in funcs
- change `_build_tree` func to python `classmethod`

Co-authored-by: Linjie Chen <40840292+linjieccc@users.noreply.github.com>
2022-05-16 19:34:05 +08:00
Zeyu Chen
8294fb409a Update README 2022-05-16 18:36:29 +08:00
chenxiaozeng
44659369bf Update taskflow.md (#2173)
update group QR code.
2022-05-16 18:34:44 +08:00
tianxin
6d1a6f06f0 Update README (#2172) 2022-05-16 18:21:11 +08:00
tianxin
0dcf0052b2 add Pipelines into Applications (#2108)
* add Applications/experimental/pipelines

* add README.md

* Update README

* fix some review comments

* update ui/webapp_semantic_search.py

* update README

* add dense_qa README

* add utils/offline_ann.py

* Update README

* add semantic_search README

* Update README

* update sematic_search

* fix code-style

* update README

* Fix Coding Style
2022-05-16 17:51:21 +08:00
heliqi
e6dff46fc2 ERINE 3.0 deploy update (#2169)
* modify name of task

* use faster tokenizer
2022-05-16 17:49:41 +08:00
Jack Zhou
b60760d60e Add faster tokenizers cpp demo (#2168)
* Add dependency of pybind tokenizers

* Fix some cmake

* move libcore_tokenizers.cc

* Add faster tokenizers cpp demo

* Add EncodeInputString

* Add ernie vocab file downloading for demo

* Fix version

* Add FasterTokenizers CPP Demo

* Fix the head of table
2022-05-16 17:07:28 +08:00
Zeyu Chen
89abb49635 Update README 2022-05-16 17:00:09 +08:00
Jiaqi Liu
6d62762bef Update ERNIE 3.0 readme (#2161)
* fix table

* update config

* update readme

* update config info

* update description
2022-05-16 16:21:10 +08:00
yeliang2258
c600f74aa2 Add FP16 support in Paddle2ONNX deploy (#2163)
* paddle2onnx deploy add fp16 support

* update doc

* fix doc

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-05-16 16:20:39 +08:00
Zeyu Chen
d92f2ec1f1 add English README 2022-05-16 16:14:19 +08:00
Zeyu Chen
f2085e65d6 Update README 2022-05-16 15:25:17 +08:00
Zeyu Chen
8fee6a8c78 Update README 2022-05-16 15:20:47 +08:00
Jiaqi Liu
1b1b3b6058 Fix model table typo (#2160) 2022-05-16 14:33:46 +08:00
Zeyu Chen
5528ec4027 Update README 2022-05-16 13:55:56 +08:00
Jiaqi Liu
6f378fd475 Update ERNIE 3.0 README (#2142)
* update ERNIE 3.0 doc

* fix typo

* update readme, fix clue

* update README, prune precision

* update readme

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-05-16 13:09:43 +08:00
DanielYang
9028d565c1 Update README.md 2022-05-16 12:29:15 +08:00
chenxiaozeng
e806146b77 Update README.md (#2155)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-05-16 12:18:41 +08:00
Zeyu Chen
329f6a9f6b Update README.md 2022-05-16 12:15:23 +08:00
Zeyu Chen
3a34cce669 Add ERNIE 3.0 README 2022-05-16 12:09:45 +08:00
Zeyu Chen
ce1cc31f64 Remove community folder 2022-05-16 11:42:50 +08:00
yeliang2258
03303630a1 fix doc in paddle2onnx (#2152) 2022-05-16 10:32:34 +08:00
Guo Sheng
d5420e226e Remove faster_generation demo dir from packages. (#2154) 2022-05-16 10:32:09 +08:00
Guo Sheng
d66c83283b Move faster_generation to top level. (#2150)
* Move faster_generation to top level.

* Update links in README of faster_generation.

* Update README of faster_generation and PLATO-XL.

* Update plato_xl_sample.py

* Move plato-xl to model_zoo.
2022-05-16 10:21:42 +08:00
yeliang2258
f21829c4be Paddle2ONNX deploy script (#2149)
* add paddle2onnx deploy script

* update doc

* update doc

* simplify

* update doc

* revert doc

* update doc

* update paddle2onnx doc

* update outer doc

* update paddle2onnx doc

* remove requirments in doc

* update paddle2onnx doc

* update

* paddle2onnx doc
2022-05-16 00:23:43 +08:00
heliqi
ba57969dbc ERNIE 3.0 serving deploy update (#2146)
* optimized code

* optimized code

* optimized code2

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-05-15 16:10:20 +08:00
yeliang2258
9f00755ff7 fix python deploy (#2148)
* fix python deploy

* probs and logits

* update

* revert
2022-05-15 16:09:13 +08:00
yeliang2258
d58a221338 Ernie3.0 python deploy update dev (#2145)
* update doc and infer script

* update doc

* add toc

* update doc to remove quantize data

* update infer.py

* update doc

* udpate ernie3.0 and python deploy doc

* update ernie3.0 README.md

* update doc and ernie_predictor

* update code and doc

* add notes

* change enable tp use
2022-05-15 13:52:02 +08:00
Guo Sheng
a389a72c56 Add model parallel for PLATO (#1987)
* Add mp for plato

* Add ParallelParam in decoding_beamsearch.h

* Add parallel utils.

* Begin to add tensor parallel in decoding_sampling.

* Add seed for plato mp.
Add init wraper for plato mp.

* Make PLATO tensor parallel run correctly.

* Fix copy_data

* Use transpose_general_kernelLauncher in open_decoder.h

* Fix transpose_general_kernelLauncher when using half.

* Add function declaration for transpose.

* Add PLATO-XL model parallel example.

* Use DataCollator for plato-xl.
Make default tensor para size adapt to world size.

* Update plato-xl mp example.

* Update PLAOT-XL README.

* Update PLATO-XL example and README.

* Update PLATO-XL speed table.
2022-05-13 22:20:04 +08:00
Zeyu Chen
69a8c79586 Update README.md 2022-05-13 20:34:50 +08:00
Zhong Hui
e158e13a33 fix deaflinks (#2137) 2022-05-13 20:10:07 +08:00
Linjie Chen
a3ac5a95d9 Update UIE model and fix NPTag preprocess bugs (#2138)
* Update UIE model and taskflow.md

* Update taskflow.md

* Update taskflow.md

* Update README.md
2022-05-13 18:07:46 +08:00
Jack Zhou
1ab0e48862 Add faster tokenizers cpp package (#2139)
* Fix package name

* Add comment

* Add cpp lib install

* remove pybind headers

* Add ErnieFasterTokenizer

* Add third party include headers
2022-05-13 18:06:38 +08:00
Jiaqi Liu
8ee2eb9b2e Update ERNIE 3.0 README (#2135)
* update ernie-3.0-readme

* fix dir

* update precision data

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-05-13 17:44:54 +08:00
Zeyu Chen
380a1db54b Update README 2022-05-13 17:37:22 +08:00
Zeyu Chen
ed68f994e8 update README 2022-05-13 17:28:20 +08:00
Zeyu Chen
d0a5ea9691 move uie to model zoo 2022-05-13 16:33:18 +08:00
Zhong Hui
361d91cbcb [BugFix] Fix model zoo relative import (#2130)
* fix as relative import

* add soft link

* refine

* copy data tools to model

* fix gpt-3

* refine gpt readme.

* delete unused dataset utils code

* delete some code.

* softlink

* move data_tools to ernie.

* fix
2022-05-13 16:14:47 +08:00
yingyibiao
6de32e519b rename download_check command (#2134) 2022-05-13 15:37:03 +08:00
Noel
103241b3eb Modify the default path of DuEE-fin (#2132) 2022-05-13 13:45:42 +08:00
Jiaqi Liu
63ab91783b fix ernie 3.0 infer length bug (#2131) 2022-05-13 11:52:55 +08:00
Zeyu Chen
d405b2d85a move selected model to model zoo 2022-05-13 00:10:30 +08:00
Allen Guo
d9b2e10687 fix ProgressBar quiting error (#2123) 2022-05-13 00:10:02 +08:00
Zhong Hui
7dde5b138e [PreTraining] Refine ernie-1.0 document. (#2117)
* add some document for pretraining.

* refine ernie-1.0 document.

* refine ernie-1.0 document.

* remove pre-train document.

* Update README.md

* add infer script.

* refine

* remove h5py requirement

* move export to paddlenlp.transformers.export_model

* move export to paddlenlp.transformers.export_model

* fix docs.

* fix as reviews.
2022-05-12 23:39:52 +08:00
Roger
2730d3ce31 Optimize code for DuUIE Baseline (#2120)
* Clean Code for DuUIE
* Remove `DynamicMultiTaskSSIGenerator`, using DynamicSSIGenerator for all Data Collator
* Rename `negative_sampler` to `ssi_generator`and Rewrite  __call__ for each Data Collator
* Read training instances from train config and add negative instance for DuIE
* Add more comments and rename variables in seq2struct/utils.py evaluation/seq2record.py for better understanding
* Remove unuse arguments and tqdm code in run_seq2struct.py, add grad_clip, change default value of some argument as README.md
* Change BaseStructureMarker as dataclass

* Clean Code for DuUIE
* Remove `DynamicMultiTaskSSIGenerator`, using DynamicSSIGenerator for all Data Collator
* Rename `negative_sampler` to `ssi_generator`and Rewrite  __call__ for each Data Collator, Reduce GPU Memory to 50%
* Read training instances from train config and add negative instance for DuIE
* Add more comments and rename variables in seq2struct/utils.py evaluation/seq2record.py for better understanding
* Remove unuse arguments and tqdm code in run_seq2struct.py, add grad_clip, change default value of some argument as README.md
* Change BaseStructureMarker as dataclass

* Clean Code for DuUIE
* Remove `DynamicMultiTaskSSIGenerator`, using DynamicSSIGenerator for all Data Collator
* Rename `negative_sampler` to `ssi_generator`and Rewrite  __call__ for each Data Collator, Reduce GPU Memory to 50%
* Read training instances from train config and add negative instance for DuIE
* Add more comments and rename variables in seq2struct/utils.py evaluation/seq2record.py for better understanding
* Remove unuse arguments and tqdm code in run_seq2struct.py, add grad_clip, change default value of some argument as README.md
* Change BaseStructureMarker as dataclass

* Clean Code for DuUIE
    * Remove `DynamicMultiTaskSSIGenerator`, using DynamicSSIGenerator for all Data Collator
    * Rename `negative_sampler` to `ssi_generator`and Rewrite  __call__ for each Data Collator, Reduce GPU Memory to 50%
    * Read training instances from train config and add negative instance for DuIE
    * Add more comments and rename variables in seq2struct/utils.py evaluation/seq2record.py for better understanding
    * Remove unuse arguments and tqdm code in run_seq2struct.py, add grad_clip, change default value of some argument as README.md
    * Change BaseStructureMarker as dataclass

* Clean Code for DuUIE Baseline
    * Remove `DynamicMultiTaskSSIGenerator`, using DynamicSSIGenerator for all Data Collator
    * Rename `negative_sampler` to `ssi_generator`and Rewrite  __call__ for each Data Collator, Reduce GPU Memory to 50%
    * Read training instances from train config and add negative instance for DuIE
    * Add more comments and rename variables in seq2struct/utils.py evaluation/seq2record.py for better understanding
    * Remove unuse arguments and tqdm code in run_seq2struct.py, add grad_clip, change default value of some argument as README.md
    * Change BaseStructureMarker as dataclass

* fix comment in uie/seq2struct/utils.py

Co-authored-by: Linjie Chen <40840292+linjieccc@users.noreply.github.com>
2022-05-12 22:37:04 +08:00
yeliang2258
d83be59378 Ernie3.0 python deploy dev (#2077)
* add python deploy scripy

* update readme

* remove useless file

* udpate code

* remove useless print

* update dynamic quantize

* update daynamic quantize func

* mv python to deploy folder

* add use_inference in infer_backend

* add optimize choice

* fix doc and add infer_cpu infer_gpu

* remove useless file

* update doc

* update doc for quantize model

* fix doc

* update docs

* fix doc and add set_dynamic_shape fuc

* update ernie_predictor and doc

* update doc and paddle2onnx api

* update ernie_predictor, use all cpu

* add quantize tool doc link

* update doc and use c api of paddle2onnx

* fix path bug
2022-05-12 20:44:28 +08:00
Zhong Hui
32ef8f84ba [DOC] Add trainer doc on index.rst (#2126)
* Update index.rst
2022-05-12 19:09:49 +08:00
Linjie Chen
8e29ffb648 optimize model initialization for UIE (#2119)
* optimize model initialization for UIE

* Update taskflow.md

* Update taskflow.md

* Update taskflow.md

* Update README.md

* Update README.md

* Update README.md

* Update evaluation

* Update evaluation

* delete unused code
2022-05-12 19:07:27 +08:00
yujun
5ec8d131f6 update roformerv2 tokenizer's token_type_id (#2127) 2022-05-12 18:25:33 +08:00
Jack Zhou
a6d0fdf2d3 Improve OMP performance (#2125)
* Add condition for openmp

* Add condition of creating omp threads to improve performance

* Add comments to explain why setting condition of omp
2022-05-12 18:12:54 +08:00
yingyibiao
ac27a26a5f Modify bert_japanese tokenizer (#2124)
* modify bert_japanese tokenizer

* modify bert_japanese tokenizer

* modify bert_japanese tokenizer
2022-05-12 15:41:09 +08:00
Jiaqi Liu
5ebb0a7c9e Fix ernie-3.0-compress-bug (#2113)
* fix ernie-3.0-compress-bug

* infer support fp16
2022-05-11 23:21:35 +08:00
Jiaqi Liu
f1c259dafc Add README (#2121)
* add ernie 3.0 readme

* update readme
2022-05-11 23:16:02 +08:00
heliqi
187ef1e10a Add serving deploy for ernie 3.0 seq_cls and token_cls (#2073)
* add deploy serving for cls

* add deploy serving for cls

* add deploy serving for token

* add deploy serving for token

* Optimize code
2022-05-11 23:02:15 +08:00
Guo Sheng
3c5d7c577b Patches for DataLoader/BatchSamper to allow using other than paddle.io.Dataset in Paddle version lower than 2.3 (#2118) 2022-05-11 20:07:10 +08:00
Zhong Hui
2f8f701fb2 [BugFIx] Fix ernie gen from_pretrained for exists weights. (#2107) 2022-05-11 18:02:44 +08:00
yingyibiao
7d21d7b3bf Update README (#2109)
* Update README

* Update README.md

* Update README.md
2022-05-11 16:40:40 +08:00
Jack Zhou
ea837b83fe Fix truncation and padding (#2111)
* fix truncation and padding

* Fix some padding bug
2022-05-11 16:33:43 +08:00
Guo Sheng
bef2d2bbf1 Replace logger.warn with warnings.warn. (#2114) 2022-05-11 15:23:44 +08:00
Noel
c481083c2a Merge pull request #2102 from LemonNoel/speech-use_api
[speech] use api to calculate metric
2022-05-11 13:06:00 +08:00
Noel
6ec5afb6d6 Merge branch 'develop' into speech-use_api 2022-05-11 12:06:00 +08:00
smallv0221
cfd275ea91 freeze datasets version (#2110) 2022-05-11 11:31:43 +08:00
Jack Zhou
b15f5b290f Fix return offsets mapping (#2105) 2022-05-11 11:17:16 +08:00
Noel
5bd04733fb Merge branch 'develop' into speech-use_api 2022-05-11 10:26:21 +08:00
Allen Guo
a29ffed77f [IPU] bert-base use paddle branch release/2.3 (#2081)
* use branch release/2.3

* fix readme

* update custom_nll_loss attr type
2022-05-10 21:14:37 +08:00
yingyibiao
24a0abb654 Update readthedocs (#2099)
* update readthedocs

* Update paddlenlp.datasets.rst

* fix jinja2 version to 3.0.3
2022-05-10 21:12:54 +08:00
yujun
df18bd1f76 update roformer_v2_chinese_char_base tokenizer url (#2103) 2022-05-10 21:10:43 +08:00
Jack Zhou
d2a4ca5cc3 fix faster_tokenizers setup problem (#2104) 2022-05-10 21:10:16 +08:00
Huijuan Wang
1ed1693842 [speech] remove preprocess for cls 2022-05-10 21:04:55 +08:00
Linjie Chen
4014cb3c4f fix bug: UIE model cannot be load twice in one process (#2098) 2022-05-10 19:21:40 +08:00
yujun
8a424df650 [NEW Model] Add RoFormerV2 (#2056)
* add roformer v2 model

* add max_position_embeddings

* support static export model

* fix typo and update seqlen

* update RoFormerv2Model doc

* only support 2D attention mask

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-05-10 19:03:22 +08:00
smallv0221
8bf21c1b35 Fix Prophetnet model (#1885)
* temp add word ids

* fix prophetnet model

* minor fix

* fix prophetnet

* minor fix

* minor fix

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-05-10 18:45:40 +08:00
Jack Zhou
f7aad8893c Support Auto FasterTokenizer (#2097)
* Add is_faster_tokenizers_available

* add tokenizer_utils_faster and convert_slow_tokenizer

* update comments

* Add Ernie&Bert FasterTokeizer

* Fix batch_enocde

* Support FasterTokenizer

* update naming style

* EncodingFast->FasterEncoding;TokenizerFast->FasterTokenizer

* remove useless statements
2022-05-10 18:29:31 +08:00
Zhong Hui
57a286188f [BugFix] Fix ernie gen mode load (#2092)
* fix ernie gen
2022-05-10 18:18:16 +08:00
smallv0221
140ce172a9 fix file requirements for community tokenizers (#2101) 2022-05-10 18:11:01 +08:00
Huijuan Wang
70137aada4 [speech] use api to calculate metric 2022-05-10 17:47:23 +08:00
Jiaqi Liu
e18121c59e Support NER & QA Inference (#2076)
* support ner

* support ner

* support ner

* support qa

* update infer

* update infer

* remove hard code

* update clue readme

* update token classification
2022-05-10 16:50:55 +08:00
Jiaqi Liu
63bf2d5149 Update ERNIE 3.0 data collator usage (#2086)
* update data collator

* remove useless var name

* support models don't have token_type_ids

* support models don't have token_type_ids

* update ner fine tuning  script

* Fix arg code style
2022-05-10 16:33:20 +08:00
yujun
c7369d4b21 update roformer (#2089)
Co-authored-by: yingyibiao <yyb0576@163.com>
2022-05-10 16:14:14 +08:00
Jack Zhou
f47f430388 Improve the encode_batch performance in faster tokenizers (#2094)
* Add truncation

* Add is_pretokenized

* Remove OMP
2022-05-10 15:42:16 +08:00
Jiaqi Liu
4cf13bd9ed Update CLUE README (#2096)
* add bert, ernie result

* update table
2022-05-10 13:31:47 +08:00
Linjie Chen
24aff87513 Add UIE (#1986)
* add uie

* fix codestyle

* Update README.md

* Update README.md

* Update README.md

* Update parser

* Add tqdm for doccano convertion

* fix build prompt

* Update relation label construction

* Update README.md

* Update metric

* Update doccano file

* Update doccano converter

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update arguments

* Update README.md

* Update doccano converter

* Update comments

* Update README.md

* Update doccano for cls task

* Update README.md

* Update README.md

* Update uie finetune example

* Update README.md

* Update doccano.md

* Update doccano.md

* Update doccano.md

* Update taskflow.md

* Update taskflow.md

* Update README.md
2022-05-10 13:07:12 +08:00
Zeyu Chen
3b1d096e22 update setup.py 2022-05-09 23:26:33 +08:00
Zeyu Chen
a27afd0d45 remove education folder 2022-05-09 23:17:39 +08:00
Jack Zhou
f8f6294342 Add faster tokenizers cpp source code (#2075)
* Add faster tokenizers cpp source code

* rename tokenizers->faster_tokenizers

* Add serialize, deserialize of tokenizer

* Fix deserialize

* Add __init__.py

* Add getstate for bert normalizer

* update wordpiece
2022-05-09 23:16:39 +08:00
Jiaqi Liu
68ea6dd5c9 Add ernie-gram-zh, mengzi-bert-base clue acc (#2087) 2022-05-09 22:25:37 +08:00
Zhong Hui
44663b9d0c Fix ernie-1.0 typo (#2091) 2022-05-09 22:19:32 +08:00
吴高升
60e03a0b4a fix output_emb_size set to zero bug (#2090) 2022-05-09 21:15:18 +08:00
Zhong Hui
e387e70e7a [Trainer] Trainer opt part1 and part2 (#2040)
* refine some trainer import

* optimize some code of trainer.

* fix doc
2022-05-09 20:43:06 +08:00
yingyibiao
e91253d865 Add pre-trained model downloads logging (#2085)
* add model download statistics

* add model download statistics

* add model download statistics
2022-05-09 17:23:52 +08:00
kev
80d1136e0d fix bug: NPTag postprocess (#2070)
Co-authored-by: wangkaifu <wamgkaifu@yinxiang.com>
2022-05-08 23:04:59 +08:00
Linjie Chen
39432a2ace Update README.md (#2079) 2022-05-08 17:51:45 +08:00
smallv0221
8cb27ad829 fix compatibility for ppnimilm, skep, unifiedtransformer, gpt2 (#2063)
* upgrade tokenizer

* upgrade tokenizer

* upgrade datacollator

* minor fix

* minor fix

* fix mbart tokenizer

* minor fix

* minor fix

* minor fix

* fix compatity for autotokenizer

* fix offset mapping

* fix tokenizer doc

* fix doc

* fix tokenizer

* fix ppminilm tokenizer

* fix offset mapping

* fix tokenizer warning

* fix get_input_ids for compatibility

* add doc

* minor fix

Co-authored-by: Jiaqi Liu <709153940@qq.com>
2022-05-07 15:48:29 +08:00
Jiaqi Liu
f7b7d52e39 fix infer bug (#2072) 2022-05-07 12:59:29 +08:00
Zeyu Chen
cdd68258a4 Update setup.py 2022-05-06 17:40:22 +08:00
WJJ1995
caa386f297 Add ONNX Export (#2061)
* Add ONNX Export

* deal with comments

* deal with comments

* deal with comments
2022-05-06 13:10:11 +08:00
Jiaqi Liu
fa8fe0ef25 Add ERNIE 3.0 (#1995)
* add ernie-3.0

* remove useless import

* move compress api from paddlenlp

* support ner, qa

* move ernie 3.0  compress dir

* remove update in __init__

* remove ernie 3.0 compress dir
2022-05-05 17:29:46 +08:00
Jiaqi Liu
5765fbeb9d rename ernie 3.0 model name (#2057) 2022-05-05 13:01:35 +08:00
Jiaqi Liu
3a81aee3a9 Fix c3 predict bug (#2060)
* fix c3 predict bug

* fix c3 predict bug
2022-05-05 12:36:46 +08:00
smallv0221
793eee08ee fix tokenizer warning (#2043)
* upgrade tokenizer

* upgrade tokenizer

* upgrade datacollator

* minor fix

* minor fix

* fix mbart tokenizer

* minor fix

* minor fix

* minor fix

* fix compatity for autotokenizer

* fix offset mapping

* fix tokenizer doc

* fix doc

* fix tokenizer

* fix ppminilm tokenizer

* fix offset mapping

* fix tokenizer warning

Co-authored-by: Jiaqi Liu <709153940@qq.com>
2022-05-02 20:02:47 +08:00
Zeyu Chen
a0eac8e6b1 add transformer pretrained model zoo in root folder 2022-04-30 17:33:22 +08:00
Linjie Chen
61685f0e50 add uie-medical (#2042)
* Update schema

* add uie-medical-base
2022-04-29 19:32:08 +08:00
wawltor
5d2904a108 Merge pull request #2018 from ZHUI/ernie_dygraph_opt
[Pretraining] Optimize some log info for ernie-1.0 pretraining.
2022-04-29 19:00:42 +08:00
wawltor
862bf6e9ee Merge pull request #2041 from ZHUI/ehealth_opt
[Trainer] eHealth opt
2022-04-29 18:58:03 +08:00
Zhong Hui
3b019a6a42 ehealth opt 2022-04-29 18:52:05 +08:00
Jiaqi Liu
078dd64f8f update ernie base iflytek (#2038) 2022-04-29 18:50:11 +08:00
smallv0221
04cb1adfe2 fix offset mapping (#2039)
* upgrade tokenizer

* upgrade tokenizer

* upgrade datacollator

* minor fix

* minor fix

* fix mbart tokenizer

* minor fix

* minor fix

* minor fix

* fix compatity for autotokenizer

* fix offset mapping

* fix tokenizer doc

* fix doc

* fix tokenizer

* fix ppminilm tokenizer

* fix offset mapping
2022-04-29 18:27:14 +08:00
smallv0221
346a1c070e fix ppminilm tokenizer (#2037)
* upgrade tokenizer

* upgrade tokenizer

* upgrade datacollator

* minor fix

* minor fix

* fix mbart tokenizer

* minor fix

* minor fix

* minor fix

* fix compatity for autotokenizer

* fix offset mapping

* fix tokenizer doc

* fix doc

* fix tokenizer

* fix ppminilm tokenizer
2022-04-29 18:17:59 +08:00
liu zhengxi
676ad02714 Fix encoder & optimize performance of encoder (#1748)
* fix & promote ft encoder

* update

* rm some useless option

* refine encoder codes

* delete useless import

* update according to above comments
2022-04-29 17:29:59 +08:00
Zhong Hui
9fd7364426 Merge branch 'develop' into ernie_dygraph_opt 2022-04-29 17:29:58 +08:00
Guo Sheng
a2a8817254 Use functools to replace importlib_metadata.functools to avoid extra dependency. (#2034) 2022-04-29 16:51:55 +08:00
Jiaqi Liu
916791aee4 update clue result (#2033) 2022-04-29 15:56:58 +08:00
smallv0221
6d61877140 Fix tokenizer compatibility for taskflow (#2032)
* upgrade tokenizer

* upgrade tokenizer

* upgrade datacollator

* minor fix

* minor fix

* fix mbart tokenizer

* minor fix

* minor fix

* minor fix

* fix compatity for autotokenizer

* fix offset mapping

* fix tokenizer doc

* fix doc

* fix tokenizer
2022-04-29 15:22:20 +08:00
smallv0221
eeb9a5a322 Upgrade tokenizer to align with HF tokenizer (#1993)
* upgrade tokenizer

* upgrade tokenizer

* upgrade datacollator

* minor fix

* minor fix

* fix mbart tokenizer

* minor fix

* minor fix

* minor fix

* fix compatity for autotokenizer

* fix offset mapping

* fix tokenizer doc

* fix doc
2022-04-29 13:34:52 +08:00
wawltor
619b94c1e8 Merge pull request #2026 from luyaojie/develop
[DuUIE] encoding fixing for windows
2022-04-29 13:24:03 +08:00
Yaojie Lu
0e4b2cab34 [DuUIE] ignore entity type dev relation evaluation same as online evaluation 2022-04-29 12:03:23 +08:00
Yaojie Lu
3f46723c55 [DuUIE] using set for dev evaluation same as online evaluation 2022-04-29 11:38:50 +08:00
Yaojie Lu
f7487a45f1 [DuUIE] fix task_scorer_dict 2022-04-28 22:26:25 +08:00
wawltor
fcd3d1a3c6 Merge pull request #2027 from LemonNoel/speech
[speech-cmd] add speech command analysis application
2022-04-28 21:13:56 +08:00
Huijuan Wang
3ee4b23553 [speech-cmd] fix problems in comments 2022-04-28 20:30:40 +08:00
Huijuan Wang
55122d2b67 [speech-cmd] fix bug brought by reorganization 2022-04-28 15:02:07 +08:00
wawltor
2fe82d8ba6 Merge pull request #1952 from linjieccc/add_uie
Add UIE for Taskflow
2022-04-27 22:34:49 +08:00
Huijuan Wang
4ab25251b9 [speech-cmd] reorganize the code 2022-04-27 21:09:56 +08:00
Linjie Chen
d02b797595 Merge branch 'develop' into add_uie 2022-04-27 20:58:18 +08:00
Jiaqi Liu
db7aecf3cd Add RBT6 CLUE result (#2025)
* add rbt6 clue result

* fix expression
2022-04-27 19:45:59 +08:00
Huijuan Wang
d4d530d998 [speech-cmd] add demo screenshot 2022-04-27 19:45:36 +08:00
Huijuan Wang
45e1587ce3 [speech-cmd] add speech command analysis application 2022-04-27 19:35:35 +08:00
Yaojie Lu
6bd7d6e6ee [DuUIE] encoding fixing for windows 2022-04-27 19:29:21 +08:00
Yaojie Lu
61cb9bce2e [DuUIE] encoding fixing for windows 2022-04-27 19:20:02 +08:00
Yaojie Lu
7d47e0961e [DuUIE] encoding fixing for windows 2022-04-27 18:20:05 +08:00
linjieccc
0b18f4c271 fix decoding for cls task 2022-04-27 09:38:46 +00:00
linjieccc
68e4827ff8 fix decoding for cls task 2022-04-27 09:37:52 +00:00
linjieccc
321f45c729 fix decoding for cls task 2022-04-27 09:04:34 +00:00
linjieccc
04a6ca3ea4 fix cls decoding 2022-04-27 08:33:29 +00:00
linjieccc
ae2ddbfea8 Update README.md 2022-04-27 07:58:14 +00:00
linjieccc
e2ffdd4dbc fix construction of relations 2022-04-27 07:48:48 +00:00
linjieccc
26a7b0417c Update README.md 2022-04-27 07:02:34 +00:00
Linjie Chen
fb2ed84560 fix nptag decode bugs (#2023)
* fix nptag decode bug

* fix nptag decode bug
2022-04-27 11:47:55 +08:00
Zhong Hui
51d335dd36 delete finetune script. 2022-04-27 10:51:12 +08:00
Zhong Hui
d6c1f91498 [Trainer] eHealth pretraining with trainer (#1996)
* first version for ehealth

* update ehealth trainer.

* delete trainer script.
2022-04-27 10:36:51 +08:00
linjieccc
b8b87dd919 Update README.md 2022-04-26 16:21:46 +00:00
linjieccc
bafcfb1539 Update README.md 2022-04-26 14:36:17 +00:00
linjieccc
d47c3cf31e Update README.md 2022-04-26 14:35:20 +00:00
linjieccc
49eedeee32 Update README.md 2022-04-26 14:33:03 +00:00
linjieccc
0928e7e03f Update Taskflow README.md 2022-04-26 14:30:15 +00:00
Noel
226ca51cea Merge pull request #2014 from LemonNoel/fix_epoch
[ehealth] fix epoch problem when max_steps is not setted
2022-04-26 21:58:52 +08:00
Noel
adb1ef41dc Merge branch 'develop' into fix_epoch 2022-04-26 21:46:27 +08:00
Zhong Hui
fc63c1116f refine some code. 2022-04-26 20:26:07 +08:00
Roger
70a55a3f14 Update README.md (#2021)
* Update README.md

* Update README.md

* Highlight sign up information
2022-04-26 20:21:02 +08:00
gmm
d315620465 [benchmark] 更改benchmark模型配置 (#2020) 2022-04-26 19:57:12 +08:00
wawltor
b42754e466 Merge pull request #2019 from luyaojie/develop
add split-test command in CCKS README.md
2022-04-26 19:20:08 +08:00
Roger
52e1ab4e17 add split-test in README.md 2022-04-26 18:58:32 +08:00
wawltor
c08984cf13 Merge pull request #2012 from luyaojie/develop
DuUIE baseline for CCKS 2022
2022-04-26 18:52:22 +08:00
Roger
17ce404571 Fix config path in README.md 2022-04-26 18:40:35 +08:00
linjieccc
810be72609 Update backbone 2022-04-26 10:12:16 +00:00
Zhong Hui
d099228b42 delete comments. 2022-04-26 17:53:20 +08:00
Zhong Hui
8154b118bf optimize some log info for ernie-1.0 pretraining. 2022-04-26 17:48:15 +08:00
Roger
fb68158e46 Add uie-char-small 2022-04-26 17:19:43 +08:00
Yaojie Lu
3461c2b123 Update Test Name 2022-04-26 16:56:26 +08:00
yingyibiao
662d29bf18 update luke tokenizer (#2016) 2022-04-26 16:46:26 +08:00
Noel
e9a8903431 Merge branch 'develop' into fix_epoch 2022-04-26 16:34:19 +08:00
yingyibiao
d35bdecef3 Update transformers __init__.py (#2015)
* update transformers __init__.py

* update transformers __init__.py

* update transformers __init__.py
2022-04-26 16:24:50 +08:00
yingyibiao
ebcb565ba4 update auto tokenizer (#2007) 2022-04-26 15:53:40 +08:00
Huijuan Wang
5d349ad14c [ehealth] fix epoch problem when max_step is not setted 2022-04-26 15:03:53 +08:00
Linjie Chen
44896d10ef Merge branch 'PaddlePaddle:develop' into add_uie 2022-04-26 14:48:12 +08:00
Huijuan Wang
90dd690e17 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into ehealth 2022-04-26 14:46:14 +08:00
smallv0221
b2bb385418 add __init__.py for hf_dataset (#2013) 2022-04-26 14:44:26 +08:00
Linjie Chen
e186b1fba5 Merge branch 'develop' into add_uie 2022-04-26 14:40:54 +08:00
Yaojie Lu
8bcc7b8c39 Update Readme for run_seq2struct.py 2022-04-26 12:59:17 +08:00
Yaojie Lu
4b1ffa4797 Add CCKS 2022 baseline DuUIE 2022-04-26 12:45:46 +08:00
Yaojie Lu
aca133e621 Add CCKS 2022 baseline DuUIE 2022-04-26 12:38:44 +08:00
Zhong Hui
d1c68094ce [Trainer] ernie-1.0 pretrain with trainer. (#1956)
* ernie-1.0 pretrain with trainer.
* fix oom bug of dataloader useage.
* fix resume from chechpoint epoch display.
2022-04-26 11:15:47 +08:00
linjieccc
08deaab0e3 update auto joiner 2022-04-25 14:10:59 +00:00
Noel
fda3d82a3f [Ehealth] fix bug for fp32 (#2003)
* [ehealth] unify quotes in pretraining model
* [ehealth] fix bug for fp32
* [ehealth] rename directory of ernie-health
2022-04-25 20:01:37 +08:00
gongenlei
da3614d935 fix: remove padding_idx (#2006) 2022-04-25 18:56:45 +08:00
27182812
ce7c1538dc 新增gpt转换权重更新and预训练权重表格格式统一化 (#2001)
Co-authored-by: yingyibiao <yyb0576@163.com>
2022-04-25 18:28:28 +08:00
linjieccc
bb0c8ccd3b Update README.md 2022-04-25 07:34:48 +00:00
linjieccc
ecc3788409 update set_schema method 2022-04-25 07:17:56 +00:00
吴高升
46a268dde0 Add faq finance solution (#1997)
* Add faq finance solution

* Upgrade tokenizer,Model to Auto

* Update Readme

* Update readme
2022-04-25 14:45:10 +08:00
linjieccc
9ba16d98c9 fix bug of prompt construction 2022-04-25 06:20:45 +00:00
Huijuan Wang
a50633db94 [ehealth] rename directory of ernie-health 2022-04-25 14:05:32 +08:00
Huijuan Wang
746da81c5c Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into ehealth 2022-04-25 13:15:55 +08:00
Huijuan Wang
a4369aae52 [ehealth] fix bug for fp32 2022-04-25 13:14:59 +08:00
Noel
20d1734c79 Merge pull request #1999 from LemonNoel/ehealth
[Ehealth] Fix num_epochs setting
2022-04-24 20:04:38 +08:00
Huijuan Wang
8ce1a71c2d [ehealth] unify quotes in pretraining model 2022-04-24 20:03:06 +08:00
Huijuan Wang
1ae624dadc Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into ehealth 2022-04-24 17:42:02 +08:00
Huijuan Wang
78f034f862 [ehealth] fix num_epochs and unify quotes 2022-04-24 17:41:40 +08:00
Noel
bb272f4e71 Merge pull request #1960 from LemonNoel/ehealth
[Ehealth] Add pretraining model of EHealth
2022-04-24 16:07:41 +08:00
Noel
8d75ff2895 Merge branch 'develop' into ehealth 2022-04-24 16:05:36 +08:00
Jiaqi Liu
9b227f2c4b Add ERNIE 3.0-Base CLUE result (#1998)
* add ernie3.0-base clue result

* update iflytek

* update avg
2022-04-24 15:27:44 +08:00
Allen Guo
2749e3428a [IPU] add pod4 support for bert-base model on ipu (#1966)
* add pod4 support for bert-base on ipu

* clean scripts

* update seed
2022-04-24 14:21:03 +08:00
27182812
69bf4b4d22 预训练模型部分文档初次修改提交 (#1989)
* 预训练模型部分文档初次修改提交

* Transformer预训练模型文档修改完善

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-04-24 11:07:03 +08:00
Yaozong Shen
d0f2c551da fix bugs (#1977)
Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-04-22 15:23:11 +08:00
Jiaqi Liu
006c4d9837 Add ERNIE 3.0 Medium CLUE result (#1985)
* update ernie-3.0-tiny result

* add ernie-3.0-medium result

* rename models

* add a commit
2022-04-22 13:02:27 +08:00
Jiaqi Liu
af18ef2156 rename ernie-3.0 (#1991) 2022-04-22 11:12:27 +08:00
linjieccc
0a4f75decb add schema format check 2022-04-21 12:57:45 +00:00
tianxin
2922af4eef rename RGL (#1988) 2022-04-21 18:46:42 +08:00
Noel
40cf839105 Merge branch 'develop' into ehealth 2022-04-20 22:41:14 +08:00
Huijuan Wang
c086026d76 [ehealth] add ##- for all chinese tokens and update readme 2022-04-20 22:32:54 +08:00
gmm
d35eec378e fix benchmark (#1981) 2022-04-20 20:02:33 +08:00
Jiaqi Liu
905fc554ff Update run_clue_classifier.py (#1979)
* update run_clue_classifier.py

* update input check
2022-04-20 14:47:28 +08:00
Huijuan Wang
cda988311d [ehealth] fix organization and problems in comments 2022-04-20 11:41:57 +08:00
linjieccc
dac0ccff49 adapt auto_joiner 2022-04-19 08:38:28 +00:00
Jiaqi Liu
390acb902a Add ernie-3.0-large clue result, update csl hyper-param (#1973)
* add ernie-3.0-large result, update csl hyper-param

* uppercase

* add avg score
2022-04-19 14:48:44 +08:00
gmm
69f098a365 fix benchmark (#1974) 2022-04-19 13:55:46 +08:00
linjieccc
c9ddd0cac3 fix bugs 2022-04-19 05:42:56 +00:00
Huijuan Wang
b9a1011491 [ehealth] change initialization as random 2022-04-19 01:38:00 +08:00
Noel
2afc6062f9 Merge pull request #1972 from LemonNoel/duee_fix
[duee] fix encoding problem for windows
2022-04-18 16:33:29 +08:00
Huijuan Wang
3608dc3651 [duee] fix encoding problem for windows 2022-04-18 15:17:10 +08:00
Jiaqi Liu
4b8f092fcb Add ERNIE 3.0 (#1955)
* add ernie-3.0-base

* add ernie-3.0 large

* add ernie tiny
2022-04-18 11:15:41 +08:00
linjieccc
f2e421e7ff remove comments 2022-04-18 02:35:54 +00:00
linjieccc
c068cff507 add return prob 2022-04-18 02:30:47 +00:00
Huijuan Wang
378d139db5 Merge branch 'ehealth' of https://github.com/LemonNoel/PaddleNLP into develop 2022-04-18 09:32:59 +08:00
Huijuan Wang
ff34f94b6a [ehealth] align model for pretraining 2022-04-18 09:30:25 +08:00
Zeyu Chen
a09dba168f Update setup.py 2022-04-16 19:08:04 +08:00
yingyibiao
5dd1ba6e1a Replace try_import sentencepiece with direct import sentencepiece (#1961)
* direct import sentencepiece

* direct import sentencepiece
2022-04-15 18:19:47 +08:00
linjieccc
f6236d4db1 update schema 2022-04-15 07:22:28 +00:00
linjieccc
845dfd8ad0 rename func 2022-04-15 06:35:43 +00:00
wawltor
519f552730 Merge pull request #1958 from linjieccc/op_path
Optimize task path for Taskflow
2022-04-15 13:11:59 +08:00
linjieccc
a0eea3c0c4 add set_schema func 2022-04-15 03:57:09 +00:00
linjieccc
4c3e73c16d add set_schema func 2022-04-15 03:56:24 +00:00
Linjie Chen
7394ddf6c0 Merge branch 'PaddlePaddle:develop' into add_uie 2022-04-15 11:10:08 +08:00
linjieccc
ca92e6324a Update text_correction task name 2022-04-15 02:41:55 +00:00
Huijuan Wang
45e14c2463 Merge remote-tracking branch 'ppnlp/develop' into ehealth 2022-04-15 09:58:44 +08:00
Huijuan Wang
ca63ba8897 [ehealth] draft version of pretraining 2022-04-15 09:57:28 +08:00
yingyibiao
e99e41b905 Update auto modeling & auto tokenizer (#1902)
* Update auto class

* update

* Add sentencepiece to package requirements

* add more detailed AttributeError information

* add more detailed AttributeError information

* add more detailed AttributeError information

* add more detailed AttributeError information

* add more detailed AttributeError information
2022-04-14 22:11:09 +08:00
linjieccc
af89ed9cca fix 2022-04-14 11:57:09 +00:00
Linjie Chen
efde6145c9 Merge branch 'develop' into op_path 2022-04-14 17:27:15 +08:00
linjieccc
7c19d5914b Update README.md 2022-04-14 09:15:41 +00:00
linjieccc
6cdd4259f8 optimize taskflow download 2022-04-14 08:55:50 +00:00
Beacontownfc
70649b1bf8 Add model Rembert (#1701)
* add rembert

* add rembert

* Update tokenizer.py

* update rembert

* modify

* modify according to gongel

* Update tokenizer.py

* Update tokenizer.py

* Update modeling.py

* fix bug

Co-authored-by: gongenlei <gongel@qq.com>
2022-04-14 16:36:39 +08:00
Zhong Hui
3021098cac [Trainer] Add clue benchmark script with trainer. (#1909)
* add clue for trainer.

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-04-14 15:42:06 +08:00
Linjie Chen
20bed38555 Merge branch 'develop' into add_uie 2022-04-14 12:52:53 +08:00
linjieccc
4769d92baf update usage 2022-04-14 04:51:02 +00:00
linjieccc
d815ceb133 update usage 2022-04-14 04:49:11 +00:00
linjieccc
4e2802b3e7 add uie for taskflow 2022-04-14 03:59:48 +00:00
smallv0221
7eb0c7a431 Host hf datasets and upgrade examples (#1910)
* hosting squad dataset

* fix squad no answer metric

* fix DataCollatorForSeq2Seq

* hosting hf datasets

* enhence import warning
2022-04-13 14:54:15 +08:00
liu zhengxi
f9fab9430c Merge prepare.benchmark.sh and prepare.sh (#1938)
* merge prepare benchmark

* update

* delete export BENCHMARK_ROOT

* rename ips tp ips_total, ips_per_cars to ips

* pre-commit issue

Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2022-04-13 12:15:56 +08:00
Yaozong Shen
7a5b0028c8 More accurate score (#1940)
* match tokens to get accurate score

* fix bugs

* fix code style
2022-04-13 12:15:33 +08:00
吴高升
73d5318048 Fix the feature extraction bug (#1942) 2022-04-13 12:14:45 +08:00
Zhong Hui
f089a1816c add more detail for code source. (#1947) 2022-04-13 12:11:20 +08:00
Guo Sheng
99804a2426 Fix MPI related issue in GPT model parallel (#1894)
* Add mpi include dir into cmake.
Support more MPI environment vars.
Fix HOST confict of MPI and Paddle.

* Fix pointer convert in gpt_op.
2022-04-13 11:45:42 +08:00
Zhong Hui
01d2c2a9ea [BugFix] fix reload gpt (#1945) 2022-04-12 21:12:56 +08:00
smallv0221
b2e98d8d2d fix DatasetTuple identifier bug (#1941) 2022-04-12 15:45:59 +08:00
liu zhengxi
44569cc868 fix xlnet bug (#1937) 2022-04-12 12:06:49 +08:00
tianxin
61b51ea9e6 add RGL README (#1936) 2022-04-12 10:55:51 +08:00
smallv0221
164f0f6db1 upgrade AddedToken class (#1933)
* read addedtoken from config

* upgrade AddedToken class

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-04-11 17:22:12 +08:00
Guo Sheng
dc26828139 To avoid recursive import temporarily (#1896)
* To avoid recursive import temporarily.

* To avoid recursive import temporarily.

Co-authored-by: Jiaqi Liu <709153940@qq.com>
2022-04-11 15:53:30 +08:00
liu zhengxi
86489d8809 Paddle benchmark (#1827) 2022-04-11 14:48:52 +08:00
smallv0221
ac6fc3a643 read addedtoken from config (#1930) 2022-04-11 14:40:21 +08:00
吴高升
1ff5954481 Update SimCSE predict file (#1918)
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-04-08 23:05:04 +08:00
Noel
2e236dbe9c Merge pull request #1919 from LemonNoel/fix_star
[ehealth] fix syntax for python 3.9
2022-04-08 17:35:04 +08:00
Huijuan Wang
11881bc071 [cblue] fix encoding in json for python 3.9 2022-04-08 13:13:03 +08:00
Huijuan Wang
671f0f3898 [ehealth] fix usage of star for python 3.9 2022-04-08 11:26:52 +08:00
Zhong Hui
4ba301bb54 [BugFix] Update parallel.py (#1905) 2022-04-07 19:58:24 +08:00
Jack Zhou
67d93b1f06 Fix hyp dataset loading (#1900) 2022-04-07 17:41:56 +08:00
Jiaqi Liu
6f0535a14d Calc CHID acc by considering the global probability (#1891)
* compute acc by considering the global probability

* remove debug var

* remove debug var

* update readme results

* fix cmrc2018 max answer length

* update readme

* add lr,bs in readme
2022-04-07 15:02:28 +08:00
tianxin
07c0085608 add paddlefsl into requirements.txt (#1907) 2022-04-07 00:11:26 +08:00
Zhong Hui
adb2478427 [Trainer] update trainer usage with data collator (#1892)
* update trainer usage with data collator
2022-04-06 20:35:45 +08:00
Allen Guo
2000ea2ea8 [IPU] add bert-base model for ipu (#1793)
* add bert-base model for ipu

* use hdf5 dataset

* add enable_engine_caching param

* use HF dataset for squad task

* update readme
2022-04-02 18:18:51 +08:00
smallv0221
7ff492bad9 fix data collator for stsb (#1888) 2022-04-01 20:00:51 +08:00
smallv0221
2ace3f1974 fix HF load_dataset hack (#1886)
* fix HF dataset hack

* minor fix
2022-04-01 16:59:48 +08:00
Guo Sheng
82cccba33d Update in_dygraph_mode to in_dynamic_mode. (#1884) 2022-04-01 13:09:05 +08:00
tanhanzhuo
02d762c0a5 [PreTraining] Add RoBERTa pre-train and finetune (#1780)
* data collator for masked language modeling

* tokenize data via HF datasets

* add RoBERTa Model

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-04-01 11:40:55 +08:00
Noel
437c926dfc Merge pull request #1879 from LemonNoel/deploy
[ERNIE-Health] add max_steps and fix readme
2022-03-31 22:42:20 +08:00
Noel
6c0e1bb4c4 Merge branch 'develop' into deploy 2022-03-31 20:56:35 +08:00
Huijuan Wang
1bc96a0180 [ehealth] remove del data_loader 2022-03-31 20:55:57 +08:00
Milen
ee157d6f8b Supporting processing data from doccano platform. (#1866)
* sentiment analysis initializing

* modify README.md

* sentiment analysis initializing

* modify data_ext and data_cls link in README.md

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete unuseful info.

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete sentiment_system.png

* add sentiment_system.png

* refine readme.md

* sentiment analysis intializing

* mv data and checkpoints in sub_dir to parent_dir

* refine readme.md

* refine readme

* refine readme.md, modify requirements

* refine readme.md

* refine readme.md

* refine readme.md

* mv run_export.sh to run_export_model.sh

* refine readme.md

* remove some

* remove some unnecessary packages

* delete unuseful compute_md5 method

* sentiment analysis initializing

* sentiment analysis initializing

* refine readme.md

* set CUDA_VISIBLE_DEVICES=0

* refine style  with pre-commit

* use ppminilm in ernie instead of offline ppminilm

* refine readme

* load ppminilm in transformers.PPMiniLMModel, not load in ErnieModel

* use model in transformers, not implement it personally

* refine style with pre-commit

* set paddlenlp version == 2.2.2

* refine readme

* refine readme

* refine readme

* fix bug, make sure that length of input_text and label is  equal when deocding

* fix bug, make sure that the length of input_text and label is equal

* fix some mistakes in readme

* refine procedure

* refine readme

* set dtype=64 to fix dtype problem in windows

* set dtype=64 to fix dtype problem in windows

* set 2 max_seq_len for ext_ and cls_ model

* refine readme

* fix dtype problem in windows

* refine readme

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-03-31 20:16:14 +08:00
Huijuan Wang
6641d3ca57 [cblue] remove warning in CMeIE 2022-03-31 19:41:17 +08:00
Zhong Hui
9fb0148a30 refine some code as reviews. (#1880) 2022-03-31 18:38:44 +08:00
tianxin
b1d5b530a6 Remove FewCLUE CLUEWSC unlabeled.json (#1881)
issue #1854
2022-03-31 18:14:11 +08:00
gongenlei
561f114eb8 fix: change dtype:generator-->list (#1877)
Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2022-03-31 15:58:58 +08:00
yingyibiao
79126042d6 set default value for num_classes (#1867) 2022-03-31 15:12:48 +08:00
Guo Sheng
c541f4ba1f Add model parallel for FasterGPT. (#1755)
* Add model parallel for FasterGPT.

* Make GPT model parallel runable

* Make FT model parallel optional.

* Fix _write_setup_file when kwargs is not empty.

* Fix ext_utils.load

* Add file lock for model parallel.

* Fix model_parallel.flag in CMakeLists.txt.

* Use a separated lib for model parallel.

* Make from_pretrained get partial model.

* Make model parallel support layer group in python.

* Fix fit_partial_model when model having keys state not including.

Add api docs for model parallel.

* Fix the default world_size when mpi is not available.

* Add demo for GPT model parallel.

* Fix default global ft_para_conf.

* Fix GPTModel state_dict wrapper for layer parallel.

* Set seed for tensor parallel.

* Fix location of gpt.h in cmake.

* Fix seed in gpt.h

* Fix NV FT GPT embedding.

* Add more cases in gpt_mp_sample.py

* Fix seed in ker_curand_setupLauncher.
Put build dir of FG in PPNLP_HOME with digest of current path.

* Refine gpt_mp_sample.py
2022-03-31 15:08:41 +08:00
smallv0221
f2506c37c9 Add special token mask switch (#1878)
* add switch for offset mapping

* add switch for offset mapping

* minor fix

* fix offsets mapping

* upgrade chinese qa eval

* add special token switch

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-03-31 13:32:46 +08:00
Huijuan Wang
9aac8b6a0c [ehealth] fix README for CHIP-STS 2022-03-31 11:33:57 +08:00
smallv0221
2bb8bf5f31 upgrade chinese qa eval (#1874)
* add switch for offset mapping

* add switch for offset mapping

* minor fix

* fix offsets mapping

* upgrade chinese qa eval

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-03-31 10:59:57 +08:00
Huijuan Wang
b373d98080 [ehealth] add max_steps parameter 2022-03-30 22:34:02 +08:00
smallv0221
316b14a55b fix offset mapping (#1871)
* add switch for offset mapping

* add switch for offset mapping

* minor fix

* fix offsets mapping

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-03-30 20:50:46 +08:00
smallv0221
30b4ca575d add switch for offset mapping (#1856)
* add switch for offset mapping

* add switch for offset mapping

* minor fix

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-03-30 20:11:21 +08:00
吴高升
95885249ef Update WR&faq readme by QA (#1863)
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-03-30 20:10:30 +08:00
chenxiaozeng
9a124efe31 Add learning materials of Taskflow API (#1869)
* Add learning materials of Taskflow API

For promotion activities.

* fix code style err

* Add learning materials of Taskflow API
2022-03-30 19:06:41 +08:00
Zhong Hui
44a290e94d [Trainer] Add init version of paddlenlp trainer and apply finetune for ernie-1.0 pretraining. (#1761)
* add some datasets for finetune.

* support fine tune for all tastks.

* add trainer prototype.

* init verison for paddlenlp trainer.

* refine trainer.

* update for some details.

* support multi-cards training evaluation.

* support load from ckpt.

* support for export inference model.

* first version of trainer.

* seq cls support clue.

* trainer support for token classification and question answersing tasks.

* fix as reviews.

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-03-30 17:38:10 +08:00
wawltor
00af227211 Merge pull request #1844 from LemonNoel/deploy
[ERNIE-Health] Add export_model examples
2022-03-30 10:09:50 +08:00
Huijuan Wang
4a9a3dbec9 [ehealth] fix README 2022-03-29 21:13:52 +08:00
Noel
fd52aff878 Merge branch 'develop' into deploy 2022-03-29 21:10:54 +08:00
Huijuan Wang
a1e7dfff9c [ehealth] fix annotation and README 2022-03-29 21:09:52 +08:00
Yaozong Shen
a6e56e3b6b Fix broken path (#1862)
* fix bugs

* fix bugs

* fix code style
2022-03-29 20:30:15 +08:00
Huijuan Wang
832e8a7f99 [ehealth] add reference to doc 2022-03-29 20:20:14 +08:00
Noel
a132cc1561 Merge branch 'develop' into deploy 2022-03-29 19:01:48 +08:00
Huijuan Wang
a2960792a7 [ehealth] add ernie-health-chinese to doc 2022-03-29 18:58:36 +08:00
Huijuan Wang
4f8c69641f [ehealth] change link of ERNIE-Health 2022-03-29 18:07:41 +08:00
chenxiaozeng
77e5192d55 Fix the readthedocs display error (#1859)
Fix the readthedocs display error caused by lacking of main heading H1.

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-03-29 18:06:28 +08:00
Linjie Chen
1f4a5075b1 Update README.md (#1858)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
2022-03-29 18:05:38 +08:00
Huijuan Wang
249227fe58 [ehealth] fix bug in export_model 2022-03-29 17:36:12 +08:00
Huijuan Wang
623d65e377 [ehealth] update README 2022-03-29 16:20:02 +08:00
smallv0221
d0d20678f2 add new datacollator upgrade examples (#1816)
* upgrade predict_glue.py

* test doc api

* revert

* update collator

* revert dureader_robus

* minor fix

* add glue sample

* stash

* stash

* upgrade examples for new datacollator

* fix squad sample

* add token classification collator

* fix doc

* fix collator for squad

* minor fix

* upgrade msra_ner predict

* add some doc

* add more check
2022-03-29 16:10:08 +08:00
Huijuan Wang
241b9e04a0 [ehealth] update parameters 2022-03-29 15:22:59 +08:00
chenxiaozeng
1df66439dc Update taskflow.md (#1847)
Change the aistudio tutorial link.
2022-03-29 10:03:16 +08:00
Jiaqi Liu
07a25b286b Add clue benchmark (cmrc2018, chid, c3) (#1810)
* update chid, c3

* update chid, c3

* update chid

* update train c3 script

* update train and test

* fix chid data process

* fix readme error
2022-03-28 21:04:41 +08:00
Huijuan Wang
b7f9949871 [ehealth] add export_model 2022-03-28 20:35:52 +08:00
yingyibiao
3351ab0405 Upgrade Roberta tokenizer (#1821)
* update roberta

* update roberta tokenizer

* update roberta tokenizer

* update

* update
2022-03-28 18:55:17 +08:00
smallv0221
46cbe60018 Add finetuned ernie gram (#1814)
* add finetuned ernie-gram model

* add finetuned ernie-gram model

Co-authored-by: tianxin <tianxin04@baidu.com>
2022-03-28 17:53:30 +08:00
wanghuijuan03
919f7ed29c [ehealth] rename ehealth as ernie-health and add draft export_model 2022-03-28 16:44:58 +08:00
yingyibiao
0a2988970e update readthedocs requirements (#1842) 2022-03-28 16:25:17 +08:00
gongenlei
b69d56f513 Refactor dataset xnli/cnn_dailymail (#1838)
* refactor: add name error for xnli

* add default language

* use name not version
2022-03-28 16:00:21 +08:00
gongenlei
c4fc6eafa2 fix: rename ernie-gen tokenizer name (#1841) 2022-03-28 15:43:36 +08:00
wawltor
5463a3ea62 Merge pull request #1839 from linjieccc/fix_bugs
fix textcnn inference and text_classification distributed training bugs
2022-03-28 15:02:34 +08:00
wawltor
2682d3c9d2 Merge pull request #1828 from LemonNoel/cblue
[EHealth] Add examples of NER and SPO tasks
2022-03-28 14:20:01 +08:00
Linjie Chen
bb7916bee3 Merge branch 'develop' into fix_bugs 2022-03-28 13:53:54 +08:00
linjieccc
11c568c4fd fix ci 2022-03-28 05:40:13 +00:00
linjieccc
4829631d7d fix textcnn inference and text_classification distributed training bugs 2022-03-28 05:30:17 +00:00
Huijuan Wang
85a3a252bb [ehealth] add annotation for batchify_fn 2022-03-28 12:10:50 +08:00
Huijuan Wang
aa82dc0666 [ehealth] fix problems for dynamic2static 2022-03-28 11:09:44 +08:00
smallv0221
5f3ab326f9 fix tokenizer doc for __call__() (#1815)
* fix tokenizer doc for __call__()

* fix tokenizer doc for __call__()

* fix tokenizer doc for __call__()

* fix_doc

* fix_doc

* update doc

* minor fix
2022-03-28 11:02:31 +08:00
Huijuan Wang
630e21ef00 [ehealth] update readme 2022-03-26 10:39:51 +08:00
Huijuan Wang
4aa9bb8c07 [ehealth] fix bug in spo metric 2022-03-26 00:45:01 +08:00
Huijuan Wang
93b2a0c2ce Merge remote-tracking branch 'ppnlp/develop' into cblue 2022-03-25 22:08:59 +08:00
Huijuan Wang
f2239e3b6f [ehealth] optimize examples 2022-03-25 22:06:36 +08:00
Yaozong Shen
93cae49c0c Add NLP model interpretation (#1752)
* upload NLP interpretation

* fix problems and relocate project

* remove abandoned picture

* remove abandoned picture

* fix dead link in README

* fix dead link in README

* fix code style problems

* fix CR round 1

* remove .gitkeep files

* fix code style

* fix file encoding problem

* fix code style

* delete duplicated files due to directory rebuild

* fix CR round 2

* fix code style

* fix ernie tokenizer

* fix code style

* fix problem from CR round 1

* fix bugs

* fix README

* remove duplicated files

* deal with diff of old and new tokenizer results

* fix CR round 4

* fix code style

* add missing dependence

* fix broken import path

* move some data file to cloud

* MRC upper case to lower case

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: binlinquge <xxx>
Co-authored-by: Guo Sheng <guosheng@baidu.com>
2022-03-25 21:11:52 +08:00
Linjie Chen
edcd9a4750 Update README.md (#1835)
* Update README.md

* Update README.md

* Update README.md
2022-03-25 18:30:12 +08:00
Huijuan Wang
02f0e210c1 [ehealth] add spo example 2022-03-25 15:08:06 +08:00
Zhong Hui
1d930169e1 [Pre-training] Optional for nsp task, support multi-datasets in ERNIE-1.0 pre-training (#1621)
* add no nsp training.

* support for multi-dataset

* fix test sample nums.
2022-03-25 11:21:48 +08:00
Linjie Chen
3b675575cb Update README.md (#1832) 2022-03-24 20:45:09 +08:00
Zeyu Chen
c11a1465e1 Update README.md 2022-03-23 23:25:34 +08:00
chenxiaozeng
97da5e0dc6 update taskflow readme (#1824) 2022-03-23 23:24:55 +08:00
Huijuan Wang
203232a21c Merge remote-tracking branch 'ppnlp/develop' into cblue 2022-03-23 21:37:17 +08:00
Huijuan Wang
b66d14d9bf [ehealth] update script for ner 2022-03-23 21:33:20 +08:00
吴高升
6864ac37ee Add FAQ system (#1785)
* Add faq solution

* Update faq readme

* Update readme

* Update readme
2022-03-23 21:26:10 +08:00
Huijuan Wang
55ac7fbdbd [ehealth] fix evaluator for ner 2022-03-23 21:17:35 +08:00
Jiaqi Liu
c50cf7207f fix clue readme (#1822) 2022-03-23 16:57:35 +08:00
Huijuan Wang
b0fa3ce47b [cblue] fix diff in encoding overlapped entities 2022-03-23 14:10:53 +08:00
Linjie Chen
6d102f5b97 Update README.md (#1820)
* Update README.md

* Update README.md
2022-03-23 14:03:36 +08:00
Zhong Hui
fe06274910 try import paddle.distribute to aviod failed when import paddlenlp. (#1818)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-03-23 10:46:29 +08:00
Linjie Chen
8b68c74755 Update README.md (#1812)
* Update README.md

* Update README.md

* Update README.md
2022-03-22 23:10:37 +08:00
Huijuan Wang
b137a35db7 [ehealth] align LinearDecayWithWarmup 2022-03-22 16:30:20 +08:00
Jiaqi Liu
b570fd11fd Add RocketQA ranking model (#1783)
* add rocketqa ranking model

* Update ranking class

* fix filepath

* fix apply

* delete ErnieRanking
2022-03-22 14:43:05 +08:00
smallv0221
b260c8fa50 Fix tokenizer and datasets compatibility issue (#1809)
* Fix tokenizer and datasets compatibility issue

* minor fix

* minor fix

* minor fix

* fix squad predict
2022-03-22 12:32:13 +08:00
liu zhengxi
5637b5f15c Simplify xl sample to use float16 FT (#1808) 2022-03-22 12:13:36 +08:00
QingshuChen
08a22758b1 fix bug that FLAGS_selected_xpus can't work (#1811) 2022-03-21 19:06:01 +08:00
Huijuan Wang
01a0c1fca3 [ehealth] fix bug in NER 2022-03-21 16:50:54 +08:00
吴高升
6ff5eabb8f Fix bert dead link (#1807) 2022-03-21 14:51:33 +08:00
gongenlei
8fecd6b648 [BUGFIX] fix hang when training and evaluation in multi-gpus model (#1681)
* fix: fix hang in multi-gpus

* rm del dataloader
2022-03-21 12:25:42 +08:00
wawltor
eb5cf37cea Merge pull request #1782 from LemonNoel/ner_spo_debug
[EHealth] Finetune examples of Classification, NER and SPO
2022-03-21 10:29:35 +08:00
Zhong Hui
83743ccb63 [BUGFIX] fix gpt benchmark. (#1787)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-03-20 18:06:50 +08:00
Linjie Chen
36a8f5056f Simplify replacement of pretrained models (#1788) 2022-03-19 17:35:53 +08:00
Zhong Hui
43ce0713d8 [PRETRAIN] Add ernie-1.0 dygraph training script. (#1744)
* add ernie-1.0 dygraph training.

* modify readme.

* fix as reviews.

* fix script

* typo fix.
2022-03-18 23:08:49 +08:00
Jiaqi Liu
d6d77ecf03 Upload dualencoder params to bos (#1795)
* upload dual encoder params to bos

* update example code

* fix model name

* update rocketqa model name

* remove useless blank line
2022-03-18 23:02:40 +08:00
smallv0221
87f342c3df fix roberta tokenizer (#1798) 2022-03-18 22:53:24 +08:00
yingyibiao
5bcc708b82 Update readthedocs (#1776)
* Update readthedocs

* delete doctree

* update

* update

* update

* update

* update

* update

* update

* update
2022-03-18 22:51:07 +08:00
wawltor
783ac715dc Merge pull request #1800 from chenxiaozeng/update_doc
update group QR code
2022-03-18 21:01:49 +08:00
chenshuo07
631aaed007 update group QR code 2022-03-18 20:56:54 +08:00
Noel
40f45e2d10 Merge branch 'develop' into ner_spo_debug 2022-03-18 17:54:29 +08:00
Huijuan Wang
5126f82586 [ehealth] modify NER code according to comments 2022-03-18 17:41:26 +08:00
yingyibiao
7c47b62d37 fix deadlinks (#1797) 2022-03-18 17:39:39 +08:00
tanhanzhuo
1a9a48ebe9 Add cls_token_id (#1777)
cls_token_id = input_ids[0][0] is not safe, add cls_token_id as initialization parameter for embedding class

Co-authored-by: Jack Zhou <zhoushunjie@baidu.com>
Co-authored-by: yingyibiao <yyb0576@163.com>
2022-03-18 16:41:53 +08:00
smallv0221
e93f899a02 upgrade predict_glue.py (#1779)
* upgrade predict_glue.py

* test doc api

* revert
2022-03-18 11:36:20 +08:00
Jiaqi Liu
bdd703b257 remove useless config (#1789) 2022-03-18 11:10:44 +08:00
Jiaqi Liu
aa63b68971 Add clue benchmark classification (#1732)
* fix inference bug

* add clue benchmark classification

* add cmrc, chid, c3

* update readme

* add ernie-3.0-base

* update reamde data

* update readme

* update readme

* update readme result

* add predict script

* remove chid, c3, cmrc2018

* fix readme syntax error

* fix predict script

* fix readme

* remove loggng, update readme

* fix readme

* Fix readme

* Fix readme

* update readme
2022-03-18 10:50:59 +08:00
吴高升
c6d7c7c26b Update albert link (#1786) 2022-03-17 21:04:30 +08:00
Huijuan Wang
ff027096cf [ehealth] draft version of ner and spo tasks 2022-03-17 15:14:33 +08:00
Jiaqi Liu
684e90745c Add semantic indexing model (#1771)
* Add ernie matching

* fix doc

* fix tokenizer

* upload params to bos

* update semantic indexing model

* rename class

* update model name

* fix useless argument

* fix useless argument
2022-03-17 12:57:42 +08:00
Linjie Chen
e91dc7858c disable use_pos for segmented inputs (#1778) 2022-03-17 11:34:55 +08:00
smallv0221
549d9a5310 upgrade text_classification example (#1767)
* ungrade text_classification example

* add msra example

* minor fix
2022-03-16 15:34:36 +08:00
liu zhengxi
1a5695a18b Support UNIMOText dy2sta (#1769) 2022-03-16 10:34:28 +08:00
gongenlei
e728f037d9 fix: update model name (#1770) 2022-03-15 23:50:50 +08:00
liu zhengxi
afd326da4b Make autolog alternative (#1672)
* make autolog alternative

* minor fix

* update
2022-03-15 16:56:06 +08:00
Linjie Chen
1e2ee01dad Update Taskflow word_segmentation and ner tasks (#1666)
* Add AutoSplitter & AutoJoiner

* codestyle fix

* unify auto joiner

* add comments

* add sentence split mode

* update params

* add paddle version check

* add wordtag for word_segmentation

* add wordtag for word_segmentation

* add ner-lac and word_segmentation-jieba

* add return entities only for ner

* fix ci

* fix ci

* fix ci

* fix ci

* fix ci

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* fix bugs of dataloader

* remove guard

* use fast mode for rnn example

* Update README.md

* Update README.md
2022-03-15 14:38:43 +08:00
smallv0221
5d69c9f2e5 Upgrade luke examples and require datasets (#1765)
* change squad to HF

* update tokenizer

* update squad metric

* minor fix

* debugging

* minor fix

* minor fix

* update_mpnet_example

* add dureader example

* fix readme

* minor fix

* add requirements
2022-03-14 10:44:22 +08:00
Baibaifan
cf7c855955 [BUGFIX] Sharding: Fix fp32 group sharded (#1764)
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-03-13 15:17:28 +08:00
Beacontownfc
48dee51548 Add model MegatronBert (#1678)
* add megatronbert

* fix link

* Mormalized code

* add doc string

* update modeling

* recover

* recover

* Modify according to Steffy

* delete prefix

* Update modeling.py

* Modifiy according to Zhui

* Modify gelu_new

* Update tokenizer.py

* Update modeling.py

* update modeling

* update megatronbert

* recover

* Update modeling.py

* Update README.md

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-03-13 13:24:35 +08:00
smallv0221
ac29416211 Using HF Dataset on squad example (#1713)
* change squad to HF

* update tokenizer

* update squad metric

* minor fix

* debugging

* minor fix

* minor fix

* update_mpnet_example

* add dureader example

* fix readme

* minor fix
2022-03-11 21:51:37 +08:00
liu zhengxi
a9cf35e08a Add FAQ about FT compiling (#1750)
* add faq

* pre-commit

* bold

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-03-11 21:48:30 +08:00
Steffy-zxf
503940fdb1 Simplify RNN data preprocessing (#1723)
* refine the data preprocessing

* refine readme

* update prediction example

* add stopwords for example

* remove redudant code

* fix typos
2022-03-11 21:47:31 +08:00
吴高升
653ca9635b Enhance SimCSE by Word Repetition strategy (#1747)
* Add WR strategy

* Update readme

* Update bash file

* Update Readme

* fix the format error

* Update readme

* rm english dataset results

* Add colon
2022-03-11 19:33:47 +08:00
Guo Sheng
3ee73ac8f7 Update FasterGeneration convert_param (#1757)
* Fix jit.to_static/jit.save when deleting unfused qkv weights.

* To allow convert_params be called more than once.
2022-03-11 14:17:26 +08:00
Baibaifan
9da1bb6284 [GPT-3] Sharding, fix group sharded api (#1754)
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-03-11 12:07:11 +08:00
DanielYang
43e798916c Merge pull request #1756 from chenxiaozeng/update_doc
Prepose group QR code
2022-03-11 11:38:51 +08:00
chenshuo07
54bede7c2d update group QR code 2022-03-11 10:44:37 +08:00
chenshuo07
b554cbef59 update group QR code 2022-03-11 10:17:23 +08:00
Zhong Hui
7ff22597e0 Update transformers.rst (#1753) 2022-03-10 18:36:43 +08:00
yingyibiao
7a8e95d369 rename community model weights (#1749) 2022-03-10 17:29:28 +08:00
Beacontownfc
30ab2533de Add model LUKE (#1677)
* add luke

* update example

* Update README.md

* Update README.md

* normalized code

* fix error

* add doc string

* Update modeling.py

* delete entity_vocab.py

* Modify according to Steffy

* fix format

* fix format

* update luke

* Update modeling.py

* Update run_squad.py

* update luke

* update luke
2022-03-10 12:44:27 +08:00
Guo Sheng
bf0b18d0ae Optimize memory usage for faster generation. (#1640)
* Optimize memory usage for faster generation.

* Support FT transfer params from cpu and fp16 for big model loading.

* Fix get_default_dtype in _build_faster.

* Refine on FasterGPT params transfer.

* Support to convert to static graph.

* Make place string compatible with paddle develop and 2.2

* Fix converting to static graph in fp16 and mark todo

* Fix qkv concat weight setting.
Add doc for convert_param.

* Add load_state_as_np as a keyword argument of PretrainedModel.from_pretrained.

* Update plato-xl configuration.

* Make FasterUnifiedTransformer dy2static adapt to memory optimization.

* Fix InferUnifiedDecoding __init__

* Fix convert_params call in InferUnifiedDecoding.

* Update according to comments.
2022-03-09 17:16:40 +08:00
liu zhengxi
d767381445 refine codes and docs (#1733) 2022-03-07 17:26:30 +08:00
liu zhengxi
ebd6859ab7 Original Generate API supports role (#1727)
* generate support role
2022-03-07 16:40:43 +08:00
Huijuan Wang
ba3ea1cffa [cblue] support converting labels of multi-tasks 2022-03-07 16:10:50 +08:00
Huijuan Wang
205e5001f1 [ehealth] merge and move create_dataloader to utils.py 2022-03-07 14:14:53 +08:00
d294270681
4871622621 Add model Prohetnet (#1698)
* add Prohetnet model

* update prohetnet

* update format

* pre commit

* add prophetnet example

* update tokenizer.py,run_train.sh,train_prophetnet.py

* remove evaluate/gigaword/__init__.py

Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2022-03-07 10:30:23 +08:00
Zeyu Chen
92d82a859b Merge branch 'develop' into cblue 2022-03-05 15:08:16 +08:00
Huijuan Wang
61bfdd54ee [ehealth] fix metric and ehealth name 2022-03-04 14:10:20 +08:00
yujun
81398635cf update MultiHeadAttentionWithConv (#1643)
Co-authored-by: yingyibiao <yyb0576@163.com>
2022-03-04 10:59:26 +08:00
turkeymz
7b8dd49ad4 [Robert] support 2D attention_mask from tokenizer (#1676)
* [Robert] support 2D attention_mask from tokenizer

* format code style for yapf

* format code style for yapf

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-03-04 10:58:41 +08:00
Zhong Hui
1e14c2a92d [DOC] Update GPT Readme (#1718)
* [DOC] Update GPT Readme

Update GPT Readme

* Update README.md
2022-03-04 09:06:33 +08:00
chenxiaozeng
0782e912c9 Update README.md (#1725)
update QR code

Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2022-03-03 18:06:44 +08:00
smallv0221
a99f82f947 Merge branch 'develop' into update_doc 2022-03-03 18:06:29 +08:00
chenxiaozeng
f71b7d8f20 Update README_en.md (#1726) 2022-03-03 18:05:04 +08:00
chenxiaozeng
bc3a10885f Update README.md
update QR code
2022-03-03 17:52:46 +08:00
Noel
dc933f3dde Merge branch 'develop' into cblue 2022-03-03 17:20:32 +08:00
Huijuan Wang
66ccc0e06a [ehealth] fix problems in sequence classification 2022-03-03 17:13:13 +08:00
liu zhengxi
d4f0fa4e77 fix dy2sta (#1724) 2022-03-03 16:09:06 +08:00
liu zhengxi
dbd26feb80 Add PLATO-XL example (#1708) 2022-03-03 15:48:36 +08:00
liu zhengxi
4c36ef9e41 FasterUnifiedTransformer/PLATO support dy2sta (#1717)
* support ut dy2sta

* use jit load
2022-03-03 11:04:09 +08:00
liu zhengxi
4a9106570b FT support context forward acceleration (#1559)
* context acceleration support
2022-03-01 21:20:34 +08:00
chenxiaozeng
8801dc0643 Update doc (#1715)
* update QR code

* update QR code

* update doc
2022-03-01 16:34:06 +08:00
吴高升
4a1b98b939 Update Readme and Update Mivus feature extraction module (#1699)
* add recall inference similarity

* update examples

* updatea readme

* update dir name

* update neural search readme

* update milvus readme

* update domain adaptive pretraining readme

* fix the mistakes

* update readme

* add recall Paddle Serving Support

* update readme

* update readme and format the code

* reformat the files

* move the files

* reformat the code

* remove redundant code

* update changes

* Add C++ Paddle Serving

* Update Readme and Update Mivus feature extraction module

* check formats

* update serving config

* deleted redundant code

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-03-01 10:17:13 +08:00
QingshuChen
d5db194ea2 transformer support kunlun (#1712)
* transformer support kunlun
2022-02-28 13:15:34 +08:00
Aganlengzi
655df0b47a [NPU] support bowadding npu device configure (#1704) 2022-02-28 12:28:21 +08:00
Zhong Hui
090e636db5 [DOC] Update GPT README.md (#1710) 2022-02-25 18:24:10 +08:00
Guo Sheng
d329c802f6 Make NV FT support more size_per_head settings. (#1581)
* Make NV FT support more size_per_head settings.

* Delete debug printf.

* Fix masked_multihead_attention when THREADS_PER_BLOCK is not divisible by THREADS_PER_VALUE.


Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: liu zhengxi <380185688@qq.com>
2022-02-24 15:32:07 +08:00
Damonpkl
f6fca874b1 Fix deprecation warning: Use collections.abc to replace collections (#1707)
* 弃用警告:从collections中导入ABCs已被弃用,并在python3.8中将停止工作,可使用collections.abc代替它进行使用

* 弃用警告:从collections中导入ABCs已被弃用,并在python3.8中将停止工作,可使用collections.abc代替它进行使用

Co-authored-by: DamonBit <728004952@qq.com>
2022-02-24 13:18:41 +08:00
Huijuan Wang
15f0aa8f45 [ehealth] add sequence classification example 2022-02-23 20:40:07 +08:00
Jiaqi Liu
26fe221a06 fix inference bug (#1702) 2022-02-23 10:47:51 +08:00
Jiaqi Liu
b03753726e fix dir in readme (#1696) 2022-02-21 12:26:51 +08:00
Tony An
b1807db9bb fix bash typo (#1675)
the bash is --logdir instead logdir.
2022-02-21 01:02:07 +08:00
chenxiaozeng
3e0ff9af3f update QR code (#1693) 2022-02-19 22:13:02 +08:00
Baibaifan
09b4d17d41 [GPT] GPT-3 dygraph update sharding api usages (#1689)
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-02-18 11:36:18 +08:00
Jack Zhou
557f109ed4 Fix load_dataset args (#1687) 2022-02-17 19:32:44 +08:00
Jiaqi Liu
9ac1714ea1 Supports serving for PPMiniLM (#1620)
* supports serving

add copyright for serving

reorganize

* fix dir

* add readme

* update readme

* update serving readme

* fix some expression in serving readme

* fix serving readme
2022-02-17 16:25:10 +08:00
吴高升
eddc21d558 Add C++ Paddle Serving Support of neural search (#1667)
* add recall inference similarity

* update examples

* updatea readme

* update dir name

* update neural search readme

* update milvus readme

* update domain adaptive pretraining readme

* fix the mistakes

* update readme

* add recall Paddle Serving Support

* update readme

* update readme and format the code

* reformat the files

* move the files

* reformat the code

* remove redundant code

* update changes

* Add C++ Paddle Serving

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-02-17 13:38:54 +08:00
Jack Zhou
cae02abed9 add task embedding for ernie (#1628) 2022-02-17 11:27:59 +08:00
smallv0221
d5bdcfeeca fix gpt attention bug (#1685) 2022-02-16 15:41:10 +08:00
Zhong Hui
93647290d2 [BUGFIX] Update openwebtext2 dataset link. (#1684) 2022-02-16 14:31:43 +08:00
Zeyu Chen
8b713d28b3 Update README.md 2022-02-13 23:12:42 +08:00
Zeyu Chen
ce8dc9da62 Update README.md 2022-02-13 23:11:39 +08:00
Jiaqi Liu
029ec79ad7 Add more experimental data for PP-MiniLM (#1632)
* update ppminilm qa perf result

* add hardware info for perm data

add precision info for perf testing

fix punctuation

* fix readme

* add some exps

* modify some expressions

* Fix typo

* update paddleslim version info in readme

* update readme

* fix expression

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-02-13 23:10:26 +08:00
chenxiaozeng
1559f3b5c4 update group QR code (#1669) 2022-02-11 16:22:06 +08:00
smallv0221
059dd28696 fix generate api dont take 2d attention mask bug (#1641)
* fix generate api dont take 2d attention mask bug

* minor fix

Co-authored-by: gongenlei <gongel@qq.com>
2022-02-08 10:38:54 +08:00
chenxiaozeng
cff9a2585b update group QR code (#1662) 2022-02-03 10:18:04 +08:00
Huijuan Wang
275e62a9f1 [ehealth] add parameters of ehealth 2022-01-30 12:00:34 +08:00
Jiaqi Liu
9adaf58920 fix infer.py when use_faster_tokenizer == False (#1659) 2022-01-29 10:56:07 +08:00
liu zhengxi
3e9ee57bfe Fix Generation expand_inputs_for_generation when corresponding param is None (#1656) 2022-01-28 15:17:44 +08:00
yujun
c577cb4636 update T5Model Example doc (#1652)
Co-authored-by: yingyibiao <yyb0576@163.com>
2022-01-27 20:38:51 +08:00
Huijuan Wang
7153318373 [cblue] add datasets for sequence classification 2022-01-27 19:29:50 +08:00
chenxiaozeng
0fa78717c2 Update group QR code (#1651)
* update group QR code

* update group QR code

* fix format bug
2022-01-27 16:05:37 +08:00
Baibaifan
c728cabd3a [Sharding] Fix gpt3 sharding hybrid parallel (#1648) 2022-01-27 13:37:04 +08:00
Baibaifan
c720cf6254 [GPT-3] Support sharding stage2, stage3 for gpt-3 dygraph training (#1636)
Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2022-01-26 20:43:34 +08:00
Linjie Chen
3e68984baa Fix WordTag decode bug (#1642)
* fix wordtag decode

* Update README.md

* Update README.md

* Update codestyle
2022-01-26 17:41:30 +08:00
yingyibiao
28734abddb Add mengzi models (#1638)
* add mengzi models

* add mengzi models

* add mengzi models
2022-01-26 14:10:19 +08:00
Jack Zhou
8e94a979fc Fix batchify function of token classification task of FasterErnie. (#1583)
* fix token cls

* fix faster tokenizer pad_to_max_seq_bug

* Fix batch_max_seq
2022-01-26 14:03:17 +08:00
gongenlei
2197402037 [BUGFIX] Cnn_dailymail and xnli raise error when downloading in multi-gpus mode (#1587)
* fix: multi-gpus count file_num

* fix: update xnli

Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
2022-01-26 12:05:51 +08:00
smallv0221
1c10abadb7 Integrate HF Datasets and add DatasetTuple (#1612)
* fix bart perf

* update fastergeneration doc

* add img

* add img

* change img

* update img

* fix img

* update docs

* fix readme

* update readme

* fix perf

* fix perf

* fix modelling

* fix perf and sample code

* fix perf

* fix perf

* fix seq_len for gpt_sample

* add forced eos token id for faster

* upgrade perf and add forced eos token id

* chenge stack to gather

* add auto perf

* minor fix

* remove encoder change

* Update bart_perf.py

* Update bart_perf.py

* 1. Integrate HF Datasets
2. return all splits by default
3. load_dataset returns DatasetTuple now

* add HF Dataset example

* add kwargs for HF load_dataset

* change datasets to alternative

* remove experimental
2022-01-26 12:05:07 +08:00
gongenlei
32d01fa103 [BUGFIX] BART and mBART support 2D attention mask from tokenizer (#1637)
* fix: bart and mbart support 2d attention mask

* fix: bart and mbart support 2d attention mask
2022-01-26 11:28:41 +08:00
Zhong Hui
82b1cc421c [BugFix] [Pre-training] Fix mlm label of dataset_utils (#1633) 2022-01-25 16:39:53 +08:00
liu zhengxi
2455ec2cd0 Fix Transformer amp (Fix #1574) (#1635) 2022-01-25 14:33:27 +08:00
yujun
8993c321ad support 2D attention_mask from tokenizer (#1634) 2022-01-25 11:15:49 +08:00
Zeyu Chen
f20539d80b Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2022-01-24 16:43:29 +08:00
hysunflower
078758e192 Merge pull request #1629 from hysunflower/drop_benchmark_models
drop gpt fp32 in benchmark
2022-01-24 11:28:51 +08:00
hysunflower
075423cfee drop gpt fp32 in benchmark 2022-01-24 03:15:06 +00:00
gongenlei
7b455cce47 feat: add conll2002 dataset (#1561)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-01-22 14:54:17 +08:00
Jiaqi Liu
22a497cb30 Update PPMiniLM performance result tested by QA (#1602)
* update ppminilm qa perf result

* add hardware info for perm data

add precision info for perf testing

fix punctuation

* fix readme
2022-01-22 14:52:02 +08:00
Zeyu Chen
31b6fd99b2 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2022-01-22 14:40:19 +08:00
Zeyu Chen
48a226f953 Update issues template 2022-01-21 17:00:55 +08:00
smallv0221
ed11f1f5f5 Fix roberta tokenizer (#1618)
* fix truncation_strategy for tokenizer

* fix roberta tokenizer

Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
2022-01-21 11:26:47 +08:00
Zeyu Chen
eb22a182c3 Update README 2022-01-21 10:31:01 +08:00
smallv0221
83b96f4e84 fix truncation_strategy for tokenizer (#1615) 2022-01-20 19:50:11 +08:00
Jack Zhou
eb1dd6d366 fix min_sub_graph (#1606) 2022-01-20 15:41:34 +08:00
Linjie Chen
df48dea129 fix typos (#1609) 2022-01-20 15:41:15 +08:00
chenxiaozeng
2986c930c7 Update README.md (#1603) 2022-01-19 15:18:02 +08:00
Jiaqi Liu
27d87b6caf Update shape range setting method (#1599)
* update shape range setting method

* fix readme

* fix readme

* update readme
2022-01-17 19:19:50 +08:00
吴高升
0334963bd4 Add ErnieForMultipleChoice (#1597)
* add recall inference similarity

* update examples

* updatea readme

* update dir name

* update neural search readme

* update milvus readme

* update domain adaptive pretraining readme

* fix the mistakes

* update readme

* add recall Paddle Serving Support

* update readme

* update readme and format the code

* reformat the files

* move the files

* reformat the code

* remove redundant code

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-01-17 15:46:23 +08:00
Jiaqi Liu
22cee265ab Fix ppminilm export bug (#1596)
* fix ppminilm export bug

* update export script

* update readme
2022-01-17 12:44:32 +08:00
Zhong Hui
a5f8a3ec9d [Pre-Training] Add tutorial for clue small 14g dataset (#1555)
* add tutorial for clue small 14g.

* add pre-train weight to community.

* fix typos.

* fix typo.

* add dataset link.

* change name to ernie-1.0-cluecorpussmall

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-01-15 21:08:38 +08:00
Zeyu Chen
cf51c8ae4c Update README.md 2022-01-15 09:51:49 +08:00
gongenlei
60608d3906 fix: fix windows dtype to int64 (#1588) 2022-01-13 16:12:26 +08:00
吴高升
6213573384 Update neural search readme and Add Paddle Serving Support (#1558)
* add recall inference similarity

* update examples

* updatea readme

* update dir name

* update neural search readme

* update milvus readme

* update domain adaptive pretraining readme

* fix the mistakes

* update readme

* add recall Paddle Serving Support

* update readme

* update readme and format the code

* reformat the files

* move the files

* reformat the code

* remove redundant code

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: tianxin <tianxin04@baidu.com>
2022-01-13 14:08:23 +08:00
liu zhengxi
2a620ba2f2 update paddle version in readme when using amp training (#1586) 2022-01-13 10:55:53 +08:00
Jiaqi Liu
e321e092a0 update ppminilm readme (#1584)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-01-12 22:19:33 +08:00
Jack Zhou
b0c35d5e1f Fix the attention mask for fp16 (#1585) 2022-01-12 22:11:26 +08:00
gongenlei
b3130851db [CI] Add max_steps for pointer_summarizer and ernie-gen (#1556)
* feat: add max_steps for pointer_summarizer

* fix: read encoding

* feat: add max_steps for ernie-gen

* style: enable yapf
2022-01-12 14:27:34 +08:00
yingyibiao
82e4316df8 add pretrained model url (#1575) 2022-01-12 11:34:10 +08:00
Jiaqi Liu
85f4cc0ec1 Fix PPMiniLM quantization bug (#1580)
* update ppminilm, support export faster tokenizer

* supoprts pruning

* update quantation code

* fix quant generator for text pair dataset

* pad_to_max_seq_len defaults to False

* update ppminilm readme data

* update readme

* update readme

* remove save_inference_model_with_tokenizer arg

* update modeling

* update export

* update modeling

update export

delete useless code

* fix quant input bug
2022-01-12 10:51:15 +08:00
zhangbo9674
1e4975d426 [amp] refine transformer fp16 train (#1574) 2022-01-12 10:38:37 +08:00
Jiaqi Liu
4ac2811533 Add FasterTokenizer on PPMiniLM (#1542)
* update ppminilm, support export faster tokenizer

* supoprts pruning

* update quantation code

* fix quant generator for text pair dataset

* pad_to_max_seq_len defaults to False

* update ppminilm readme data

* update readme

* update readme

* remove save_inference_model_with_tokenizer arg

* update modeling

* update export

* update modeling

update export

delete useless code
2022-01-11 17:34:32 +08:00
Jack Zhou
bdda90143b Fix faster_tokenizer default args (#1571)
* fix args

* delete convert_bin_npz.py
2022-01-11 15:41:56 +08:00
Linjie Chen
c1d5241d58 Unified customization for Taskflow (#1517)
* Add custom model inferface for lac & user dict interface for wordtag

* Update README.md

* Update term-linking

* Update README.md

* Update README.md

* add custom method

* Update README.md

* Update README.md

* Unified custom interface for Taskflow

* Update model inference

* Add config files

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* remove unused code

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update main cls
2022-01-11 14:50:19 +08:00
Milen
24ac65d7c6 fix dtype problem when performing quantization function in windows (#1577)
* sentiment analysis initializing

* modify README.md

* sentiment analysis initializing

* modify data_ext and data_cls link in README.md

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete unuseful info.

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete sentiment_system.png

* add sentiment_system.png

* refine readme.md

* sentiment analysis intializing

* mv data and checkpoints in sub_dir to parent_dir

* refine readme.md

* refine readme

* refine readme.md, modify requirements

* refine readme.md

* refine readme.md

* refine readme.md

* mv run_export.sh to run_export_model.sh

* refine readme.md

* remove some

* remove some unnecessary packages

* delete unuseful compute_md5 method

* sentiment analysis initializing

* sentiment analysis initializing

* refine readme.md

* set CUDA_VISIBLE_DEVICES=0

* refine style  with pre-commit

* use ppminilm in ernie instead of offline ppminilm

* refine readme

* load ppminilm in transformers.PPMiniLMModel, not load in ErnieModel

* use model in transformers, not implement it personally

* refine style with pre-commit

* set paddlenlp version == 2.2.2

* refine readme

* refine readme

* refine readme

* fix bug, make sure that length of input_text and label is  equal when deocding

* fix bug, make sure that the length of input_text and label is equal

* fix some mistakes in readme

* refine procedure

* refine readme

* set dtype=64 to fix dtype problem in windows

* set dtype=64 to fix dtype problem in windows

* set 2 max_seq_len for ext_ and cls_ model

* refine readme

* fix dtype problem in windows

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
2022-01-11 13:19:23 +08:00
HJHGJGHHG
737e4fa0e8 Add FNet (#1499)
* Upload FNet model files

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Update modeling.py

* Update tokenizer.py

Co-authored-by: yingyibiao <yyb0576@163.com>
2022-01-11 11:05:45 +08:00
hysunflower
719485c674 Merge pull request #1573 from hysunflower/fix_scripts
fix scripts
2022-01-10 10:57:36 +08:00
hysunflower
33d960b23a fix scripts 2022-01-10 02:34:49 +00:00
Steffy-zxf
e80b4c17a7 process data when required avoid occupied too much memory (#1550)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2022-01-08 23:30:27 +08:00
GT-Zhang
7fea9ffd97 修复Readthedocs文档显示问题 (#1570)
[https://paddlenlp.readthedocs.io/zh/latest/data_prepare/dataset_list.html](https://paddlenlp.readthedocs.io/zh/latest/data_prepare/dataset_list.html)处文本生成文档图表显示异常,增加一次换行即可解决问题
2022-01-08 22:39:26 +08:00
gongenlei
be5299ef0e fix: add args.min_target_length (#1560) 2022-01-07 19:43:21 +08:00
Milen
54f2f0694a refine readme and fix dtype problem in windows (#1568)
* sentiment analysis initializing

* modify README.md

* sentiment analysis initializing

* modify data_ext and data_cls link in README.md

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete unuseful info.

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete sentiment_system.png

* add sentiment_system.png

* refine readme.md

* sentiment analysis intializing

* mv data and checkpoints in sub_dir to parent_dir

* refine readme.md

* refine readme

* refine readme.md, modify requirements

* refine readme.md

* refine readme.md

* refine readme.md

* mv run_export.sh to run_export_model.sh

* refine readme.md

* remove some

* remove some unnecessary packages

* delete unuseful compute_md5 method

* sentiment analysis initializing

* sentiment analysis initializing

* refine readme.md

* set CUDA_VISIBLE_DEVICES=0

* refine style  with pre-commit

* use ppminilm in ernie instead of offline ppminilm

* refine readme

* load ppminilm in transformers.PPMiniLMModel, not load in ErnieModel

* use model in transformers, not implement it personally

* refine style with pre-commit

* set paddlenlp version == 2.2.2

* refine readme

* refine readme

* refine readme

* fix bug, make sure that length of input_text and label is  equal when deocding

* fix bug, make sure that the length of input_text and label is equal

* fix some mistakes in readme

* refine procedure

* refine readme

* set dtype=64 to fix dtype problem in windows

* set dtype=64 to fix dtype problem in windows

* set 2 max_seq_len for ext_ and cls_ model

* refine readme

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
2022-01-07 19:40:57 +08:00
hysunflower
b15382b9b7 Merge pull request #1567 from hysunflower/update_benchmark_scripts
[benchmark] update gpt benchmark scripts
2022-01-07 16:51:29 +08:00
hysunflower
5163ae67b2 update gpt scripts, test=document_fix 2022-01-07 08:21:48 +00:00
hysunflower
2a4b8ee382 update gpt scripts, test=document_fix 2022-01-07 07:44:48 +00:00
hysunflower
9e74b50c15 update gpt scripts, test=document_fix 2022-01-07 07:41:08 +00:00
hysunflower
a7d8fc1212 update gpt scripts, test=document_fix 2022-01-07 07:32:46 +00:00
hysunflower
1333d435e6 update gpt scripts, test=document_fix 2022-01-07 07:31:34 +00:00
hysunflower
0317a5c403 update_benchmark_scripts 2022-01-07 07:00:41 +00:00
chenxiaozeng
72e242ff0b Update README_en.md (#1563) 2022-01-06 21:32:38 +08:00
chenxiaozeng
5bef34ae49 Update README.md (#1562)
Replace QQ QR code with wechat QR code.
2022-01-06 21:32:21 +08:00
Jack Zhou
3d3bc82c85 use paddle.einsum instead of paddlenlp.ops.einsum (#1557) 2022-01-04 21:49:45 +08:00
smallv0221
809bb57eee fix t5 tokenizer (#1543)
* Update FG doc

* update doc

* update tokenizer

* add add_token for tokenizers

* upgrade t5 tokenizer

* upgrade other tokenizers

* reset roberta

* minor fix

* upgrade

* minor fix

* fix t5

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: yingyibiao <yyb0576@163.com>
2021-12-31 21:00:17 +08:00
yingyibiao
b27c647f51 Fix albert tokenizer (#1535)
* Fix albert tokenizer

* Update albert tokenizer

* update keyword args
2021-12-31 19:43:32 +08:00
smallv0221
51793e8f15 Upgrade tokenizer (#1496)
* Update FG doc

* update doc

* update tokenizer

* add add_token for tokenizers

* upgrade t5 tokenizer

* upgrade other tokenizers

* reset roberta

* minor fix

* upgrade

* minor fix

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: yingyibiao <yyb0576@163.com>
2021-12-31 18:48:28 +08:00
liu zhengxi
e8c7474d04 Fix FasterTransformer when export float16 model (#1539) 2021-12-31 14:31:32 +08:00
yujun
4911fe49d5 Fix ctrl tokenizer vocab link (#1541)
* update

* ctrl max_len = none
2021-12-31 14:04:45 +08:00
wawltor
128a7e5df8 Merge pull request #1515 from joey12300/fix_some_error
Fix the usage of nltk bug
2021-12-30 19:40:07 +08:00
Yanxing Shi
e1842d749f fix the ips of Bert in the static graph (#1518)
* fix_ips and data sampler

* fix train_batch_sampler

* fix train_batch_sampler

* fix batch_sampler

* fix bug

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-12-30 19:29:23 +08:00
Milen
a8242221b6 fix bug: make sure that the length of input_text and label is equal (#1540)
* sentiment analysis initializing

* modify README.md

* sentiment analysis initializing

* modify data_ext and data_cls link in README.md

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete unuseful info.

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete sentiment_system.png

* add sentiment_system.png

* refine readme.md

* sentiment analysis intializing

* mv data and checkpoints in sub_dir to parent_dir

* refine readme.md

* refine readme

* refine readme.md, modify requirements

* refine readme.md

* refine readme.md

* refine readme.md

* mv run_export.sh to run_export_model.sh

* refine readme.md

* remove some

* remove some unnecessary packages

* delete unuseful compute_md5 method

* sentiment analysis initializing

* sentiment analysis initializing

* refine readme.md

* set CUDA_VISIBLE_DEVICES=0

* refine style  with pre-commit

* use ppminilm in ernie instead of offline ppminilm

* refine readme

* load ppminilm in transformers.PPMiniLMModel, not load in ErnieModel

* use model in transformers, not implement it personally

* refine style with pre-commit

* set paddlenlp version == 2.2.2

* refine readme

* refine readme

* refine readme

* fix bug, make sure that length of input_text and label is  equal when deocding

* fix bug, make sure that the length of input_text and label is equal

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
2021-12-30 18:31:48 +08:00
zhoushunjie
05e80c0e85 refine doc 2021-12-30 16:45:37 +08:00
gongenlei
7c8dd35955 [ERNIE-M] Add ernie-m (#1510)
* feat: add ernie-m

* docs: update docstring

* add copyright

* update tokeizer: load_vocab->load_vocabulary

* getting length of dataset automatically

* add result to doc

* docs: update result

* docs: del some res

* docs: update doc

* feat: ernie_m supports auto

* feat: add dropout

* docs: update res

* docs: update params
2021-12-30 11:15:49 +08:00
liu zhengxi
cc9dc322ef Add transformer tipc (#1472)
* add transformer tipc

* update

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-12-29 23:49:02 +08:00
吴高升
4b50fdb885 update neural search readme (#1530)
* add recall inference similarity

* update examples

* updatea readme

* update dir name

* update neural search readme

* update milvus readme

* update domain adaptive pretraining readme

* fix the mistakes

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-12-29 23:40:49 +08:00
Milen
a42800c408 set paddlenlp version == 2.2.2 (#1533)
* sentiment analysis initializing

* modify README.md

* sentiment analysis initializing

* modify data_ext and data_cls link in README.md

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete unuseful info.

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete sentiment_system.png

* add sentiment_system.png

* refine readme.md

* sentiment analysis intializing

* mv data and checkpoints in sub_dir to parent_dir

* refine readme.md

* refine readme

* refine readme.md, modify requirements

* refine readme.md

* refine readme.md

* refine readme.md

* mv run_export.sh to run_export_model.sh

* refine readme.md

* remove some

* remove some unnecessary packages

* delete unuseful compute_md5 method

* sentiment analysis initializing

* sentiment analysis initializing

* refine readme.md

* set CUDA_VISIBLE_DEVICES=0

* refine style  with pre-commit

* use ppminilm in ernie instead of offline ppminilm

* refine readme

* load ppminilm in transformers.PPMiniLMModel, not load in ErnieModel

* use model in transformers, not implement it personally

* refine style with pre-commit

* set paddlenlp version == 2.2.2

* refine readme

* refine readme

* refine readme

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
2021-12-29 23:39:58 +08:00
liu zhengxi
65334b5472 fix paddlenlp import issues (#1536) 2021-12-29 23:38:53 +08:00
gongenlei
49f7f0d4da [XNLI] Add xnli dataset (#1474)
* feat: add xnli dataset

* feat: add xnli dataset

* refactor: update

* docs: add dataset doc

* fix: remove empty data

* fix: mv xnli to xnli_cn

* refactor: simplify code

* fix: use paddle.utils.download

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-12-29 21:26:36 +08:00
yingyibiao
39cbfeda2a add t5-v1_1 checkpoints (#1534)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-12-29 20:48:50 +08:00
Jiaqi Liu
032677e95b Add ppminilm inference (#1503)
* add use_faster_tokenizer arg

* add infer.py

* add chnsenticorp support, upddate infer using faster tokenizer

* update infer

* update fasterPPminiLM

* update performance test data, and fix general readme

* update readme

* remove ppminilm

* update prune.py

* update readme

* update run_clue

* update shell command
2021-12-29 19:57:54 +08:00
wawltor
6277abfedb Merge pull request #1519 from TmengT/TmengT-patch-1
Update knowledge_mining.py
2021-12-29 15:24:44 +08:00
Milen
dcabd4f999 use suitable models for PP-MiniLM and SKEP (#1531)
* sentiment analysis initializing

* modify README.md

* sentiment analysis initializing

* modify data_ext and data_cls link in README.md

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete unuseful info.

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete sentiment_system.png

* add sentiment_system.png

* refine readme.md

* sentiment analysis intializing

* mv data and checkpoints in sub_dir to parent_dir

* refine readme.md

* refine readme

* refine readme.md, modify requirements

* refine readme.md

* refine readme.md

* refine readme.md

* mv run_export.sh to run_export_model.sh

* refine readme.md

* remove some

* remove some unnecessary packages

* delete unuseful compute_md5 method

* sentiment analysis initializing

* sentiment analysis initializing

* refine readme.md

* set CUDA_VISIBLE_DEVICES=0

* refine style  with pre-commit

* use ppminilm in ernie instead of offline ppminilm

* refine readme

* load ppminilm in transformers.PPMiniLMModel, not load in ErnieModel

* use model in transformers, not implement it personally

* refine style with pre-commit

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
2021-12-29 14:42:53 +08:00
chenxiaozeng
4070783a5b Update README.md (#1523)
add news: applications
2021-12-28 20:56:43 +08:00
Jack Zhou
ec7fb3da42 Fix return_mask bug in squad for ernie, bert model (#1522)
* fix return_mask bug in squad for ernie, bert model

* add position_ids, attention_mask for BertForQuestionAnswering
2021-12-28 18:56:14 +08:00
Jiaqi Liu
d82766be1d pdate general distill in ppminilm (#1520) 2021-12-28 16:01:32 +08:00
Jiaqi Liu
a16c4bce16 Add PPMiniLM class (#1512)
* add ppminilm class

* update copyright

* add ppminilm tokenizer to __init__

* update ppminilm

* remove useless comments, remove ernie

* remove useless readme, remove ernie
2021-12-28 15:25:23 +08:00
蒙虒
588e5de602 Update knowledge_mining.py
一句话 word_tag后, 最后一个词未被标识出来。
2021-12-28 14:20:21 +08:00
Zeyu Chen
806ff6f998 Update citation tittles 2021-12-27 23:59:58 +08:00
Zeyu Chen
191f6aba40 Update README.md 2021-12-27 23:45:24 +08:00
zhoushunjie
c848db5344 move nltk initialization to __init__ 2021-12-27 18:06:21 +08:00
Zeyu Chen
3043717f0b Update application folders 2021-12-27 17:25:35 +08:00
zhoushunjie
a1d27c3051 avoid import nltk==3.6.6 bug 2021-12-27 17:24:48 +08:00
Milen
a93a047b02 Sentiment Analysis Application (#1505)
* sentiment analysis initializing

* modify README.md

* sentiment analysis initializing

* modify data_ext and data_cls link in README.md

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete unuseful info.

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* sentiment analysis initializing

* delete sentiment_system.png

* add sentiment_system.png

* refine readme.md

* sentiment analysis intializing

* mv data and checkpoints in sub_dir to parent_dir

* refine readme.md

* refine readme

* refine readme.md, modify requirements

* refine readme.md

* refine readme.md

* refine readme.md

* mv run_export.sh to run_export_model.sh

* refine readme.md

* remove some

* remove some unnecessary packages

* delete unuseful compute_md5 method

* sentiment analysis initializing

* sentiment analysis initializing

* refine readme.md

* set CUDA_VISIBLE_DEVICES=0

* refine style  with pre-commit

* use ppminilm in ernie instead of offline ppminilm

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
2021-12-27 11:28:01 +08:00
吴高升
843c69af49 Add recall inference similarity (#1507)
* add recall inference similarity

* update examples

* updatea readme

* update dir name
2021-12-25 13:01:26 +08:00
Linjie Chen
3012065e8c Update README.md (#1508)
* Update README.md

* Update README.md

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-12-24 18:25:19 +08:00
smallv0221
4359f6b8d5 Fix multiprocess dataset map (#1511)
* fix multiprocess in dataset.map

* minor fix
2021-12-24 18:24:45 +08:00
Zeyu Chen
7fb53ae735 Update application forlder name 2021-12-24 15:40:48 +08:00
zzz2010
74f9fae19b funnel transformer (#1419)
* first version

* add funnel to init.py and run_squad.py

* add attention_mask

* rename FunnelTokenizerFast to FunnelTokenizer

* revised based on the PR comments

* further clean up function description section

* further clean up

* pre-commit check

* pre-commit check

* pre-commit check

Co-authored-by: chfhf <544062970@qq.com>
2021-12-23 22:35:23 +08:00
Zhong Hui
a8b1956050 [BUGFIX] Fix ln link of files in gpt-3. (#1500) 2021-12-23 14:06:41 +08:00
Zhong Hui
09f18731a2 [ERNIE] Add parameter converter from static to dygraph. (#1478) 2021-12-23 14:05:28 +08:00
liu zhengxi
f631d3edb9 Delete confusing parameter to make FT JIT easy to activate (#1495)
* fix need build of faster generation

* update

* update
2021-12-22 17:04:59 +08:00
Jiaqi Liu
8aa407e700 update ernie tiny acc (#1494) 2021-12-21 14:40:41 +08:00
yingyibiao
b089b21e66 Windows support for LayoutXLM model (#1489) 2021-12-20 19:44:58 +08:00
Jiaqi Liu
d94b6283b4 fix ppminilm scripts bug (#1490) 2021-12-20 19:40:32 +08:00
smallv0221
55130a9c35 Update FG doc (#1488)
* Update FG doc

* update doc
2021-12-20 17:08:41 +08:00
Jiaqi Liu
50f71b3f73 update readme, csl and uer wsc tinybert wsc (#1487)
update

update
2021-12-20 13:57:56 +08:00
Zeyu Chen
b3b05581e0 Update examples and README 2021-12-18 22:37:33 +08:00
Zeyu Chen
e44a5672da Update README.md 2021-12-18 13:12:23 +08:00
Zeyu Chen
01c6bfafa4 Update taskflow.md 2021-12-18 12:55:01 +08:00
Linjie Chen
9dc70b423f Update README.md (#1481)
* Update README.md

* Update README.md

* Update README.md

* Update README.md

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-12-17 20:41:11 +08:00
Zeyu Chen
69faee4375 Update README.md 2021-12-17 19:34:21 +08:00
wawltor
f56e4291a6 Merge pull request #1483 from PaddlePaddle/update-faster-tokenizer-map
Support ppminilm in FasterTokenizer
2021-12-17 17:41:44 +08:00
Jiaqi Liu
10fc6a6272 Support ppminilm in FasterTokenizer 2021-12-17 17:38:08 +08:00
吴高升
374d31b7da Add neural search application codes (#1463)
* add semantic indexing files

* update indexing code

* update milvus config

* update readme

* update readme

* update readme

* update readme

* add code

* add export model

* add base model

* add inference code

* fix the inference bug

* rename dir

* add ernie matching code

* update ernie matching code

* update readme

* update readme

* update readme

* rename dir

* update ernie 1.0

* update ernie readme

* add simcse

* update simcse readme

* add inbach negative code

* update readme

* add batch neg train code

* update readme

* add experimental results

* update readme

* update readme

* update milvus files

* update readme

* add missing codes

* add requirements

* add inbatch negative

* add inbatch negative code

* update batch negative

* update code

* update

* add simcse codes

* update the readme

* update simcse readme

* add simcse infer code

* add simcse inference

* update model

* update readme

* update ernie matching readme

* update readme

* remove redundant code

* update readme

* update inbatch readme

* update readme

* update recall set

* update readme

* update readme

* updatea bash

* update inbatch negative readme

* update readme

* update readme

* delete anne files

* update baseline

* update cpu support

* update readme

* update readme

* update readme

* update readme

* rename readme

* update

* update readme

* update files

* update files

* update readme

* update readme

* add simcse codes

* delete files

* update simcse

* update readme

* add updates

* update readme

* update readme

* update cpu setting

* add text matching

* update bash

* update export module

* update

* update readme

* update files ernie 1.0

* update files

* add updates

* update readme

* update readme

* delete reduntant code

* update readme

* update readme

* update readme

* move dir

* update readme

* update readme

* update readme

* update readme

* update readme

* update

* update readme

* update readme

* update readme

* update files

* update readme

* update readme

* update readme

* update img

* update readme

* update readme

* update readme

* update names

* update requirements

* adjust the directory

* update readme

* update readme

* update readme

* update readme

* update readme

* update

* Tiny Fix

Updata

* update readme

* update readme

* update readme

* update readme

* update

* adjust the readme format

* update readme

* update readme

* add RocketQA

* update readme

* Update

* update readme

* update data sample

* Update README.md

Co-authored-by: mls1999725 <546278509@qq.com>
Co-authored-by: tianxin <tianxin04@baidu.com>
Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
2021-12-17 15:34:55 +08:00
Linjie Chen
7336d52dc5 Fix windows dtype (#1480)
* fix variable name

* fix windows dtype
2021-12-17 12:13:21 +08:00
liu zhengxi
fa1fa7565b Transformer decoding support fuse qkv (#1455)
* decoding support fuseqkv ! ! !

* update force version

* fp16

* alternative

* force decoding support global cublashandle and cublaslthandle

* update

* update

* update

* rm ref

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: Guo Sheng <whucsgs@163.com>
2021-12-17 11:54:38 +08:00
Linjie Chen
5f2862a347 Add plato-mini for taskflow (#1383)
* Add plato-mini for taskflow

* Update README.md

* Update README.md

* Update README.md

* Update model generation

* Update task display

* Update interactive mode

* Update usage
2021-12-17 11:20:10 +08:00
Zhong Hui
1ecff72d07 [PRETRAIN] Change some hyper parameters of ernie-1.0 (#1344)
* fix ernie, Normal->TruncatedNormal,  smaller steps. 

* fix by set attn_mask to -1e4
2021-12-17 10:56:38 +08:00
Jiaqi Liu
868e7a234d Add PP-MiniLM (#1403)
* # This is a combination of 2 commits.
# The first commit's message is:

update inference

# This is the 2nd commit message:

update

* solve conflicts

fix infer perf

remove useless comments

* update readme

* update readme

update readme

* delete useless char

* update reamde

update code and readme

update readme

Add serial number to readme

update readme

Added a catalog

fix a catalog bug

fix a catalog bug

* update reamde

update reamde

update readme

update reamde

update readme

* update readme, add general readme, remove 'ofa'

* remove infe_perf

* Update README

* Update README

* remove blank space between Chinese characters and numbers

* add blank space

fix director

* update data in readme

* add blank space

* update readme

Co-authored-by: tianxin <tianxin04@baidu.com>
2021-12-16 22:40:14 +08:00
smallv0221
cc58a2390f Fix diversity rate bug (#1477)
* update perf

* fix doc and constrains for FasterGeneration

* update readme

* fix diversity rate bug
2021-12-16 21:53:15 +08:00
smallv0221
4e59ce0212 Fix docs and constrains for FasterGeneration (#1471)
* update perf

* fix doc and constrains for FasterGeneration

* update readme
2021-12-16 21:23:19 +08:00
tianxin
f580332a2e Tiny Fix (#1470) 2021-12-16 00:43:46 +08:00
Steffy-zxf
4d06421908 simpify codes and fix dtype bug in win (#1469) 2021-12-15 17:07:18 +08:00
huhuiwen99
b4542fa638 New doc updata 12 (#1459)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* xfund

* update

* update

* fix errors

* add layoutlm

* add t5

* update

* updat4e
2021-12-15 15:09:51 +08:00
Linjie Chen
7fab504d30 fix bugs on windows (#1465) 2021-12-15 15:04:12 +08:00
wawltor
87fa30b62e Add the tokeniers version in fastertokenizer (#1461) 2021-12-14 15:41:49 +08:00
smallv0221
eb5385bc96 update perf (#1457) 2021-12-14 14:43:44 +08:00
yingyibiao
e35f1ee58c Update package_data (#1454) 2021-12-13 20:25:06 +08:00
Zhong Hui
72d6590eca fix max_steps of msra_ner. (#1451) 2021-12-13 18:05:39 +08:00
chenxiaozeng
292ac62568 Update index.rst (#1453)
Fix a bug. Keep consistent with the main readme later when the readme updated.
2021-12-13 18:05:08 +08:00
yingyibiao
c612049f92 Update url (#1452) 2021-12-13 15:21:35 +08:00
Steffy-zxf
583f7246e3 fix c_ops compatibility (#1450)
* fix c_ops compatibility with initial breakdowns and track and signalling compatibility issues under paddle 2.2.1
2021-12-13 11:06:56 +08:00
Linjie Chen
d1140bb15d fix typo and update version info (#1449) 2021-12-11 22:43:44 +08:00
wawltor
449b939d96 Merge pull request #1448 from Steffy-zxf/upstream-develop
update paddle verion requires
2021-12-11 14:19:59 +08:00
Steffy-zxf
ff1103e8c8 update paddle verion requires 2021-12-11 14:06:01 +08:00
wawltor
5a3e2c04cd Update README.md 2021-12-11 13:21:09 +08:00
wawltor
26ad5ebc1a Update README.md 2021-12-11 13:18:00 +08:00
wawltor
09a43edcbe Merge pull request #1444 from wawltor/faster_tokenizer_cp
update document for the FasterTokenizer
2021-12-11 13:07:55 +08:00
wawltor
7a438f43ba Update README.md 2021-12-11 05:01:59 +00:00
wawltor
ad06f37c18 Update README.md 2021-12-11 13:00:04 +08:00
Guo Sheng
9d9bd67f29 Add use_faster to faster_gpt sample. (#1443) 2021-12-11 00:12:23 +08:00
liu zhengxi
0720afe814 Transformer supports ft faster encoder (#1430)
* transformer support ft encoder


Co-authored-by: Guo Sheng <whucsgs@163.com>
2021-12-10 23:13:05 +08:00
tianxin
3a24b612ae tiny fix of README (#1440)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-12-10 23:02:28 +08:00
smallv0221
4b870be191 Update readme and fix expand for FasterGPT and FasterMbart (#1436)
* add attn_mask input for encoder-decoder

* update readme and fix expand for FasterGPT and FasterMbart

* add image

* fix image size

* fix image

* fix expand for attention mask

* remove paddlenlp perf

* fix doc

* remove attention mask in expand

Co-authored-by: Guo Sheng <whucsgs@163.com>
2021-12-10 22:58:39 +08:00
yingyibiao
6cac0aced7 fix typo (#1442) 2021-12-10 21:21:36 +08:00
Guo Sheng
40f39fd065 Restrict size_per_head in GPT to use FT. (#1441)
* Restrict size_per_head to use FT.

* Fix GPT chinese detokenizing for FasterGPT samples.
2021-12-10 21:04:00 +08:00
tianxin
6a3f295ac9 tiny fix (#1439) 2021-12-10 19:43:50 +08:00
tianxin
aec3119907 add attn_mask input for encoder-decoder (#1431) (#1438) 2021-12-10 19:20:41 +08:00
yingyibiao
f079f91c48 update bos url (#1437) 2021-12-10 18:37:04 +08:00
huhuiwen99
21e61b5b07 Docs Update (#1432)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* init layoutlm model

* modify layoutlmmodel

* test

* fix errors

* add layoutlmformaskedlm

* modify tokenizer

* update

* update

* add layoutlm example

* add example

* update

* update

* delete data

* update

* modify preprocess

* update

* modify loss

* modify example

* find error

* fix errors

* fix errors

* update

* update

* update
2021-12-10 16:33:12 +08:00
smallv0221
e468e19e5e add attn_mask input for encoder-decoder (#1431) 2021-12-10 16:23:17 +08:00
wawltor
10ac335ccd Merge pull request #1420 from linjieccc/up_wordtag
Update usage of wordtag
2021-12-10 16:14:50 +08:00
yingyibiao
072b9ff086 fix model_id (#1433) 2021-12-10 15:59:02 +08:00
27182812
5af122b71c Chinese bert (#1429)
* add docs

* add docs

* Update tokenizer.py

try import pypinyin

* update pypinyin

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-12-10 15:05:51 +08:00
huhuiwen99
beed3da7db Modify Layoutlm example (#1418)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* init layoutlm model

* modify layoutlmmodel

* test

* fix errors

* add layoutlmformaskedlm

* modify tokenizer

* update

* update

* add layoutlm example

* add example

* update

* update

* delete data

* update

* modify preprocess

* update

* modify loss

* modify example

* find error

* fix errors

* fix errors
2021-12-10 14:50:20 +08:00
Jiaqi Liu
8268726456 Update distill_utils to support PP-MINILM (#1426)
* update distill utils to support PP-MiniLM

update function name

update

remove ununsed import

* update doc for loss_fct

* add description for loss_fct
2021-12-10 14:38:53 +08:00
linjieccc
d3fcc6181e Update README.md 2021-12-10 06:25:34 +00:00
Penghui Zhao
41ab2653cb [PaddlePaddle Hackathon] 55题 提交 (#1133)
* add roberta model

* rollback

* .

* upd roberta convert

* upd

* upd

* upd compare

* upd unitest

* upd unnitest

* upd roberta convert

* clean code

* upd tokenizer config

* upd model_config

* add pretrain weight file json

* upd pretrained_model_rst

* rename pretrain model name

* upd tokenizer pretrained_resource_files_map

* upd tokenizer pretrained_resource_files_map

* upd tokenizer info

* unify tokenizer

* unify tokenizer

* Update tokenizer.py

* Update README.md

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-12-10 11:58:27 +08:00
wawltor
91c1a49c49 Merge pull request #1425 from linjieccc/update_url
Update URL for datasets
2021-12-10 11:03:26 +08:00
liu zhengxi
4d9f920521 Fix sampling randomly fail in FasterTransformer (#1427)
Fix sampling randomly fail in FasterTransformer
2021-12-10 10:35:19 +08:00
linjieccc
aea393eb7a Update URL for datasets 2021-12-09 14:10:55 +00:00
liu zhengxi
b37d218243 fix paddle.sum (#1422) 2021-12-09 21:45:18 +08:00
linjieccc
d19ad50ad4 Update README.md 2021-12-09 13:08:44 +00:00
linjieccc
18f3a7c356 Update usage of wordtag 2021-12-09 13:03:05 +00:00
27182812
0287e5475d add model chinesebert (#1100)
* add model chinesebert

add model chinesebert
paddle model weights:
https://drive.google.com/file/d/1Cze9mZGX9_1btGCCYTdb7PA2PNPvw2is/view?usp=sharing

* 修改完善

* update

* delete logs

* delete datasets

* delete

* update

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-12-09 19:24:39 +08:00
Linjie Chen
e27ac6a046 Support segmented inputs for ddparser (#1351)
* Support segmented inputs for ddparser

* Update usage

* Update ddparser segmode

* Update README.md

* Update README.md

* Update taskflow.md
2021-12-09 17:28:21 +08:00
huhuiwen99
570685fd43 Add LayoutLMModel (#1362)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* init layoutlm model

* modify layoutlmmodel

* test

* fix errors

* add layoutlmformaskedlm

* modify tokenizer

* update

* update

* add layoutlm example

* add example

* update

* update

* delete data

* update

* modify preprocess
2021-12-09 17:02:17 +08:00
wawltor
0ba12057b1 Merge pull request #1414 from wangxicoding/fix_static_bert_amp_nan
fix static bert amp nan
2021-12-09 16:24:36 +08:00
wawltor
f3010d9fc5 Merge pull request #1411 from Steffy-zxf/upstream-develop
fix skep data type on the win
2021-12-09 16:21:17 +08:00
liu zhengxi
208e8803b0 fix gpt dy2sta (#1416) 2021-12-09 15:42:35 +08:00
yingyibiao
d4075ff0ad Add layoutlmv2 model (#1415)
* add layoutlmv2 modeling

* add layoutlmv2 tokenizer

* update

* update
2021-12-09 14:46:23 +08:00
tianxin
aa3ae6264d Update FasterTransformer Encoder Performance (#1413) 2021-12-09 12:26:59 +08:00
WangXi
97e51ffceb fix static bert amp nan 2021-12-09 03:33:31 +00:00
Linjie Chen
8ef9979639 Update URL for Taskflow and transformers (#1402)
* Update URL for taskflow and transformers

* Update md5

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-12-08 23:45:07 +08:00
smallv0221
eea2d98bd9 change default use_faster to False (#1410)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-12-08 23:40:12 +08:00
Penghui Zhao
ae02c319a4 add mobilebert model (#1160)
* upd mobilebert

* upd mobilebert

* add docstring.

* add docstring.

* upd docstring

* add license

* Update tokenizer.py

* Update modeling.py

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-12-08 21:18:45 +08:00
Steffy-zxf
c43df37410 fix skep data type on the win 2021-12-08 17:46:04 +08:00
smallv0221
1dc67bcb98 Add MBart FasterGeneration sample (#1409)
* add mbart FasterGeneration sample

* minor fix

Co-authored-by: gongenlei <gongel@qq.com>
2021-12-08 16:19:26 +08:00
gongenlei
6039c90292 [FasterMBART] Add FasterMBART (#1367)
* feat: add FasterMBART

* refactor: rm debug

* refactor: rm unused import

* refactor: rm pdb

* refactor: rm debug file

* feat: expose temperature arg. for sampling

* feat: use global CublasHandle

* refactor: mv decode_strategy from __init__ to forward

* fix: fix decode_strategy
2021-12-08 16:12:29 +08:00
Guo Sheng
235cc509f0 Refine transfer_param in FT (#1405)
* Optmize the cost for fp16 init in FT.

* Remove reserve_data argument in FT

* Remove unused import
2021-12-08 14:55:16 +08:00
tianxin
c3a467b053 support AMP for In-batch Negatives (#1374) 2021-12-08 14:39:49 +08:00
liu zhengxi
9f79af12b2 cuda11 support (#1408) 2021-12-08 14:01:58 +08:00
liu zhengxi
17517fe0d8 Fix FasterGPT dy2sta (#1407) 2021-12-08 13:50:17 +08:00
smallv0221
c443ffa498 fix perf and sample code (#1395)
* fix bart perf

* update fastergeneration doc

* add img

* add img

* change img

* update img

* fix img

* update docs

* fix readme

* update readme

* fix perf

* fix perf

* fix modelling

* fix perf and sample code

* fix perf

* fix perf

* fix seq_len for gpt_sample

* add forced eos token id for faster

* upgrade perf and add forced eos token id

* chenge stack to gather

* add auto perf

* minor fix

* remove encoder change

* Update bart_perf.py

* Update bart_perf.py
2021-12-08 13:36:47 +08:00
tianxin
96cf4dc342 add max_step for ernie_matching (#1404) 2021-12-08 12:24:54 +08:00
liu zhengxi
0bed1f1b35 fix encoder patch (#1406) 2021-12-08 09:43:34 +08:00
tianxin
bd3fae29e8 Optimize FT Encoder performance (#1373)
use global CublasHandle for fusion_decoding_op

uncomment encoder gemm not found warning

add MUTE_OPEN_ATTENTION_COMMAND for open_attention.h

add decoding_lib parameter for enable_faster_encoder function to prevent rebuilding
2021-12-08 00:21:56 +08:00
yujun
2fbd04f752 fix (#1399)
Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2021-12-07 16:59:01 +08:00
liu zhengxi
b1ba31be0d fix on infer (#1400) 2021-12-07 16:09:57 +08:00
yujun
794b116b1d Add Reformer Model (#870)
* update __init__

* rm easydict package

* update

* format & use gather nd

* update docs

* rename past past_buckets_states to cache

* rename PreTrained -> Pretrained

* tokenizer return token_type_ids=False attention_mask=True

* add generate demo

Co-authored-by: Jack Zhou <zhoushunjie@baidu.com>
Co-authored-by: yingyibiao <yyb0576@163.com>
2021-12-07 11:38:59 +08:00
Guo Sheng
0e5185210c Support hf beam search for any beam size when is_fuse_topk_softMax_ is false (#1397)
* Support hf beam search for any beam size when is_fuse_topk_softMax_ is false.

* Fix topk_stage_2_opt3_update when finishing
2021-12-07 11:11:05 +08:00
liu zhengxi
93e40c642e refine custom op codes to avoid compling error (#1398) 2021-12-07 10:50:31 +08:00
liu zhengxi
0a880fd849 Fix GPT fp16 attention mask dtype (#1396)
* fix gpt fp16

* user input
2021-12-06 20:46:36 +08:00
liu zhengxi
d8b2ce8029 Refine some remain issue in hf beam search (#1392)
* fix id in the last position

* fix

Co-authored-by: Guo Sheng <whucsgs@163.com>
Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2021-12-06 15:54:14 +08:00
Guo Sheng
1bd462a96c Fix add_bias_input in FT. (#1393) 2021-12-06 14:53:45 +08:00
huhuiwen99
48a2de375d Doc Update (#1391)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* update readme

* modify rst
2021-12-06 14:46:03 +08:00
huhuiwen99
f7933424f5 Update AutoModel Docs (#1389)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* first modify

* modify auto

* modify automapping

* modify automapping

* modify baseautomodel

* add tokenizer file

* add tokenizer

* update tokenizer

* modify tokenizer

* update

* modify auto modeling

* test modeling

* update

* modify automodel

* test auto

* update

* test tokenizer

* add diffs

* update

* fix errors

* test

* update

* modify some errors

* fix errors

* update

* updat4e

* add task_choice

* update

* update

* update

* add causal lm mapping

* remove dir

* update

* update

* add models

* delete print

* task para

* task para

* task para

* fix errors

* update

* ernie-gen

* update

* update

* doc update

* modify auto docs

* update docs

* update

* update

* update

* update
2021-12-06 13:09:52 +08:00
huhuiwen99
e03f8352eb Update AutoModel Doc (#1387)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* first modify

* modify auto

* modify automapping

* modify automapping

* modify baseautomodel

* add tokenizer file

* add tokenizer

* update tokenizer

* modify tokenizer

* update

* modify auto modeling

* test modeling

* update

* modify automodel

* test auto

* update

* test tokenizer

* add diffs

* update

* fix errors

* test

* update

* modify some errors

* fix errors

* update

* updat4e

* add task_choice

* update

* update

* update

* add causal lm mapping

* remove dir

* update

* update

* add models

* delete print

* task para

* task para

* task para

* fix errors

* update

* ernie-gen

* update

* update

* doc update
2021-12-04 11:27:41 +08:00
Zeyu Chen
cf38e199a9 Move tipc to tests 2021-12-03 21:00:10 +08:00
Zeyu Chen
dc5b6a817b Move experimental to faster 2021-12-03 20:42:10 +08:00
liu zhengxi
4f4036f6a0 Fix FasterGPT (#1384)
* fix gpt

* update attn mask

* update

Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
Co-authored-by: Guo Sheng <whucsgs@163.com>
2021-12-03 17:20:56 +08:00
liu zhengxi
57ff4870fd Add hf beam search in FT and fix Generation API beam search (#1378)
* add beam search v3 for ft

* fix generation utils and update algo in ft

* alternatives

* update

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-12-03 15:50:28 +08:00
Linjie Chen
863127ca0a Support vocabulary customization for lac (#1364)
* add custom vocab for lac

* Update README.md

* Update decode

* Support custom vocab for lac

* Update README.md

* Update README.md
2021-12-03 10:56:19 +08:00
Jack Zhou
673ecd4a40 Fix mac doc (#1376)
* fix typo; linux->mac

* fix typo; linux->mac
2021-12-02 18:29:38 +08:00
yingyibiao
edc57c1a7c Remame Langboat weights (#1386)
* remame weights

* remame weights
2021-12-02 18:09:25 +08:00
Jack Zhou
8200fd8c96 Add ernie seqeuence classification doc (#1382)
* add some desc

* add logging steps, saving steps
2021-12-02 14:53:50 +08:00
Zhong Hui
e79822d7c2 [NER] Support ernie and peoples_daily_ner. (#1361) 2021-12-01 20:43:59 +08:00
huhuiwen99
8f0a0b6a47 Add AutoModel (#1191)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* first modify

* modify auto

* modify automapping

* modify automapping

* modify baseautomodel

* add tokenizer file

* add tokenizer

* update tokenizer

* modify tokenizer

* update

* modify auto modeling

* test modeling

* update

* modify automodel

* test auto

* update

* test tokenizer

* add diffs

* update

* fix errors

* test

* update

* modify some errors

* fix errors

* update

* updat4e

* add task_choice

* update

* update

* update

* add causal lm mapping

* remove dir

* update

* update

* add models

* delete print

* task para

* task para

* task para

* fix errors

* update

* ernie-gen

* update

* update
2021-12-01 19:11:18 +08:00
Jack Zhou
8c7f4ec7e3 Add mac tipc scripts (#1375) 2021-11-30 18:23:40 +08:00
yulangz
462f080fd3 Add End-to-End Memory Network example (#1046)
* add end_to_end_memory_networks

* add end_to_end_memory_networks

* upload big file to cloud storage, change README

* –Perfect code style

* Adjust annotation style

* chenage directory

Co-authored-by: yingyibiao <yyb0576@163.com>
Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
2021-11-29 20:17:41 +08:00
Jack Zhou
d934e9ddee Add tipc readme (#1369)
* add README

* update readme

* update readme

* add win test_train_inference_python.md; add results

* add trt usage

* delete int8

* add fp16 fp32 results

* add fp16 fp32 results

* fix compare reuslts script

* fix fp16 ground truth
2021-11-29 19:42:32 +08:00
gongenlei
9f6634f57a fix: fix ci (#1370)
Co-authored-by: liu zhengxi <380185688@qq.com>
2021-11-29 18:39:13 +08:00
zhangbo9674
d49b6b1af8 [AMP] Support pure fp16 for gpt-3 static (#1353)
Amp level O2 for pure fp16.
2021-11-29 17:20:02 +08:00
renmada
2afd760d0e PaddlePaddle Hackathon 57 提交 (#1128)
* xlnet downstream

* return_dict

* 更新权重说明

* 更新权重说明

* fix error

* Update doc

* Remove unused

* Update doc

* Update doc

* update

* Remove num_classes

* Update

* Update

Co-authored-by: xly <imxly2@126.com>
Co-authored-by: yingyibiao <yyb0576@163.com>
2021-11-29 15:38:24 +08:00
Linjie Chen
eec798a941 Add text similarity task for Taskflow (#1345)
* Add text matching task for Taskflow

* Update README.md

* Update input check

* Update README.md

* Update taskname

* Update usage

* Optimize var name

* Update simbert

* Update README.md

* Update README.md

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-29 11:39:36 +08:00
Guo Sheng
27503e754a Fix apply_logits_mask_kernelLauncher in decoding_sampling.h (#1363) 2021-11-29 09:34:43 +08:00
liu zhengxi
5d5e4dd4df Upgrade FasterTransformer base on nccl_dependent_refine branch (#1264) 2021-11-26 19:05:14 +08:00
Jack Zhou
666dcfc41d Add test tipc (#1354)
* Add test_tipc directory

* Add lac full chain scripts

* Add predict output of lac

* add training seed

* fix gru input
2021-11-25 21:10:13 +08:00
smallv0221
c54226bb78 Update FasterGeneration doc (#1355)
* fix bart perf

* update fastergeneration doc

* add img

* add img

* change img

* update img

* fix img

* update docs

* fix readme

* update readme
2021-11-25 21:09:01 +08:00
wawltor
f81c3b9066 Merge pull request #1356 from linjieccc/fix_wordtag
Fix bug of WordTag on windows
2021-11-24 15:21:40 +08:00
Linjie Chen
588c997504 fix bug of wordtag on windows 2021-11-24 15:15:26 +08:00
gongenlei
8681300253 Fix download bar's unit (#1349) 2021-11-22 20:34:18 +08:00
yujun
ac9d6f9cc8 Add T5 model (#916)
* add t5 model

* update

* add glue demo

* update

* rename PreTrained -> Pretrained

* tokenizer return token_type_ids=False attention_mask=True

* update

* update T5EncoderModel

* rm t5encoderblock

* Update modeling.py

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-11-22 19:59:51 +08:00
smallv0221
74b1bb8d25 fix bart perf (#1348) 2021-11-22 18:51:37 +08:00
Linjie Chen
ffc9190b9a Update WordTag and TermTree (#1329)
* Updata WordTag

* Update README.md

* Update README.md

* Update README.md

* Add custom TermTree

* Update README.md

* Update termtree_type.csv

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-21 17:35:29 +08:00
smallv0221
f14bf99ef4 Add readthedocs for FasterGeneration (#1338)
* add faster generate sample and perf

* minor fix

* add license

* fix model_kwargs

* add use fp16 args

* minor fix

* minor fix

* Add readme

* minor fix

* update all faster example and readme

* minor fix

* delete huggingface

* fix readme

* Add readthedoc for faster generation

* minor fix

* fix doc

* add more doc

* change use_fast to use_faster

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-20 15:56:33 +08:00
Zhong Hui
65d33d4310 typo quick fix. (#1343) 2021-11-20 00:05:11 +08:00
Zhong Hui
fc880b0e7a Add xnli dataset (#1336)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-19 23:32:10 +08:00
gongenlei
ea62431c01 [MBART] Add mbart and mbart50 (#1289)
* feat: add mbart and mbart50

* feat: add model and vocab's bos link

* refacor: try_import sentencepiece

* refactor: integrate MBartTokenizer and MBart50Tokenizer
2021-11-19 18:02:39 +08:00
smallv0221
56f1a69a02 Add faster generate sample and perf (#1317)
* add faster generate sample and perf

* minor fix

* add license

* fix model_kwargs

* add use fp16 args

* minor fix

* minor fix

* Add readme

* minor fix

* update all faster example and readme

* minor fix

* delete huggingface

* fix readme

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-19 09:37:17 +08:00
Linjie Chen
7c78894b8f Update taskflow README.md and fix typos (#1333)
* Update README.md for taskflow and fix typos

* Update README.md for taskflow and fix typos
2021-11-18 20:27:43 +08:00
huhuiwen99
fd415f0368 Add Mengzi-Bert weights (#1320)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* mengzi-bert-base

* add weights

* add mengzi-bert

* fix errors

* modfiy model numbers

* modify names

* modify examples

* modify examples
2021-11-18 17:11:25 +08:00
Jack Zhou
5b092c3bd5 add --init_from_ckpt for token cls (#1330) 2021-11-18 11:54:34 +08:00
Jack Zhou
827b18c4b5 Fix windows dtype for faster ernie (#1327)
* fix windows dtype for faster ernie

* fix some doc typos

* fix token cls cpp deploy

* fix seq cls README

* fix seq cls README

* checkpoint -> checkpoints
2021-11-17 20:46:50 +08:00
Jack Zhou
26c1f07385 Add benchmark output for ernie and faster ernie (#1324)
* add benchmark output for ernie and faster ernie

* fix review
2021-11-17 20:44:17 +08:00
Jack Zhou
450e784992 Add amp for ERNIE task(#1321)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-17 19:38:56 +08:00
Jiaqi Liu
54bef3dd03 Support ofa export for bert (#1326)
* fix ofa export bug

* support bert export
2021-11-17 13:06:29 +08:00
Jiaqi Liu
168f05856d fix ofa export bug (#1322) 2021-11-17 11:58:48 +08:00
yingyibiao
492b040666 Update layoutxlm (#1318)
* update layoutxlm

* update layoutxlm
2021-11-16 22:21:02 +08:00
Zeyu Chen
471a8a0333 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2021-11-16 18:44:19 +08:00
Zeyu Chen
b07d60f16f Remove py2 compatible import 2021-11-16 18:44:10 +08:00
Zeyu Chen
0ea5fd43a1 Remove py2 compatible import 2021-11-16 18:43:54 +08:00
Linjie Chen
64954f06cd Update Taskflow REAME.md and enable download logs (#1319)
* Update Taskflow REAME.md and enable download logs

* Enable download log for Taskflow
2021-11-16 16:54:53 +08:00
yingyibiao
2a08c1425f Update package requirements and example README.md of LayoutXLM model (#1315)
* Add yacs and numpy to requirements; Update LayoutXLM README.md

* try_import yacs
2021-11-16 14:28:59 +08:00
wawltor
3f2756757b Merge pull request #1314 from joey12300/fix_import
Fix paddle.incubate.nn import error
2021-11-15 21:46:11 +08:00
yingyibiao
46374d8ab1 Add LayoutXLM model (#1310)
* add VisualBackbone and modeling files

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* Delete feature_extractor.py

* Delete processor.py

* update

* update

* update

* update

* update

* update

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-15 20:14:01 +08:00
zhoushunjie
87a552fce1 put FusedTransformerEncoderLayer in local scope 2021-11-15 16:47:40 +08:00
Jack Zhou
946195be8a Fix faster tokenizer doc (#1313)
* fix faster tokenizer doc

* add tokenize list, tuple of string

* move to_tensor to dygraph
2021-11-15 16:08:14 +08:00
smallv0221
0c921010fb Fix GPT to_static and add unimo-text-1.0-lcsts-new (#1295)
* Fix to_static and add unimo-text-1.0-lcsts-new

* minor fix

* minor fix`

* fix kwargs bug

* fix GPT static bug

* update model zoo doc

* update model zoo doc

* minor fix

Co-authored-by: liu zhengxi <380185688@qq.com>
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-15 15:39:26 +08:00
huhuiwen99
57b58520f4 Api doc (#1301)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* update rst

* update

* update

* add model

* add blenderbot

* fix errors

* add blenderbotsmall

* update

* udpate

* Update transformers.rst

* add ctrl

* add ctrl, squeezebert

* check numbers

* add bert-chinese

* add bert-japa

* add bert-japa

* fix errors
2021-11-15 11:52:59 +08:00
Jack Zhou
064f1258cc Add lac perf statics (#1293)
* add lac perf statics

* fix some description
2021-11-15 10:29:56 +08:00
Zeyu Chen
500e5e90a5 Remove legacy folder and update README 2021-11-13 23:32:03 +08:00
Jack Zhou
e1148b9eea Add amp for FasterERNIE token classification task (#1309) 2021-11-13 21:38:50 +08:00
Jack Zhou
2d7e781dbe Upgrade faster ernie by using fused transformers (#1308)
* add faster-ernie-1.0 model params

* add amp for faster ernie seq cls task

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-13 18:02:57 +08:00
Zeyu Chen
30eb43ce3e Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into develop 2021-11-13 16:01:36 +08:00
Zeyu Chen
5aee8c73f3 Update documents for Faster PaddleNLP 2021-11-13 16:00:11 +08:00
Felix Hao
3c83d18b9f Fix compiling faster transformer with cuda 11 (#1234)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-13 15:34:16 +08:00
smallv0221
af6e432ce8 Add more args for generate API (#1297)
* Add more args for generate API

* Revert "Add force decoding in FasterTransformer (#873)"

This reverts commit 94f2651890.

* minor fix

* Revert "Revert "Add force decoding in FasterTransformer (#873)""

This reverts commit 35fc972d21.

* add more logit prosessor

* minor fix

* fix doc

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-13 14:53:53 +08:00
yingyibiao
8f9690c4f9 modify benchmark scripts (#1304) 2021-11-13 13:13:13 +08:00
骑马小猫
8d513aa2b3 Fix import issues in gpt/test_modeling (#1306) 2021-11-13 12:00:02 +08:00
Zhong Hui
307de58dc3 Fix gpt inference problem with paddle.expand_as . (#1303) 2021-11-12 17:43:42 +08:00
Zhong Hui
b9ee142d5f Add more pretrained weights for GPT (#1302)
* add hf pretrained weights gpt2-en gpt2-large-en gpt2-xl-en for gpt

* add doc

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-12 16:02:02 +08:00
Baizhou Huang
a30552ab40 Add MultiLabelsMetric (#1282)
* 1.Add MultiLabelsMetric class in metrics/glue.py
2.Add unit test

* add unit test for binary classification

* Add notes about zero division

* fix error in example code
2021-11-12 15:36:01 +08:00
liu zhengxi
799b33875f fix sampling fd (#1299) 2021-11-11 22:15:15 +08:00
Linjie Chen
7e415cf3a1 delete unused code for NPTag (#1298) 2021-11-11 20:04:47 +08:00
yujun
755ccf02c2 add CTRL Model (#921)
* add ctrl

* add space

* update

* update

* update

* update docs

* add ctrl generate demo

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-11-11 16:34:57 +08:00
Steffy-zxf
8b8921899a Add FasterErnieForTokenClassification demo (#1284)
* 1. add FasterTokenizer model in experiment
2. add demo with FasterTokenizer usage in experiment

* add cpp deploy demo

* add test time script

* add example

* mv python_deploy location

* optimize cpp demo

* add faster model

* add faster tokenizer export model

* 1. rename to_string_tensor to to_tensor
2. rename to_vocab_tensor to to_vocab_buff
3. add to_static() api to FasterModel

* 1. add text cls example with FasterModelForSequenceClassification
2. remove some redudant code

* update cpp deploy

* 1. rename text_cls with seq_cls
2. suuport from_pretrained() with given a local directory

* add experimental.model_utils.py

* update seq_cls cpp demo, drop to print the label string

* add FasterTokenizer.from_pretrained() api

* use FasterTokenizer.from_pretrained() api

* add FasterErnieForTokenClassification

* 1. add token cls demo scripts

* add seq cls cpp deploy scripts as  paddlenlp 2.1

* update tokenizer impletation

* remove debug code

* merge tokenizer and seq_cls_infer implementation

* tiny seq_cls_infer and token_cls_infer code

* remove push_back with emplace_back

* simplify FasterErnieForSequenceClassification demo code

* simplify FasterErnieForTokenClassification demo code

* upadte 2.1 cpp deploy demo for seq cls

* remove debug code

* update batch_size as 1 as default when predicting

* add readme for Faster Tokenizer

* pass embedding_eltwise_layernorm_fuse when using inference

* update faster tokenizer reademe

* update docs

* recover  text_cls/pretrained_models/deploy/python/predict.py

* update docs

* update docs

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-11 14:33:50 +08:00
Linjie Chen
c235c06c43 Update README.md and FAQ for Taskflow (#1294)
* Update README.md

* Update README.md
2021-11-11 14:32:52 +08:00
huhuiwen99
db707a1e73 Api doc update (#1285)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* update rst

* update

* update
2021-11-10 19:01:45 +08:00
Jack Zhou
80f62d3a4c Upgrade paddlenlp.layers.crf.ViterbiDecoder to paddle.text.ViterbiDecoder compatibly (#1291)
* remove unnecessary import

* add compare_version tools

* upgrade paddlenlp.layers.crf.ViterbiDecoder to paddle.text.ViterbiDecoder

* remove with_start_stop_tag args

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-10 18:05:07 +08:00
Jack Zhou
1f3af8b515 add tokenizer perf scripts (#1280)
* add tokenizer perf scripts

* fix some review comments
2021-11-10 15:38:49 +08:00
xiongkun
26bc36e629 Upgrade Transformer to_static (#1290)
* Add to_static support for transformer-base
and bert-large

* refine

* fix

* remove build_strategy
2021-11-10 15:26:51 +08:00
smallv0221
65c772c475 Add Diverse Beam Search and Integrate FT into generation api (#1153)
* Add offset mapping doc

* fix eval hang because of unique endpoint

* generate api support encoder-decoder

* Add lightseq beam_search

* optimize performence

* add blockroughk kernel

* optimize

* minor fix

* Fix generate api bug and add diverse sibling search

* minor fix

* Add Diverse Beam Search

* Integrate FT into generation api

* add fastergpt support

* FasterGenerate support gpt unimo-text and unified transformer

* update faster examples

* avoid recursive build

* fix faster examples

* minor fix

* add some constrains

* minor fix

* add constrains for faster generate

* Align GPT output

* Optimize user experience

* minor fix

* minor fix

* minor fix

* minor fix

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-10 13:31:58 +08:00
linjieccc
06bf0e49fc Add NPTag (#1246)
* add nptag

* support static mode

* Update modeling

* Update comments for nptag

* add nptag finetune example

* Update NPTag finetune example

* Update nptag taskflow

* Update task name

* Update finetune example readme

* Update NPTag

* Update NPTag example

* Update NPTag example

* Update NPTag example

* Update README.md

* Update README.md

* Update taskflow static mode

* Update README.md

* Update README.md

* Update static mode inference

* Update static mode

* Update README.md

* Update README.md

* Update README.md

* Update NPTag code format

* Update README.md

* Update README.md

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-10 12:55:33 +08:00
gongenlei
839bc1d9ec fix: change approximate_gelu to gelu (#1288) 2021-11-09 19:44:06 +08:00
yujun
844f24ce67 PaddlePaddle Hackathon 56 提交 (#1088)
* update

* update

* remove community/junnyu

* Update test_modeling.py

* suggestion from ZHUI

* add community/junnyu

* rm gpt link

* update

* update readme

* add large medium

* 更新权重个数

* update gpt compare

* update docs

* add msra ner example

Co-authored-by: yingyibiao <yyb0576@163.com>
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-09 15:52:13 +08:00
Jack Zhou
a5ef06cde0 fix some conner case in text correction decode (#1273) 2021-11-08 14:47:42 +08:00
yingyibiao
f207fde89f Update code license and authors (#1279) 2021-11-05 19:35:47 +08:00
smallv0221
287e0beab9 Update SQuAD README (#1278)
* update squad readme

* minor fix

* add answer sample

* fix readme

* Update SQuAD README
2021-11-05 18:44:10 +08:00
huhuiwen99
6977ccf73f Update API docs (#1275)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* docs update

* update docs

* docs update

* tokenizer docs update
2021-11-05 15:48:24 +08:00
smallv0221
2e3ed68f90 Update SQuAD readme (#1276)
* update squad readme

* minor fix

* add answer sample

* fix readme
2021-11-05 14:20:20 +08:00
yingyibiao
e2c6c2d492 Modify xlnet benchmark scripts (#1271)
* modify xlnet benchmark scripts

* modify xlnet benchmark scripts

* modify xlnet benchmark scripts
2021-11-05 09:53:49 +08:00
Steffy-zxf
05cc10b1e5 Add cpp deploy demo for seq cls with ernie (#1269)
* 1. add FasterTokenizer model in experiment
2. add demo with FasterTokenizer usage in experiment

* add cpp deploy demo

* add test time script

* add example

* mv python_deploy location

* optimize cpp demo

* add faster model

* add faster tokenizer export model

* 1. rename to_string_tensor to to_tensor
2. rename to_vocab_tensor to to_vocab_buff
3. add to_static() api to FasterModel

* 1. add text cls example with FasterModelForSequenceClassification
2. remove some redudant code

* update cpp deploy

* 1. rename text_cls with seq_cls
2. suuport from_pretrained() with given a local directory

* add experimental.model_utils.py

* update seq_cls cpp demo, drop to print the label string

* add FasterTokenizer.from_pretrained() api

* use FasterTokenizer.from_pretrained() api

* add FasterErnieForTokenClassification

* 1. add token cls demo scripts

* add seq cls cpp deploy scripts as  paddlenlp 2.1

* update tokenizer impletation

* remove debug code

* merge tokenizer and seq_cls_infer implementation

* tiny seq_cls_infer and token_cls_infer code

* remove push_back with emplace_back

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-04 14:58:36 +08:00
liu zhengxi
94f2651890 Add force decoding in FasterTransformer (#873) 2021-11-04 14:32:59 +08:00
Zhong Hui
d436ab797d [Benchmark] Quick fix for benchmark script (#1268) 2021-11-03 22:25:05 +08:00
wawltor
a6094c40ea Update copyright for the some examples (#1270)
* add the copyright for the some module

* update the order of copyright

* format the some copyright
2021-11-03 22:24:42 +08:00
Zeyu Chen
630792e44c Update README and add acknoledge 2021-11-03 22:16:42 +08:00
Zeyu Chen
9fecb86f6a Update README and add acknoledge 2021-11-03 22:15:33 +08:00
Jack Zhou
ad941bb6f4 Add FasterTokenizer performance test (#1267)
* add tf_tokenizer performance test

* fix some comments of perf.py

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-03 19:39:49 +08:00
Jack Zhou
d0633e3550 fix evaluate error when detect_pos=0 and correct_pos=0 (#1265)
* fix evaluate error when detect_pos=0 and correct_pos=0

* nan -> 0
2021-11-03 15:47:07 +08:00
Zhong Hui
82e46cf305 Refine GPT benchmark fixes v3 (#1266)
* fix ips

* refine model name.

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-03 12:12:43 +08:00
renmada
a77af2ef23 Add SqueezeBERT (#937)
* Add squeezebert

* Add doc and remove empty files

* 更新pytorch glue结果

* fix bug

* 增加cpu速度测试

* delete example

Co-authored-by: username@email.com <imxly2@126.com>
Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-02 11:26:09 +08:00
Guo Sheng
44fadbf9f5 Fix length penalty in beam search v2. (#1263) 2021-11-01 21:44:50 +08:00
Steffy-zxf
9e198d0eb2 Add FasterTokenizer model in experiment (#1220)
* 1. add FasterTokenizer model in experiment
2. add demo with FasterTokenizer usage in experiment

* add cpp deploy demo

* add test time script

* add example

* mv python_deploy location

* optimize cpp demo

* add faster model

* add faster tokenizer export model

* 1. rename to_string_tensor to to_tensor
2. rename to_vocab_tensor to to_vocab_buff
3. add to_static() api to FasterModel

* 1. add text cls example with FasterModelForSequenceClassification
2. remove some redudant code

* update cpp deploy

* 1. rename text_cls with seq_cls
2. suuport from_pretrained() with given a local directory

* add experimental.model_utils.py

* update seq_cls cpp demo, drop to print the label string

* add FasterTokenizer.from_pretrained() api

* use FasterTokenizer.from_pretrained() api

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-11-01 15:32:26 +08:00
Zeyu Chen
31c6e0802d Fix README typo 2021-11-01 00:38:42 +08:00
Zeyu Chen
a2d6f375f8 Update README and examples README 2021-11-01 00:28:35 +08:00
wawltor
2b794ebf4a remove the paddlefsl in requirements (#1254)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-30 21:52:14 +08:00
yingyibiao
bf052acda1 Add benchmark for xlnet model (#1258)
* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

* add xlnet benchmark

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-30 21:50:27 +08:00
Zhong Hui
9d7027f9ff [GPT] Update GPT README for sentencepiece version requirements (#1248)
* Update README.md

sentencepiece >= 0.1.94

* Update README.md

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-29 14:00:25 +08:00
liu zhengxi
5ececbbe95 bug fix (#1251) 2021-10-29 11:50:19 +08:00
Aganlengzi
92208643d0 [NPU] support ernie-1.0 predict and xlnet (#1249)
* [NPU] support ernie-1.0 predict and xlnet

* [NPU] support ernie-1.0 predict and xlnet

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-28 22:29:06 +08:00
Erwin Gao
d07e2376bd [PaddlePaddle Hackathon] 第53题 (#1114)
* finish develop bigbird

* add bigbird unitest

* fix doc

* remove BigBirdLMhead

* remove BigBirdLMhead and fix bugs

* remove BigBirdForQuestionAnsweringHead class

* add doc

* update document tables

* 删除未使用字段

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-10-28 16:49:19 +08:00
Zhong Hui
0a3faeea7a gpt benchmark fix v2 (#1244) 2021-10-28 14:59:48 +08:00
Erwin Gao
48e58f01ac [PaddlePaddle Hackathon] 第51题 (#1115)
* add bert japanese

* fix model-weight files position

* add weights files url

* create package: bert_japanese

* update weights readme

* update weights files

* update config pretrain weights https

* 修复权重配置文件

* retest CI

* update

* update

* fix docstring

* update

* 预训练权重更新

* update weights readme

* remove weights url in codes

* update...

* update...

* update weights readme

* update

* update

* update docstring

* 清理冗余代码

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-10-28 13:03:41 +08:00
Guo Sheng
20acd1614d Integrate FT into generation api (#1154)
* Add the first draft for integrating FT into generation api.

* Add try-catch in FT using of generation api.

* Refine FasterTransformer integration into generation api.

* Update some checks in FT integration.

Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2021-10-27 22:20:57 +08:00
liu zhengxi
27e0c3468c Transformer t2t beam search supports force decoding in dygraph (#1237)
* paddle t2t beam search support force decoding
2021-10-27 21:34:47 +08:00
Zhong Hui
f59de0f1b3 [GPT] fix small problems in benchmark. (#1233)
* fix small problems as QA

* Add profile for gpt-2/3

* Add reader cost.

* fix dygraph sync.
2021-10-26 19:30:48 +08:00
gongenlei
6060d7a0c4 fix: broadcast needs np.array (#1229) 2021-10-25 19:07:09 +08:00
linjieccc
d65d1587a4 Delete unused calculation of metric.accumulate()
Delete unused calculation of metric.accumulate()
2021-10-25 14:30:10 +08:00
Zeyu Chen
0f427aabdf Merge branch 'develop' into fix_eval 2021-10-25 13:55:44 +08:00
Jack Zhou
385e55da1a fix text correction max_seq_len (#1225)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-25 12:06:02 +08:00
tianxin
61ec0b1414 Update README.md of text_matching (#1228) 2021-10-25 11:46:14 +08:00
Kevin吴嘉文
6427591dd8 add blenderbot_small, blenderbot (#868)
* add blenderbot_small, blenderbot

* adjust code comment

* config info formating; update activation dropout config information

* update final logit bias init dtype

* add init weight dtype constrain

* Updata comment and file formating

* update use_cache relavent for ConditionalGeneration model

* Update class comment, reorgainze BlenderbotSmallTokenizer using GPTTokenizer , Fix BLenderbotModel use cache bug

* Adjust pos embed generating, comment, use_cache loading, specify method key, add blenderbot public tokenize

* update CausalLM

* update .generate() sample

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-10-25 11:00:23 +08:00
huhuiwen99
99e3b593f5 Modify Ops Doc (#1171)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* delete changes

* modify adamwdl

* modify adanwdl

* fix errors

* update

* modify parallel
2021-10-25 10:56:48 +08:00
huhuiwen99
8833ee34f8 Metrics (#1151)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify chunk

* modify glue

* modify bleu

* modify rouge

* modify perplexity

* update distinct

* update

* update rouge

* modify rouge

* update rouge

* fix errors

* modify encoder

* fix errors

* update

* test

* test1

* test2

* test

* center

* modify dureader
2021-10-25 10:56:03 +08:00
yujun
723becfafe PaddlePaddle Hackathon 54 提交 (#1086)
* update

* add community/junnyu

* update electra docs

* update electra docs

* update

* update

* add import

* update

* update md

* fix attention_mask bug

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: yingyibiao <yyb0576@163.com>
2021-10-25 10:50:03 +08:00
linjieccc
8b13058a16 fix evaluation 2021-10-25 02:34:47 +00:00
yujun
089f8aee59 support 2D attention mask (#1226) 2021-10-25 10:31:02 +08:00
tianxin
0a338ccb53 fix #1204 (#1223) 2021-10-24 17:01:27 +08:00
AI-Mart
4ace4ff7b1 Update train.py for msra-ner(#1206)
Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
2021-10-24 04:38:33 +08:00
Aganlengzi
418a8dabfe [NPU] npu support modification for bert and ernie-1.0 (#1214)
* [NPU] npu support modification for bert and ernie-1.0

* [NPU] revert cumsum related changes

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-22 13:34:59 +08:00
Jiaqi Liu
80ac7dce3e Fix pad usage bug for seq2seq (#1216) 2021-10-22 11:00:57 +08:00
Zeyu Chen
a4c1dce24c Add question matching context to baseline 2021-10-21 23:17:20 +08:00
Jiaqi Liu
f4969098f6 Fix seq2seq windows dtype bug (#1198)
* fix seq2seq windows dtype bug

* fix

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-21 18:19:14 +08:00
tianxin
f9f553702c Add max_steps for SimCSE (#1207) 2021-10-21 18:17:39 +08:00
yujun
c862e9c3a4 PaddlePaddle Hackathon 52 提交 (#1085)
* update

* update

* add community/junnyu

* update bert docs

* rm tokenizer links

* fix typo

* update TestBertForMaskedLM

* update

* 删除多余的attention mask判断

* update readme

* update docs

* add

* Revert "update docs"

This reverts commit 79169c2613.

* update docs/model_zoo

* update modelzoo rst

* replace tab with space

* fix typo

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-10-20 21:48:42 +08:00
yujun
7d0d89d480 update run squad & modifiy mpnet docs (#1205) 2021-10-20 21:25:11 +08:00
wawltor
27917453b5 Merge pull request #1201 from wawltor/check_release_2.1
update the code for the download_file and document
2021-10-20 10:58:36 +08:00
wawltor
93ce1f49d4 update the code for the download_file and document 2021-10-20 02:51:26 +00:00
wawltor
47430dc3c9 Merge pull request #1181 from linjieccc/fix_taskflow_senta
Add confidence score for sentiment analysis tasks
2021-10-20 10:26:30 +08:00
wawltor
00ef7def67 Merge pull request #1190 from wawltor/taskflow_install_dependency
specify the install dependency in the Taskflow
2021-10-20 10:26:13 +08:00
Haohongxiang
f04322f5bf [GPT-3] Add support for pure fp16 in dygraph mode (#1176) 2021-10-19 14:47:35 +08:00
wawltor
812ebb1afe specify the install dependency in the taskflow 2021-10-18 13:27:30 +00:00
yingyibiao
41bad63429 Correct community contrib doc typo (#1185) 2021-10-18 15:06:00 +08:00
wawltor
d128292b2c Fix text matching document typo (#1186)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-18 15:05:12 +08:00
gongenlei
313fbb611b [FT Decoder] Add JIT and bug fix (#1173)
* fix&feat: gelu-->relu and add jit

* docs: update yaml
2021-10-18 14:12:29 +08:00
liu zhengxi
433ef99c96 refine sampling code (#1184) 2021-10-18 14:02:55 +08:00
linjieccc
c43a7229ed update readme 2021-10-18 03:05:06 +00:00
linjieccc
7b32b3d6f6 add confidence score for sentiment analysis 2021-10-17 10:23:45 +00:00
Zeyu Chen
a34f68915a Update English docs 2021-10-17 01:50:58 +08:00
wawltor
e51e699a60 Merge pull request #1166 from wawltor/taskflow_download_check
update the download check for the Taskflow
2021-10-14 19:22:00 +08:00
Zhong Hui
1b4821bb43 Add training benchmark for gpt / gpt-3. (#1091) 2021-10-14 18:00:37 +08:00
wawltor
6feb45a621 remove the ununsed code 2021-10-14 07:36:29 +00:00
wawltor
b244d245dc update the download check for the Taskflow 2021-10-14 07:29:27 +00:00
yingyibiao
baec4d7683 Update readthedocs with new feature TaskFlow (#1164)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-14 15:21:35 +08:00
Jack Zhou
86aea017d9 Update README for ERNIE-CSC (#1165)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-14 15:20:30 +08:00
liu zhengxi
7d2f50e4f2 Refine cpp demo flags vocab_dir to vocab_file (#1150) 2021-10-14 14:52:42 +08:00
Zeyu Chen
0f2d8a6343 Update README.md 2021-10-14 10:54:52 +08:00
huhuiwen99
021faa67cd Doc update (#1159)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* add macbert

* first update

* add convbert and mpnet model

* update

* updat4e

* add model number
2021-10-13 21:17:03 +08:00
Guo Sheng
873a93a62b Refine SM description in FT docs. (#1158)
* Refine SM description in FT docs.

* Refine jit build warning condition.

* Refine fastertransformer.rst

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-13 18:51:22 +08:00
yingyibiao
f02435aee1 Update pretrained weights contribution doc (#1155)
* update pretrained weights contribution doc

* update pretrained weights contribution doc
2021-10-13 18:43:45 +08:00
gongenlei
154e1a4ca6 docs: update docs (#1157) 2021-10-13 16:00:22 +08:00
yujun
0530cabc6c add RepetitionPenaltyLogitsProcessor (#1111)
Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2021-10-12 16:17:29 +08:00
Jiaqi Liu
fd02d65d0a fix MiniLMv2 model name in readme (#1149) 2021-10-12 11:03:39 +08:00
Zeyu Chen
0aa58994e7 Update README.md 2021-10-12 02:34:35 +08:00
zhaoyingli
91d81c928c add sharding for gpt3 (#1064)
* add sharding for gpt-3

* del debug

* add sharding save model

* update model save

* fix seed func

* set control in tensor parallel

Co-authored-by: Zhong Hui <zhonghui.net@gmail.com>
2021-10-11 23:25:57 +08:00
Guo Sheng
e05aed8caf Update FasterTransformer link. (#1148) 2021-10-11 23:16:39 +08:00
Jack Zhou
7c460f64b5 Fix readme error of information extraction (#1147) 2021-10-11 22:59:40 +08:00
huhuiwen99
b259ea3bfc Modify Bartmodel Docstring (#1144)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify bartmodel

* fix errors

* fix errors
2021-10-11 20:36:38 +08:00
wawltor
de3e79c370 resolve the windows problem in skep task (#1146)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-11 20:12:49 +08:00
linjieccc
2786381122 update readme for taskflow (#1145) 2021-10-11 20:09:21 +08:00
liyueyang
4bc68614aa Update README.md (#1142)
* Update README.md

Co-authored-by: tianxin <tianxin04@baidu.com>
2021-10-11 19:39:37 +08:00
huhuiwen99
8df317a967 Modify layers Doc (#1140)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify datasets

* modify layers

* fix errors

* fix errors

* fix errors
2021-10-11 18:33:34 +08:00
gongenlei
bb70fd1a42 [BART] Add example and faster generation api (#1113)
* feat: add BART example

* refactor: rm model_type

* style: optimize params name stype

* refactor: rm fluid api and correct equality judgment

* docs: add docs

* docs: update docs.

* feat: add jit

* docs: update docs

* fix: GELU change to approximate

* fix: add gelu judgement

* fix: update layer.activation

* refactor: update amp scaler usage

* docs: update docs

* docs: update docs for FasterBART

* docs: update docs for FasterBART

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-11 18:12:35 +08:00
huhuiwen99
fa26d3d6ea Modify Skep Docstring (#1139)
* modify transforner-rst

* modify roformer tokenizer

* delete modifications

* modify skepmodel

* modify skep tokenizer

* update

* modify skeptokenizer

* modify bart

* update

* update

* modify bigbird tokenizer

* modify bigbirdmodel

* modify skepmodel

* fix errors
2021-10-11 17:12:45 +08:00
Zeyu Chen
a6e886b99a Update README 2021-10-11 16:55:19 +08:00
huhuiwen99
067fde6fda Modify Unimo Docstring (#1066)
* modify transforner-rst

* modify unimo tokenizer

* modify unimo models

* modify roberta tokenizer

* modify roberta models

* update

* modify unimo

* update
2021-10-11 15:13:31 +08:00
liu zhengxi
93a53ecde5 delete deployment (#1138) 2021-10-11 14:46:41 +08:00
liu zhengxi
29df4805b8 Change FT doc filename (#1136) 2021-10-11 13:41:50 +08:00
liu zhengxi
3f57a78a6e Refine FasterTransformer doc (#1097) 2021-10-11 12:36:27 +08:00
yingyibiao
0108724734 set maxdepth=1 for index page of readthedocs (#1134)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-11 12:30:52 +08:00
wawltor
d209d9a73d Remove unnessasary load NER task of taskflow (#1135) 2021-10-11 12:10:03 +08:00
huhuiwen99
1ea856e03c Modify Electra Doc (#1099)
* modify transforner-rst

* modify electra tokenizer

* modify electramodel

* modify electra criterion

* modify models

* modify tokenizers

* fix errors

* update
2021-10-11 10:38:04 +08:00
wawltor
3cd45be7ff update the text correction in document (#1131)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-10 22:19:59 +08:00
Guo Sheng
82c32ebeb5 Refine FasterTransformer (#1122)
* Expose diversity rate.
Refine extension utility.
Update topk_update in FT.

* Remove duplicate doc for diversity_rate.

* Fix FT jit compiling cmake args.

* Fix sources attribute of FasterTransformerExtension.

* Use UPDATE_COMMAND instead of PATCH_COMMAND to make re-run always use the latest patches.

Fix beam_id_in_output calculation in topk_stage_1_opt3.

* Update FT BLEU report in README.

* Fix diversity in beam search when not fusing topK and softmax.

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-10 22:19:34 +08:00
wawltor
ec2333e499 Add the knowledgemining task update the document for the Taskflow (#1130)
* update the document for the taskflow and add the taskflow of knowledge_minin

* update the document for the taskflow in main document
2021-10-10 22:08:36 +08:00
Zeyu Chen
522f279359 Update README.md 2021-10-10 20:33:45 +08:00
wawltor
bb413b0252 Merge pull request #1126 from joey12300/fix_crf_decode_len_equal_1_bug
fix viterbi len=1 bug
2021-10-10 20:29:06 +08:00
huhuiwen99
04de79553e Modify Roformer Doc (#1104)
* modify transforner-rst

* modify roformer tokenizer

* modify roformer model

* update

* modify transformer

* modify roformer modeling

* modify decoder

* update

* modify tokenizer

* modify token_embedding
2021-10-10 17:45:44 +08:00
wawltor
081e285279 Add the word segmentation task in the Taskflow (#1123)
* Add the word segmentation task in the Taskflow

* format the example in the taskflow

* remove the limit for seq length for the segment

* Add the poetry_generation and question answering tasks

* change the text2knowledge to ner task

* update some code for the taskflow

* add the pos tagging for the taskflow

* Update the doc for the taskflow tasks

* update the pos tagging doc

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-10 17:40:42 +08:00
linjieccc
dc6812175c update taskflow doc (#1129) 2021-10-09 23:43:03 +08:00
tianxin
9686f0dec9 Update README.md for FSL (#1125)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-10-09 16:38:12 +08:00
zhoushunjie
74a7f106e2 fix len=1 bug 2021-10-09 16:26:15 +08:00
Jiaqi Liu
fc1f925b68 Update readme (#1124)
* update readme

* update description about minilm and tinybert
2021-10-09 16:26:14 +08:00
liyueyang
c056495ccd update readme (#1121) 2021-10-09 11:16:38 +08:00
tianxin
73933974ea Merge pull request #1105 from leeyy2020/few_shot_rdrop
add drop for few-shot learning
2021-10-08 15:19:28 +08:00
tianxin
0327121a27 Merge branch 'develop' into few_shot_rdrop 2021-10-08 14:40:37 +08:00
wawltor
928c34a669 add task name for the log (#1118) 2021-10-08 12:41:27 +08:00
leeyy2020
eec0299bd4 update and fix problem 2021-09-30 07:53:32 +00:00
Zeyu Chen
7419d2546b Update README.md 2021-09-29 14:33:41 +08:00
yingyibiao
a88382d940 Convert vocab_file to keyword arg (#1102)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-09-28 22:43:42 +08:00
leeyy2020
6007835903 update README 2021-09-28 14:40:37 +00:00
leeyy2020
929ad0c73e add rdrop to fewshot 2021-09-28 13:39:55 +00:00
gongenlei
5f0e8c23cb [DATASET] Add cnn_dailymail dataset (#1061)
* feat: add cnn_dailymail dataset

* fix: correct error message

* refactor: use paddlenlp decompress api

* docs: add doc for cnn_dm
2021-09-28 19:17:45 +08:00
Jiaqi Liu
232bea23e5 Fix clue test dataset info bug (#1098) 2021-09-27 17:01:36 +08:00
huhuiwen99
6b6bcf1a6b Modify Ernie Docstring (#997)
* modify ernie

* modify modeling

* modify ernie-ctm

* modify tokenizer

* modify ernie-ctm tokenizer

* modify modeling

* modify erniemodel

* modify ernie-ctm

* modify ernie-gen

* modify tokenizer

* modify ernie models

* modify ernie-gen

* fix errirs

* modify erniemodel

* modify erniemodel
2021-09-24 14:58:34 +08:00
liu zhengxi
375df594de Expose beam search diversity rate for ft (#1072)
* expose beam search diversity rate for ft

* rename param

* fix generation api

* fix bart
2021-09-23 21:08:20 +08:00
linjieccc
af7cf94536 Merge pull request #1083 from linjieccc/update_comments
Update comments of text classificaiton
2021-09-23 18:24:13 +08:00
linjieccc
8c1477fd6c update comments of text classificaiton 2021-09-23 09:53:48 +00:00
yingyibiao
ce7c267c4e update sphinx_rtd_theme version (#1071) 2021-09-23 16:12:33 +08:00
wawltor
bca4e2225d fix the bug of winodws load bug. (#1062) 2021-09-23 11:21:17 +08:00
huhuiwen99
499cbe4553 Modify Distilbert docstring (#949)
* modify distilbert

* modify distilbert

* modify nezha tokenizer

* modify nezha

* update

* modify models

* modify args

* fix errors

* modify args
2021-09-22 17:44:33 +08:00
ShenLiang
15693c7377 Speed up for hybrid parallel (#1056) 2021-09-18 19:32:17 +08:00
smallv0221
64b6f0f394 Fix generate api bug and add diverse sibling search (#1041)
* Add offset mapping doc

* fix eval hang because of unique endpoint

* generate api support encoder-decoder

* Add lightseq beam_search

* optimize performence

* add blockroughk kernel

* optimize

* minor fix

* Fix generate api bug and add diverse sibling search

* minor fix
2021-09-18 14:32:32 +08:00
liu zhengxi
a3db9c9f59 [FasterTransformer] Fix compiling error by use abs path (#1051)
* fix cmake by use abs path

* add boost dependency

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-09-17 22:37:00 +08:00
gongenlei
6feb6d0082 fix: fix mem_seq_lens dtype (#1050) 2021-09-17 21:29:51 +08:00
smallv0221
2cf80b9a83 Add origin generate api speed comparison (#1047)
* add origan generate api speed comparision

* add speed example

* minor fix

Co-authored-by: liu zhengxi <380185688@qq.com>
2021-09-17 17:07:27 +08:00
gongenlei
70debdbc2a fix: change RELU to GELU for FT gpt (#1048) 2021-09-17 17:03:50 +08:00
Zhong Hui
da5a62bd4d Fix gpt accuracy ci tests. (#1044)
* Fix gpt accuracy ci tests.

* move gpt tests to tests/example/gpt
2021-09-17 15:38:12 +08:00
Zhong Hui
d1699cdd43 Add additional log for training with amp. (#1042) 2021-09-17 14:36:47 +08:00
Jiaqi Liu
c63a9adb08 Recover bert_encoder_transformer.h (#1029)
remove useless parameters, and remove redefination of pretrain model, and update layer replacement for considering each layer independently.

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-09-17 13:57:16 +08:00
gongenlei
729198ec30 [FasterTransformer] Support BART (#1021)
* feat: add FT bart

* refactor: remove print

* feat: add other files

* refactor: remove print

* refactor: add pos_offset attribute

* refactor: rename attribute

* refactor: add ActivationType attribute

* refactor: mv encoder to FasterBART
2021-09-17 13:55:42 +08:00
tianxin
97b20d4a63 Support pre-normalization for FT Encoder fp32 (#974)
* add encoder op

* support fp16

* support pre-normalization for FT Encoder fp32

* update CMakelists.txt

* move code to cuda_kernel_h and cuda_kernel_cu

* uncomment FT sample

* add jiaqi code

* self-attn output diff

* finish pre-normalization v1

* implement generalized kernel

* add v1 encoder

* delete assert for generalize version kernel

* support post-normalization fp32 for FT Encoder

* delete unused CMake commands

Co-authored-by: LiuChiaChi <709153940@qq.com>
Co-authored-by: LiuChiachi <70913940@qq.com>
Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
2021-09-16 20:50:36 +08:00
liu zhengxi
b659f1fb79 Fix post-process of unimo-text (#1038) 2021-09-16 15:43:49 +08:00
ShenLiang
8387847b38 Fix bug of gpt-3 pipeline recompute (#1037) 2021-09-16 15:28:27 +08:00
huhuiwen99
f6a5e7b4e1 ModelingRST Modify (#989)
* add bart

* add unimo

* add roberta

* add roformer

* modify transformer-rst
2021-09-16 13:03:01 +08:00
liu zhengxi
fda6236676 fix unimo doc (#1033) 2021-09-16 11:49:27 +08:00
liu zhengxi
54f80e96f0 [FasterTransformer] Fix encoder compiling (#1030)
* fix encoder
2021-09-16 10:45:18 +08:00
ShenLiang
7fb87843a1 [GPT-3]add recompute for mp (#1031) 2021-09-15 20:53:23 +08:00
gongenlei
2097ef5846 [BART] Tokenizer support not to split special tokens (#1000)
* fix: bart tokenizer support not to split special tokens

* rafactor: get specials tokens by internal hook

* docs: update doc
2021-09-15 20:13:52 +08:00
liu zhengxi
3dc7452c50 Fix FT doc (#1028)
* fix doc

* tran -> trans
2021-09-15 19:10:51 +08:00
smallv0221
c3705e4048 Add lightseq hierarchical beam_search (#978)
* Add offset mapping doc

* fix eval hang because of unique endpoint

* generate api support encoder-decoder

* Add lightseq beam_search

* optimize performence

* add blockroughk kernel

* optimize

* minor fix
2021-09-15 15:42:37 +08:00
liu zhengxi
74dc99747b Faster Transformer cmake promote (#879)
* update cmake

* rm python deps when on_infer is no

* refine encoder code
2021-09-15 11:43:57 +08:00
ShenLiang
de4fc9d946 [GPT-3] Fix bug of CE config (#1024) 2021-09-15 11:41:19 +08:00
Jack Zhou
1d525371fa fix text correction windows dtype (#1023) 2021-09-15 11:39:26 +08:00
tianxin
898f2e18e5 fix bug of question matching (#1022) 2021-09-15 02:22:11 +08:00
Jiaqi Liu
008291658c Add encoder op (#952)
* add encoder op

* support fp16

* update encoder sample

remove useless config

use pad to max seq len

* commit before pull

* update patches and cmakelist

* upadte the interface for encoder op

* support jit, and support replacing forward function of nn.TransformerEncoder(and *Layer) object

* support jit

move encoder sample to semantic index, and update readme

delete fp16

add device config info

fix disable faster encoder bug

* remove unsupported argument

add docstring and warning process for False bias_attr of EncoderLayer

fix docstring format

add \n, and add docstring for infer_transformer_encoder

Co-authored-by: LiuChiachi <70913940@qq.com>
2021-09-14 21:05:49 +08:00
liu zhengxi
61c638f381 Use double precisionto train in full procedure (#1017) 2021-09-14 11:57:56 +08:00
Zhong Hui
a8272355fa opt electra training for amp. (#1018)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-09-14 11:56:38 +08:00
Zhong Hui
45967dcbc5 fix export and infer model of gpt. (#1019) 2021-09-14 11:55:16 +08:00
Linjie Chen
71aff690bb fix bugs on windows, default convert to int64 (#1016) 2021-09-14 00:46:50 +08:00
liu zhengxi
398473bc51 [FasterTransformer] Support Unimo-Text (#945)
* support unimo text

* delete lines

* update

* update

* undo run_gen.py

* split faster

* undo gen_utils.py

* upload faster gen_utils.py

* undo

* update

* update

* update

* fix comments

* name

* name again

* update format
2021-09-13 22:26:17 +08:00
Jiaqi Liu
0cebfabfc5 fix minilm readme bug (#1014) 2021-09-13 19:39:27 +08:00
Jack Zhou
42447b8b85 Fix ernie csc decode (#1005)
* use list() instead of tokenize

* use list() instead of tokenize in taskflow

* add max_seq_length in readme

* add dynamic predict in text_correction task

* fix windows predict bug
2021-09-13 14:16:15 +08:00
Zhong Hui
1914c8a24d Adopt new data pipeline for GPT. (#930) 2021-09-13 10:55:40 +08:00
liu zhengxi
27727b18f7 [FasterTransformer] Transformer and GPT support dy2sta (#991) 2021-09-13 10:52:34 +08:00
wawltor
955c10b67a set the device id for the taskflow (#1011) 2021-09-12 17:45:56 +08:00
yujun
b9a4cb1fea Add MPNet Model (#869)
* add mpnet

* update

* update tokenizer and update readme

* update readme & add docs

* rm unused figure

* update

* update

* update copyright

Co-authored-by: gongenlei <gongel@qq.com>
2021-09-11 23:50:51 +08:00
AI-Mart
211c0f5eb2 Update convert_pytorch_to_paddle.rst (#1009) 2021-09-11 20:31:37 +08:00
Linjie Chen
28a61b2eaa fix text classification deploy mode (#1006)
* fix path issue on deploy mode

* fix path issue on deploy mode
2021-09-11 16:49:23 +08:00
小五井
c5fb88c158 Add Readthedocs FAQ (#1007)
* add faq

* add faq

* readthedocs_faq

Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
Co-authored-by: yingyibiao <yyb0576@163.com>
2021-09-10 18:33:55 +08:00
小五井
9a8d41439b Add FAQ File (#1003)
* add faq

* add faq

Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
2021-09-10 15:58:02 +08:00
Zhengyang Song
a0e7a14d72 Refactor convert_example of text_classification pretrained examples. (#992)
* Refactor convert_example of pretrained examples.

Also fix some typos in README regarding paddle serving.

* Update the README of text_classification pretrained example to  use latest version of paddle-serving-server-gpu.

* Set the util path correctly, also add the instruction to set PYTHONPATH in README.

Reference: https://stackoverflow.com/a/54597040/6741885

* Update README.md

Co-authored-by: Linjie Chen <40840292+linjieccc@users.noreply.github.com>
2021-09-09 20:18:57 +08:00
Zhong Hui
b55782c6c5 quick fix for gpt export_model (#1001) 2021-09-09 16:50:46 +08:00
Linjie Chen
2d4dc85662 Fix taskflow ddparser visualization
Fix taskflow ddparser visualization
2021-09-09 15:29:34 +08:00
linjieccc
1ceaa81a1b fix bug of visualization using ddparser 2021-09-09 07:18:39 +00:00
ShenLiang
714ca2c2a1 [HybridParallel]Add gpt example using dygraph hybrid parallel (#986)
* add gpt3 in dygraph

* fix run.sh

* fix some code for dataset

* fix distributedbatchsample

* fix args

* fix args

* fix code for sh

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-09-09 12:31:56 +08:00
wawltor
e14778c62f add the taskflow doc for some tasks (#981)
* add the taskflow doc for some task

* update the ddparaser doc about taskflow

* remove the unused code for the paddlenlp

* update the taskflow docs

* add the input check for the tasks

* add the document for the taskflow

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-09-09 12:23:42 +08:00
Jack Zhou
9ee168a229 fix ernie-ctm tokenizer bug (#995) 2021-09-09 11:29:23 +08:00
Zhong Hui
2ea5ffcf45 fix deadlink (#993) 2021-09-09 11:05:28 +08:00
Jack Zhou
8775856682 Add text correction taskflow (#988)
* add text_correction in task flow

* add readme

* modify model and pinyin vocab url

* add is_chinese_char

* display errors in results

* add taskflow in ernie-csc README

* move argmax to model implementation

* remove unnecessary is_chinese_char

* add more comments to introduce ErnieForCSC
2021-09-08 22:59:02 +08:00
Zhong Hui
7a4f830c43 Delete custom op for adamw. (#984) 2021-09-08 19:53:22 +08:00
Zhong Hui
4756db5472 mv ernie to experimental. (#985) 2021-09-08 19:51:57 +08:00
huhuiwen99
f3cf4a579e Modify GPT Docstring (#942)
* first commit of gpt

* modify tokenizer

* modify bart tokenizer

* modify tinybert tokenizer

* modify tinybert modeling

* modify tinybert

* fix gpt errors

* fix errors

* modify gpt

* modify models

* update

* resolve conflicts

* resolve conflict
2021-09-08 16:05:32 +08:00
yujun
0c751f3fae add ConvBert Model (#819)
* add convbert

* update readme

* pre-commit

* update model & add compare

* update

* update readme & fix convbert-small pretrain

* fix convbert-small pretrain

* update

* update readme

* add ConvBertForMultipleChoice and ConvBertForQuestionAnswering

* suggestion from gongel

* add docs

* update attention_mask

* rm unused dropout

Co-authored-by: gongenlei <gongel@qq.com>
Co-authored-by: yingyibiao <yyb0576@163.com>
2021-09-08 15:23:08 +08:00
Zhong Hui
41e1427ebd Fix bug on windows, default convert labels to int64. (#982) 2021-09-08 11:42:34 +08:00
Jiaqi Liu
a61d4d3dac add hot boot arg (#980) 2021-09-08 11:03:37 +08:00
liu zhengxi
1a6729e7ca Add custom vocab file for ce (#963) 2021-09-07 21:47:57 +08:00
Linjie Chen
6ce057a1bf Update readme (#979)
* fix the multi-label text classification readme

* update examples readme

* update examples list
2021-09-07 21:46:46 +08:00
wawltor
9844a91bbb add the chinese task for the taskflow
add the chinese task for the taskflow
2021-09-07 21:16:41 +08:00
wawltor
d51d5d4006 fix the text classification document (#977) 2021-09-07 18:01:38 +08:00
Jack Zhou
aaa1c79933 Add csc task (#929)
* add csc task.
1. add detection labels in convert_example

* add train progress

* rename spelling_correction to text_correction

* add pinyin vocab

* fix read_test

* fix decode

* change data.py to utils.py

* add evaluate for csc

* add parse decode for predict

* add Chinses Spelling Correction datasets

* use load_dataset('csc') instead of load_dataset(local_file)

* fix word length

* add predict script

* decouple csc model and ernie-gram

* add ernie backbone

* change default model_type to ernie

* add roberta

* fix decode

* add sighan test dataset;add sighan predict script;

* remove sighan testset

* add download script

* add README.md

* add export model

* add ernie-csc directory

* fix some review comments

* add sighan dataaset

* remove unnecessary model

* add deploy model

* add dataset download

* remove deploy/predict.py;fix some readme bug

* modify accroding to review comments

* Add more comments on model implementation

* upgrade sighan_evaluate.py

* add some comments in sighan metrics.
2021-09-07 17:13:56 +08:00
wawltor
c09d901f85 Merge pull request #4 from linjieccc/add_taskflow_ddparser
Replace np.argmax to paddle.argmax
2021-09-07 16:27:06 +08:00
linjieccc
fe352cc74d change model output 2021-09-07 08:18:22 +00:00
wawltor
22f52247a7 remove the print code in taskflow skep model 2021-09-07 10:47:37 +08:00
wawltor
ab8532395f Merge pull request #847 from linjieccc/ddparser
Add ddparser example
2021-09-07 10:37:27 +08:00
wawltor
b5278384e7 update md5sum for the tasks 2021-09-07 10:30:48 +08:00
wawltor
47442299e0 support the predictor for the other tasks 2021-09-06 16:41:53 +08:00
Zhengyang Song
af82e03bbf Fix text_classification examples multi_label. (#973)
1. code fix: dataset_name -> file_name in predict.py
2. add default value for params_path in predict.py
3. remove misleading comments in train.py: we have no demo for ernie in the multi_label example.
4. remove unused imports.
2021-09-06 15:54:11 +08:00
Jiaqi Liu
6e39f20add update clue dataset, and remove useless argment for run_clue (#975) 2021-09-06 14:42:43 +08:00
Zhengyang Song
98e35649b5 Fix rnn example. (#971)
1. typo fix: stm_hidden_size -> lstm_hidden_size.
2. import fix: add missing imports in export_model.py
3. nit: remove unused imports.
2021-09-04 04:15:57 +08:00
tianxin
c7fb2b91c2 add paddlefsl into requirements.txt (#968)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-09-03 20:44:24 +08:00
gongenlei
8c387e5494 [BeamSearchV2] Support converting dygraph to static graph (#959)
* feat: beamsearch v2 support dygraph to static graph

* docs: add some annotations
2021-09-03 17:31:20 +08:00
wawltor
2b2830e2bc Merge pull request #3 from linjieccc/add_taskflow_ddparser
add use_cuda option for lac
2021-09-03 17:12:35 +08:00
linjieccc
6d07243717 add try import for dependent modules 2021-09-03 09:07:31 +00:00
linjieccc
f4a2138876 add try import for dependent modules 2021-09-03 09:05:44 +00:00
linjieccc
156ab97d93 upate dataloader & enhance comments 2021-09-03 08:52:37 +00:00
Jack Zhou
fe69df50e1 upgrade lac (#969) 2021-09-03 16:43:12 +08:00
smallv0221
14b6f897b8 Generate api support encoder-decoder (#966)
* Add offset mapping doc

* fix eval hang because of unique endpoint

* generate api support encoder-decoder
2021-09-03 16:13:39 +08:00
Guo Sheng
034cd53b16 Add FasterTransformer beam-search v2. (#862)
* Add FasterTransformer beam-search v2.

* Fix end of line.

* Fix end of line.

* Fix CMake.

* Fix input shape in fusion_decoding_op.cc

* Fix fusion_decoding_op.h

* Fix arguments in fusion_decoding_op.cc.

* Delete Print in decoding_beamsearch.h to mute.

* Add general beam size support for beam search V2.

* Refine code by adding adjustable alpha for FT beam search v2.

* Fix demo/transformer_e2e.cc

* Polish FasterTransformer api doc.

* Clean code for FT beam search v2.

* Clean code for FT beam search v2.

* Clean code for FT beam search v2.

* Refine API doc for TransformerGenerator.

* Refine API docs for TransformerGenerator.

* Refine API docs of TransformerGenerator.
2021-09-03 15:26:50 +08:00
linjieccc
cc7160e7c2 fix import 2021-09-03 05:21:35 +00:00
linjieccc
7786dcaaad add use_cuda option for lac 2021-09-03 03:14:38 +00:00
wawltor
693d160f49 Merge pull request #2 from linjieccc/add_taskflow_ddparser
add md5 check & enhance comments
2021-09-03 10:46:18 +08:00
linjieccc
520e749083 add md5 check & enhance comments 2021-09-03 02:41:23 +00:00
tianxin
3174579746 update README.md (#965) 2021-09-02 21:15:25 +08:00
gongenlei
d57a213f88 feat: add use_cache flag for generation (#964) 2021-09-02 20:43:01 +08:00
linjieccc
5007cc5351 update readme 2021-09-02 09:57:36 +00:00
linjieccc
306eace419 update readme 2021-09-02 09:55:20 +00:00
linjieccc
4f2f71c02d update readme 2021-09-02 09:52:22 +00:00
linjieccc
7935436e9f update readme 2021-09-02 09:48:22 +00:00
wawltor
9b04a7a7c3 Merge pull request #1 from linjieccc/add_taskflow_ddparser
add taskflow ddparser & add static predictor
2021-09-02 16:28:27 +08:00
Linjie Chen
a422e7f707 Merge branch 'add_taskflow_cn_tasks' into add_taskflow_ddparser 2021-09-02 16:25:12 +08:00
Jack Zhou
0a734698f1 fix precision (#962) 2021-09-02 16:22:16 +08:00
linjieccc
5947f823e3 add taskflow ddparser & add static predictor 2021-09-02 16:21:25 +08:00
Jiaqi Liu
b47de842c5 Add MINILMV2 (#704)
* add minilm task distill

* add general distillation MINILMV2, and update distill_utils

* remove test break and gradient accumulate

* fix loss funct

* optimize distill utils

* add tinybert general distillation

* add tinybert general distillation

* update default hyperparameters

* add cold boot

* correct optimizer adam to adamw using weight decay, and add clip norm

* update optimizer for minilm, and add clip norm

* update arg and support minilmv2

* add readme for minilmv2

add run_clue.py scripts

update dataset name of wsc

update dataset name of wsc

add parameters link
2021-09-02 15:04:59 +08:00
wawltor
d270c66bb8 update the import for the taskflow 2021-09-02 14:31:11 +08:00
wawltor
2d02b854aa change the TaskFlow to Taskflow 2021-09-02 14:24:34 +08:00
huhuiwen99
93cdd6477a Docs and Clear-api Modify (#948)
* modify docs

* modify docs

* del inheritance

* add inheri
2021-09-02 13:11:08 +08:00
Zhong Hui
a96ebb0f43 Ernie pretraining optimization (#956)
* fix write file

* add share folder support

* don't delete train log

* don't use inplace random mask.

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-09-02 12:23:58 +08:00
yingyibiao
15bee1e06f modify content width of readthedocs web (#960)
* modify content width of readthedocs web

* modify content width of readthedocs web

* modify content width of readthedocs web

* Update custom.css
2021-09-02 12:22:28 +08:00
linjieccc
cfead3d1b9 add comment & update readme 2021-09-02 03:57:26 +00:00
wawltor
00342d44ea fix some problems for the tasks 2021-09-02 11:56:01 +08:00
yingyibiao
225e4c9146 modify content width of readthedocs web (#958) 2021-09-02 11:08:07 +08:00
wawltor
285395490a Merge pull request #955 from linjieccc/update_example_readme
Update README.md
2021-09-02 00:39:24 +08:00
wawltor
bd0748f5f1 add the chinese task for the taskflow 2021-09-02 00:30:15 +08:00
linjieccc
1f5c1e41fb update examples readme 2021-09-01 21:21:25 +08:00
iamqiz
02bb22edad Update data_preprocess.rst (#951)
Tuple的init参数修改
2021-09-01 18:38:04 +08:00
tianxin
b0a9b37a45 Fix README typo of SimCSE (#954) 2021-09-01 18:36:54 +08:00
linjieccc
2088c32bb0 update datasets 2021-09-01 09:45:02 +00:00
linjieccc
c34c4e875f update datasets 2021-09-01 08:55:36 +00:00
linjieccc
5e80f5e6cc delete empty line 2021-09-01 08:43:18 +00:00
linjieccc
fbae67aeba delete empty line 2021-09-01 08:39:01 +00:00
linjieccc
95b200cb36 update datasets load 2021-09-01 08:32:35 +00:00
iamqiz
11080d81e9 Update dataset_self_defined.rst (#950) 2021-09-01 14:38:37 +08:00
linjieccc
4a24119376 update readme 2021-08-31 13:42:32 +00:00
linjieccc
4e48732ff3 update ddparser readme 2021-08-31 05:57:04 +00:00
linjieccc
bdb76099de update ddparser readme 2021-08-31 05:54:02 +00:00
linjieccc
5f1db0a22a add taskflow ddparser 2021-08-31 05:34:29 +00:00
Zhong Hui
94c641aa9b fix gpt tokenizer typo (#935) 2021-08-30 11:59:09 +08:00
Zhong Hui
7789a644a6 Fix serious bug of batch sampler. (#939) 2021-08-30 11:51:36 +08:00
liu zhengxi
ab1c74f4ee fix cpp python diff (#936) 2021-08-27 18:36:16 +08:00
liu zhengxi
ac4dabf946 minor fix encoder_decoding_sample (#934) 2021-08-27 14:41:28 +08:00
tianxin
047693df94 [Question matching] Add introduction of competition into README.md (#928)
* fix ernie_text_matching ci config

* add Introduction of competition

* Update README.md

* Update README.md

* Update README.md

Co-authored-by: chenustc <2601898400@qq.com>
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-08-27 13:49:41 +08:00
tianxin
47f4362a3d update README.md (#933) 2021-08-27 13:03:25 +08:00
linjieccc
f6e63b67c0 add static model & deploy 2021-08-26 16:12:55 +00:00
huhuiwen99
1bab575315 Modify Bert Docstring (#914)
* modify bertmodeling

* modify berttokenizer

* fix errors

* fix some errors

* modify errors

* modify tokenizer

* modify errors

* update

* modify criterion

* update

* update

* fix errors

* update

* update

* pre-commit

* pre-commit
2021-08-26 16:32:42 +08:00
liu zhengxi
a84d7ce663 [Faster Transformer][Ready for review] Support unified transformer (#569) 2021-08-26 15:02:03 +08:00
Zhong Hui
1a7cfc7c4c Add new pretraining data process for transformers pretrain and ernie-1.0 pretrain example. (#816) 2021-08-26 12:32:01 +08:00
smallv0221
ab100b178b fix eval hang because of unique endpoint (#925)
* Add offset mapping doc

* fix eval hang because of unique endpoint
2021-08-26 11:00:22 +08:00
tianxin
c7b1bc6607 [Question matching] add max_steps argument for CICE (#926)
* finish QM baseline

* update

* update

* update

* add README.md

* Update README.md

* implement rdrop as paddlenlp api

* add rdrop.py into paddlenlp.losses module

* release pretrained model to reproduce out results

* add max_steps for CICE

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-08-26 10:58:42 +08:00
smallv0221
e79da85187 Add offset mapping doc (#924) 2021-08-25 20:34:47 +08:00
liu zhengxi
6b76d12b29 Fix beam search v2 dtype int32 (#918)
* fix dtype int32

* update arange

* trg_pos
2021-08-25 14:36:02 +08:00
yujun
582b4ca4cb fix (#882)
Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2021-08-25 12:51:24 +08:00
Jack Zhou
0444152f4f add max steps for ernie-doc examples (#920) 2021-08-24 21:46:45 +08:00
gongenlei
bad882ce71 Merge pull request #858 from gongel/ft_decoder_op
[Feat] Add custom op for FasterTransformer decoder
2021-08-24 17:22:27 +08:00
gongenlei
8019078476 Merge branch 'develop' into ft_decoder_op 2021-08-24 15:57:33 +08:00
linjieccc
bc4b57675d update directory structure 2021-08-24 02:00:56 +00:00
tianxin
15b3dadae4 Add SimCSE (#854)
* add FewCLUE 9 datasets

* fix a bug for tnews

* Add CI for Ernie text matching

* Add CI for Ernie text matching

* Add CI for Ernie text matching

* fix encoding problem for windows

* update ernie_text_matching ci

* standard GPU id for CI

* standard GPU id for CI

* add simcse

* update train.py

* support multi-card training

* add README.md

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-08-24 09:07:56 +08:00
linjieccc
c76b44d5fb update readme 2021-08-23 10:28:13 +00:00
linjieccc
1d4aa2e4c8 update readme 2021-08-23 10:06:36 +00:00
linjieccc
3095e9942b update readme 2021-08-23 10:04:02 +00:00
linjieccc
fb0f1da7d2 delete empty line 2021-08-23 10:01:06 +00:00
linjieccc
714abfc0b3 add paddlenlp/dataset api 2021-08-23 09:56:45 +00:00
Linjie Chen
1e9f4328f6 Merge branch 'PaddlePaddle:develop' into ddparser 2021-08-23 17:51:00 +08:00
gongenlei
7096d5f2b2 Merge branch 'develop' into ft_decoder_op 2021-08-23 15:44:33 +08:00
smallv0221
9d95922d96 Add news for qianyan contest (#915)
* fix unified transformer dtype problem

* fix win dtype bug

* Fix plato-2 and plato-mini dtype bug

* Fix plato-2 tokenization

* Refine some doc

* Add general k support for topk sampling

* fix seed

* minor fix

* Fix unitransformer readme

* topk kernel optimization

* add unimo model and fix generate api

* add 3 datasets for unimo-text

* fix tokenizer bug

* paddlenlp+lightseq sample

* Refine api docs and readme and fix baseline bug

* add shell srcipt

* remove lightseq samples

* minor fix

* minor fix

* Add news

* minor fix

* minor fix

* minor fix

Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
Co-authored-by: liu zhengxi <380185688@qq.com>
2021-08-23 15:32:34 +08:00
smallv0221
fe8c2d694e Refine api docs and readme and fix baseline bug (#912)
* fix unified transformer dtype problem

* fix win dtype bug

* Fix plato-2 and plato-mini dtype bug

* Fix plato-2 tokenization

* Refine some doc

* Add general k support for topk sampling

* fix seed

* minor fix

* Fix unitransformer readme

* topk kernel optimization

* add unimo model and fix generate api

* add 3 datasets for unimo-text

* fix tokenizer bug

* paddlenlp+lightseq sample

* Refine api docs and readme and fix baseline bug

* add shell srcipt

* remove lightseq samples

* minor fix

* minor fix

Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
Co-authored-by: liu zhengxi <380185688@qq.com>
2021-08-22 18:00:08 +08:00
liu zhengxi
9602532c40 fix paddle.sum (#909) 2021-08-20 15:18:49 +08:00
gongel
bfe0ae98db fix: use cuda_add_library correctly 2021-08-20 06:26:12 +00:00
liu zhengxi
4075ea6675 Transformer input id supports int32 & mv beam search v2 (#905)
* support int32

* mv beam search v2
2021-08-20 10:09:59 +08:00
tianxin
2ae7a8716c Release pretrained model for question matching baseline (#907)
* finish QM baseline

* update

* update

* update

* add README.md

* Update README.md

* implement rdrop as paddlenlp api

* add rdrop.py into paddlenlp.losses module

* release pretrained model to reproduce out results

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-08-19 21:31:28 +08:00
gongenlei
057d920e45 Merge pull request #838 from gongel/feat_beam_search_v2
[Feat] Add Beam Search v2
2021-08-19 14:02:53 +08:00
gongenlei
52390d5d44 Merge branch 'develop' into feat_beam_search_v2 2021-08-19 14:00:46 +08:00
gongel
f188e899ea refactor: default to beam search v1 2021-08-19 13:27:56 +08:00
gongel
6414565c7c fix: remove .numpy() to support static graph 2021-08-19 13:20:00 +08:00
gongel
9cd3574d93 feat: add pd_infer_custom_op for decoder 2021-08-18 22:16:28 +08:00
gongel
b448d77c64 docs: add api docs for InferTransformerDecoder and FasterDecoder 2021-08-18 21:42:36 +08:00
小五井
dbb0e57d82 Modify QQ Name (#904)
* add qq group

* modify qq

Co-authored-by: chenxiaozeng <chenshuo07@baidu.com>
2021-08-18 20:56:52 +08:00
小五井
3ce9f1d05a add qq group (#903) 2021-08-18 20:33:10 +08:00
小五井
95122fc86a delete qq (#901) 2021-08-18 19:56:46 +08:00
gongel
28d20b476f fix: compute real mem_seq_lens 2021-08-18 19:30:11 +08:00
gongel
ac54792dd8 refactor: remove predict_beamsearch_v2 2021-08-18 16:07:40 +08:00
gongel
85ec79b3f6 refactor: combine beam search v1 and v2 2021-08-18 16:04:36 +08:00
小五井
0bfae0a883 Modify QQ Group info (#897)
* modify readme_qq

* modify readme qq
2021-08-18 15:30:46 +08:00
gongenlei
8c8fc03477 Merge branch 'develop' into feat_beam_search_v2 2021-08-17 19:47:12 +08:00
gongel
b280a02f67 refactor: use gather_nd and while_loop 2021-08-17 18:42:04 +08:00
tianxin
5c58459f2d Add Question matching baseline (#874)
* finish QM baseline

* update

* update

* update

* add README.md

* Update README.md

* implement rdrop as paddlenlp api

* add rdrop.py into paddlenlp.losses module

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-08-17 17:27:01 +08:00
smallv0221
7e098f160e Fix tokenizer bug (#893)
* fix unified transformer dtype problem

* fix win dtype bug

* Fix plato-2 and plato-mini dtype bug

* Fix plato-2 tokenization

* Refine some doc

* Add general k support for topk sampling

* fix seed

* minor fix

* Fix unitransformer readme

* topk kernel optimization

* add unimo model and fix generate api

* add 3 datasets for unimo-text

* fix tokenizer bug

Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
Co-authored-by: liu zhengxi <380185688@qq.com>
2021-08-17 14:47:30 +08:00
smallv0221
740f5e2397 Add unimo model and fix generate api (#891)
* fix unified transformer dtype problem

* fix win dtype bug

* Fix plato-2 and plato-mini dtype bug

* Fix plato-2 tokenization

* Refine some doc

* Add general k support for topk sampling

* fix seed

* minor fix

* Fix unitransformer readme

* topk kernel optimization

* add unimo model and fix generate api

* add 3 datasets for unimo-text

Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
Co-authored-by: liu zhengxi <380185688@qq.com>
2021-08-17 13:56:27 +08:00
liu zhengxi
4cdd4c0965 Add random seed fixing (#888) 2021-08-17 10:48:27 +08:00
liyueyang
8317ad3edd Delete the batchify_fn of cluewsc (#889)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-08-17 00:25:46 +08:00
Zhengyang Song
14efb919eb Fix two typos in text classification examples rnn (#887)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-08-16 00:04:46 +08:00
Zeyu Chen
1ae0164516 Rename ernie-doc folder 2021-08-15 21:47:00 +08:00
linjieccc
32ca82d9ba update evaluate mode 2021-08-15 10:07:59 +00:00
linjieccc
0e279262a9 update training example 2021-08-13 11:05:06 +00:00
yujun
15a074b0ea Fix tokenizer vocab replace bug (#878)
Fix #875
2021-08-13 12:01:35 +08:00
linjieccc
187ada8031 update readme 2021-08-13 03:59:34 +00:00
linjieccc
3d4d7bdbe9 update dir struct 2021-08-13 03:53:14 +00:00
linjieccc
c34f80c765 change some paddle api 2021-08-12 13:09:36 +00:00
gongenlei
7236fb65a7 Merge branch 'develop' into ft_decoder_op 2021-08-12 17:57:26 +08:00
gongel
916c3571b9 refactor: update decoder dependency 2021-08-12 09:56:05 +00:00
gongel
3f13e44d77 refactor: use static_cast 2021-08-12 08:55:18 +00:00
tianxin
d4cf11ab56 fix ernie_text_matching ci config (#877)
* fix ernie_text_matching ci config
2021-08-12 16:51:11 +08:00
Jack Zhou
303ef9c489 add random seed for ernie_ie tests (#876)
* add random seed for ernie_ie tests
2021-08-12 16:39:42 +08:00
gongel
bd5c275ee9 refactor: remove unuseful args and add todo 2021-08-12 16:27:12 +08:00
gongel
afcdb0bff5 refactor: replace n_layer with num_encoder_layers and num_decoder_layers 2021-08-12 15:04:23 +08:00
gongel
e598d2edbd refactor: generate src_word randomly 2021-08-12 11:04:02 +08:00
liu zhengxi
496c4cd05e Transformer full procedure ci/ce (#839) 2021-08-11 20:21:28 +08:00
linjieccc
466587c349 update readme 2021-08-11 10:31:46 +00:00
linjieccc
b63ca79c23 update directory and readme 2021-08-11 10:21:33 +00:00
gongel
169740ff62 feat: add decoder_sample 2021-08-11 18:07:39 +08:00
gongel
b2846c58d4 refactor: refactor code structure 2021-08-11 17:29:16 +08:00
linjieccc
589a0089f9 update readme 2021-08-11 09:24:04 +00:00
Linjie Chen
63570f3fa2 Merge branch 'PaddlePaddle:develop' into ddparser 2021-08-11 17:21:45 +08:00
Jack Zhou
0d9f1170c7 Add ernie doc (#613)
* add Ernie-Doc modeling, tokenizer

* add ernie-doc multihead attention

* add encoder

* add ErnieDocModel, ErnieDocForSequenceClassification, ErnieDocForTokenClassification, ErnieDocForQuestionAnswering

* add ErnieDocTokenizer, BPETokenizer

* add data preprocess

* fix embedding norm

* free the previous useless memory to save gpu memory

* add shuffle sample for ClassifierIterator

* add best model save

* upload ernie_doc base model

* add tokenizer save and from pretrained

* decrease memory cost

* remove cast dtype

* use try_import for nltk, regex

* add init README.md

* add different tokenizer for different tasks

* add iflytek classifier task

* add layerwise decay optimizer

* AdamLW->AdamWDL

* fix data iterator

* eval same samples

* add hyp dataset

* add hyp preprocessor

* temp

* fix the wrong acc calculation

* add ernie_doc metrics

* Revert "add hyp dataset"

This reverts commit c6c3353d18.

* Add hyp thunews (#712)

* add hyp dataset

* add thucnews

* add more comments

* fix some thucnews dataset label path

* add THUCNews, HYP dataset list

* remove LABELS member

Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>

* fix some print when evaling

* add init mrc script

* add chinese tokenize

* add MRCIterator

* add mrc loss

* add EM_AND_F1 for qa tasks

* add dropout argument for ernie-doc task

* optimize output of evaluation of mrc

* PreProcessor -> Preprocessor

* add model save for mrc

* fix mrc eval print

* add cls token index of sequence

* add c3 mrc dataset

* add MCQIterator

* add mcq task

* fix c3 bug

* fix MCQIterator

* add cail2019 scm dataset

* upgrade MCQIterator

* add semantic matching

* add simnet model based on ernie_doc

* change SemanticMatchingIterator

* fix semantic matching save model

* add label key for c3 dataset iterator

* Revert "add cail2019 scm dataset"

This reverts commit a7aefdc605.

* Revert "add c3 mrc dataset"

This reverts commit d240639801.

* Add C3, TriviaQa, CAIL2019-SCM dataset (#754)

* add c3 mrc dataset

* add triviaqa dataset

* add cail2019 scm dataset

* add dataset desc

* update accroding to advices

* add label key in c3 dataset

* add triviaqa task;fix mcq,cail task bug

* dev->eval

* fix mcq data iterator

* fix _get_samples for mcq

* fix c3 training

* ErnieDocSimNet->ErnieDocForTextMatching

* optimize data.py

* add sequence labeling for ernie doc

* remove useless comments

* add README.md for ernie_doc

* add contents for ernie doc readme.md

* fix readme.md

* add ERNIE-DOC BPEtokenizer

* remove save test model

* use paddle.metric.Accuracy instead of Acc

* fix README.md

* remove adamwdl to paddlenlp.ops.optimizer

* add __rel_shift comments

* optimize comments

* add comments for tokenizer

* add comments for ErnieDocModel, ErnieDocForSequenceClassification, ErnieDocForTokenClassification, ErnieDocForQuestionAnswering

* add ernie_doc api doc reference

* fix dtype of semantic matching

* reseet metric when finishing evaluation

* add adamwdl docs

* add adamwdl, ernie_doc navigation

* add more comments of admawdl

* fix reference of ernie-doc in pretraining model

* add adamwdl formula

* fix gather_idxs

Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2021-08-11 15:54:42 +08:00
gongel
57c8fc52b7 docs: update annotation 2021-08-11 14:25:34 +08:00
Linjie Chen
a92fea6906 Merge branch 'develop' into ddparser 2021-08-11 13:20:03 +08:00
linjieccc
468dfe0807 update readme 2021-08-11 05:17:27 +00:00
linjieccc
11726b1528 add comment for main step and update readme 2021-08-10 13:22:15 +00:00
linjieccc
fd8d470bfb update predict mode 2021-08-10 09:46:46 +00:00
gongel
fc980843b9 fix: use alive_seq when no eos 2021-08-10 17:03:24 +08:00
gongel
2a49254e89 fix: fix caches can't be modified inplace 2021-08-09 13:17:03 +00:00
wawltor
bc178ab7dc optimize the time cost for the wordtag (#863)
* optimize the time cost for the wordtag

* update the optimize code for the predictor
2021-08-09 17:00:14 +08:00
Steffy-zxf
73b4d38b0b fix docs info on dataset downloading (#864) 2021-08-09 16:59:22 +08:00
gongel
a5d431a7f3 docs: add yaml configuration file 2021-08-09 03:48:53 +00:00
gongenlei
00d02ac552 [Bugfix] Fix ci breaking for paddle2.1.2 (#861)
* bugfix: fix ci breaking for paddle2.1.2

* bugfix: fix ci breaking for paddle2.1.2
2021-08-09 03:08:03 +08:00
Zhong Hui
eee6be98db Add huggingface gpt converter. (#859)
* Add huggingface gpt converter.

* update some doc.

* refine

* refine
2021-08-06 23:30:06 +08:00
gongel
3393f57402 feat: add custom op for FT decoder 2021-08-06 09:02:29 +00:00
Guo Sheng
d3076d044a Use utf-8 to read in create_pretraining_data.py of BERT for Windows. (#857) 2021-08-06 16:49:32 +08:00
ceci3
bd727d0881 add depth export (#853) 2021-08-06 10:55:35 +08:00
Steffy-zxf
5e92215af7 fix windows locale bug (#856) 2021-08-06 10:54:16 +08:00
芳樽里的歌
091b815529 Update quick_start.rst (#852)
修复无效链接
2021-08-06 08:05:39 +08:00
linjieccc
854a5acf55 update file dir 2021-08-05 18:44:40 +08:00
Jack Zhou
ba1a4405d7 fix dtype, file read encoding (#851) 2021-08-04 22:03:22 +08:00
liu zhengxi
b96ff968c6 fix trans_param (#846) 2021-08-04 21:05:50 +08:00
linjieccc
cb79b122e7 Add dependency parser 2021-08-04 17:13:56 +08:00
yingyibiao
5f5d120d13 Edit community contribution docs (#844)
* edit community contribution docs

* edit community contribution docs

* edit community contribution docs

* edit community contribution docs

* edit community contribution docs
2021-08-04 17:07:56 +08:00
tianxin
36ce8865e8 Add deploy for Few-Shot EFL (#840)
* add FewCLUE 9 datasets

* fix a bug for tnews

* Add CI for Ernie text matching

* Add CI for Ernie text matching

* Add CI for Ernie text matching

* fix encoding problem for windows

* update ernie_text_matching ci

* add python_deploy for efl

* add python_deploy for efl

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-08-04 17:05:49 +08:00
tianxin
058139e432 Merge pull request #845 from leeyy2020/fix_pet_bug
Fix pet bug
2021-08-04 12:06:34 +08:00
liyueyang
9c4abf0140 fix some bug in pet 2021-08-04 03:52:26 +00:00
liyueyang
cbeca343bb Merge remote-tracking branch 'refs/remotes/origin/develop' into develop 2021-08-04 03:44:41 +00:00
liyueyang
6a40671e9e Merge branch 'develop' of github.com:leeyy2020/PaddleNLP into develop 2021-08-04 03:33:41 +00:00
Zhong Hui
02998ad546 Update GPT-3 Readme. (#843) 2021-08-04 10:21:38 +08:00
tianxin
62cea7d378 Add CI for ernie_text_matching (#842)
* add CI for ernie_text_matching
2021-08-04 10:10:05 +08:00
Zeyu Chen
2cd18f067d Update Fewshot README 2021-08-04 01:08:53 +08:00
Jack Zhou
58a2f63329 Upgrade ernie ie ci (#836)
* 1. add export model for ErnieForTokenClassification
2. add predict scripts (still not support gpu predict)

* remove dataloader

* update README.md for export model and deploy

* add test.sh; add parallel training

* add create_dataloader

* add autolog

* add device args

* paddle.save->save_pretrained

* upgrade ernie information extraction ci

Co-authored-by: Steffy-zxf <48793257+Steffy-zxf@users.noreply.github.com>
2021-08-03 20:37:22 +08:00
tianxin
6cf804e753 Add CI for ernie_text_matching (#833)
* update ernie_text_matching ci
2021-08-03 20:33:43 +08:00
gongel
1795f6895b fix: add more args 2021-08-03 15:31:58 +08:00
gongel
18b9ed6005 feat: add beam_search_v2 2021-08-03 14:45:13 +08:00
wawltor
b95903ea48 fix the electra oom in the process of training (#834) 2021-08-03 14:43:56 +08:00
wawltor
edceb138ab fix the bug in text2sql (#828) 2021-08-03 00:27:07 +08:00
yingyibiao
df763fa804 fix adamw init typo (#829) 2021-08-03 00:26:42 +08:00
yingyibiao
63683d83c8 Fix a bug when vocab_file is None (#830)
* fix a bug when vocab_file is None

* Prevent potential bug when resource_file is None
2021-08-02 23:06:28 +08:00
yujun
b9058c0ae8 add RoFormer Model (#804)
* add roformer

* fix error

* fix error

* refactor & add more weights

* add example & update url

* add new line

* pre commit

* suggestion from yingyibiao

* add example cail2019_scm

* update readme

* update readme

* update

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-08-02 17:14:17 +08:00
liu zhengxi
f9af064b4e Make FT selectable (#826)
* Make FT selectable

* update

* fix comments
2021-08-02 14:15:14 +08:00
Zhong Hui
84257cd69f GPT, spilt modeling to gpt-3 for training (#710)
* GPT. refine args print.
* GPT split to gpt-3.
2021-08-02 13:02:11 +08:00
yingyibiao
d66300bdaa [Ready for Review] optimize `from_pretrained` APIs for decoupling of weights and configs (#671)
* api

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update for model_utils
2021-08-02 12:56:24 +08:00
Steffy-zxf
ebc2b1b799 update ernie text cls ci (#823)
* add ernie text cls ci

* mv ernie_text_cls_params.txt to ernie_text_cls directory
2021-07-30 22:24:02 +08:00
yingyibiao
af6245932a delete legacy converter code (#821) 2021-07-30 16:42:27 +08:00
wawltor
6fbb9a010d fix the thread problem in taskflow (#817) 2021-07-30 14:03:34 +08:00
Jiaqi Liu
6b515fd572 update dataset tnews (#814) 2021-07-30 13:40:29 +08:00
tianxin
4baf346978 Merge pull request #802 from leeyy2020/PET
Add PET for few_shot
2021-07-30 12:35:49 +08:00
liyueyang
45506b47b2 Merge branch 'develop' into PET 2021-07-30 10:27:07 +08:00
wawltor
0bc5fd4c48 Merge pull request #818 from joey12300/fix_waybill_data_dir
fix waybill data_dir; remove data files
2021-07-29 21:19:25 +08:00
zhoushunjie
301ed98491 fix waybill data_dir; remove data dir 2021-07-29 16:42:41 +08:00
liu zhengxi
370adad388 Add unified transformer decoding beam search and sampling (#739)
* add unified transformer decoding beam search and sampling
2021-07-29 16:27:44 +08:00
liu zhengxi
f753bb1fba Update transformer ci/ce (#812)
* update ci/ce

* delete useless line
2021-07-29 15:04:31 +08:00
liyueyang
fa60078ac9 Merge branch 'develop' into PET 2021-07-29 13:55:57 +08:00
liyueyang
3ae883ccb0 fix some problem detected by CI 2021-07-29 02:47:25 +00:00
smallv0221
b6a7f8f03c topk kernel optimization (#811)
* topk kernel memory optimization

Co-authored-by: liu zhengxi <380185688@qq.com>
2021-07-29 10:33:09 +08:00
liyueyang
65dd4bdcee fixed some problem detected by CI 2021-07-28 12:16:20 +00:00
liyueyang
14292cc0ae fix problem 2021-07-28 09:39:44 +00:00
liyueyang
5ef0ca7d46 add PET to few shot 2021-07-28 09:13:45 +00:00
liyueyang
181a1e09c1 add PET 2021-07-27 14:30:15 +00:00
Zeyu Chen
79eaa2b2fd Update README.md 2021-07-27 21:55:13 +08:00
Zhong Hui
4e56ba5774 simplify requirements.txt (#808)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-07-27 21:52:53 +08:00
Jack Zhou
7a6ef1102c Add vdl dependency in word emb (#807) 2021-07-27 21:52:33 +08:00
wawltor
ac84075607 remove the pandas dependency in the taskflow (#803) 2021-07-27 21:36:31 +08:00
liyueyang
03f0f0299e add PET 2021-07-27 06:23:37 +00:00
smallv0221
5855111ae0 Add general k support for topk sampling (#792)
* fix unified transformer dtype problem

* fix win dtype bug

* Fix plato-2 and plato-mini dtype bug

* Fix plato-2 tokenization

* Refine some doc

* Add general k support for topk sampling

* fix seed

* minor fix

* Fix unitransformer readme

Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
Co-authored-by: liu zhengxi <380185688@qq.com>
2021-07-27 14:19:36 +08:00
liyueyang
14e2234264 Add PET 2021-07-27 06:15:23 +00:00
liu zhengxi
ac3a6165e5 Add ci/ce for transformer (#776)
* full link shell

* update log

* delete utils for python inference

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-07-26 20:23:04 +08:00
tianxin
fda3ff7fc1 add save_step for ernie_matching (#798)
* add FewCLUE 9 datasets

* fix a bug for tnews

* Add CI for Ernie text matching

* Add CI for Ernie text matching

* Add CI for Ernie text matching

* fix encoding problem for windows

* add save_step for ernie_matching
2021-07-26 20:22:35 +08:00
liu zhengxi
f1dc506044 Transformer force decoding support (#783)
* force decoding for transformer
2021-07-26 19:51:16 +08:00
Steffy-zxf
c44e359196 Update docs and readme (#797)
2. remove simnet test evaluation
2021-07-26 16:29:25 +08:00
Linjie Chen
f9023e5fd9 update text classification readme (#796)
* update text classification readme
2021-07-26 14:37:48 +08:00
tianxin
9d60da1eba Add CI for Ernie text matching (#781)
* add FewCLUE 9 datasets

* fix a bug for tnews

* Add CI for Ernie text matching

* Add CI for Ernie text matching

* Add CI for Ernie text matching

* fix encoding problem for windows

Co-authored-by: Steffy-zxf <48793257+Steffy-zxf@users.noreply.github.com>
2021-07-26 14:25:53 +08:00
Jack Zhou
28a95901ea Add ErnieForTokenClassification CI (#778)
* 1. add export model for ErnieForTokenClassification
2. add predict scripts (still not support gpu predict)

* remove dataloader

* update README.md for export model and deploy

* add test.sh; add parallel training

* add create_dataloader

* add autolog

* add device args

* paddle.save->save_pretrained
2021-07-26 12:06:19 +08:00
Linjie Chen
2c1b6bc172 [Ready for Review]Add multi-label text classification example (#788)
* add multi-label text classification example

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-07-26 12:03:56 +08:00
thomas-yanxin
b44fe5e828 Update README.md (#787) 2021-07-22 23:35:48 +08:00
gongel
1ddc5bbeeb [Feat] Add BART model (#663)
* feat: add BART model

* fix: fix BartForSequenceClassification with new sentence_representation

* feat: add pretrained models and vocab

* refactor: update copyright notice

* refactor: rename encoder_layers to num_encoder_layers

* feat: add cache for BartDecoder

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-07-21 14:12:58 +08:00
Steffy-zxf
fd740cb7a9 Add ci for ernie text cls (#750)
* add ernie text cls test script

* add test_ci for ernie_text_cls

* update params setting

* update ernie_cls ci

* update ernie cls docs

* mv run_ernie_cls.sh test_model.sh

* enable trt for test
2021-07-21 12:10:35 +08:00
wawltor
f4029e22ae fix the script of static to dygraph (#779) 2021-07-21 11:59:38 +08:00
Jack Zhou
39375fd44b Add C3, TriviaQa, CAIL2019-SCM dataset (#754)
* add c3 mrc dataset

* add triviaqa dataset

* add cail2019 scm dataset

* add dataset desc

* update accroding to advices

* add label key in c3 dataset
2021-07-21 11:17:29 +08:00
smallv0221
cbaafb9071 Refine some doc (#774)
* fix unified transformer dtype problem

* fix win dtype bug

* Fix plato-2 and plato-mini dtype bug

* Fix plato-2 tokenization

* Refine some doc

Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
2021-07-21 11:16:45 +08:00
gongel
39b7f9d0fd add max_iter to stop training for STACL (#769) 2021-07-19 21:08:50 +08:00
wawltor
7ed23aeeb7 Optimize wordtag doc (#771)
* support the wordtag doc for the paddlenlp

* update doc of wordtag
2021-07-19 21:08:18 +08:00
smallv0221
17502c1f9b Fix plato-2 tokenization (#770)
* fix unified transformer dtype problem

* fix win dtype bug

* Fix plato-2 and plato-mini dtype bug

* Fix plato-2 tokenization

Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
2021-07-19 19:47:42 +08:00
liyueyang
b86d5b7adc change varname,set default value for pool_act (#766) 2021-07-19 17:28:21 +08:00
smallv0221
243cdd7197 Fix plato-2 and plato-mini dtype bug (#767)
* fix unified transformer dtype problem

* fix win dtype bug

* Fix plato-2 and plato-mini dtype bug
2021-07-19 16:47:34 +08:00
liyueyang
0e7fe59296 change varname,set default value for pool_act 2021-07-19 05:53:48 +00:00
wawltor
147a943383 add the download check for the taskflow (#758)
* add the download check for tht taskflow

* update the taskflow download message

* update the user generate for the paddlenlp
2021-07-18 19:12:53 +08:00
liu zhengxi
edde6aab2a Static transformer support custom dataset (#757)
* fix static

* update

Co-authored-by: Guo Sheng <whucsgs@163.com>
2021-07-16 11:21:37 +08:00
liu zhengxi
cc7869ef81 Fix decoding sample (#752)
* fix dcoding sample

* fix
2021-07-16 10:35:53 +08:00
wawltor
29d56ee3e4 update the wordtag doc (#753) 2021-07-15 14:26:57 +08:00
wawltor
6552a58021 fix the example doc for the taskflow (#748) 2021-07-14 17:25:05 +08:00
Jack Zhou
5afc790de2 remove squeeze to avoid changing 1D-tensor to scalar (#749) 2021-07-14 17:24:43 +08:00
jm12138
fe42fea63f Del self in GenerationMixin. (#746)
Del self in GenerationMixin.
2021-07-14 15:29:47 +08:00
smallv0221
3dd0bd4a64 fix unified transformer dtype problem (#747)
* fix unified transformer dtype problem

* fix win dtype bug
2021-07-14 15:18:00 +08:00
wawltor
f61a2940ae update the some functions for the taskflow (#726)
* update the function for the taskflow

* update the examples for the taskflow

* update the Text2Knowledge to WordTag

* fix the usage in taskflow

* update the usage for the taskflow
2021-07-13 22:58:04 +08:00
Steffy-zxf
7a53214f94 add ernie text cls test script (#733) 2021-07-13 19:40:29 +08:00
tianxin
3fdb1fde1a Fix tiny bug (#740)
* add FewCLUE 9 datasets

* fix a bug for tnews
2021-07-13 19:40:05 +08:00
liyueyang
a96c61f77d Add SimBERT for text matching (#706)
* add SimBERT

* add with_pool for BertModel

* add SimBERT

* add SimBERT

* add SimBERT

* add SimBERT

* add SimBERT

* add SimBERT

* fix some problem in README.md

* fix the description of simbert

* fix the description of simbert

* fix the description of simbert

* fix the description of simbert

* fix the description of simbert
2021-07-13 19:38:57 +08:00
liu zhengxi
c59e49623f Add transformer decoder for unified transformer (#637)
* add transformer decoder
2021-07-12 17:11:51 +08:00
pigzhang
9eb9e23b01 Update day03.md (#730)
111行if语句写错了
2021-07-12 14:05:32 +08:00
wawltor
fe021a9878 Update issue templates 2021-07-12 11:26:32 +08:00
wawltor
79a3ff410a Update issue templates 2021-07-12 11:22:17 +08:00
wawltor
8dbdd55221 Update issue templates 2021-07-12 11:21:05 +08:00
wawltor
4c1b86fbeb Update issue templates 2021-07-12 11:16:44 +08:00
wawltor
280bf30d63 Update issue templates 2021-07-12 11:12:40 +08:00
wawltor
a3a1edf097 Update issue templates 2021-07-12 11:11:50 +08:00
wawltor
8ebbe6e52e Merge pull request #727 from wawltor/fix_taskflow_model
add the taskflow model.py
2021-07-11 16:00:17 +08:00
wawltor
eebcd42c15 add the taskflow model.py 2021-07-11 15:57:45 +08:00
liu zhengxi
39d6cf6649 Add custom dataset ability for transformer (#711)
* add custom dataset ability for transformer

* update

* list support

* help update

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-07-10 18:19:03 +08:00
yingyibiao
95bb34ce9c Add model contribution mechanism (#607)
* adds model contribution mechanism

* modify importing_awesome_pretrained_models doc

* pr required fils

* update
2021-07-09 20:25:49 +08:00
wawltor
034e728e01 Add the models api for the first version (#686)
* add the models api for the first version

* optimize the models api

* Add the downloader for the taskflow

* optimize the taskflow api
2021-07-09 19:59:01 +08:00
liu zhengxi
7f694d2956 enhance transformer apis (#708) 2021-07-09 19:10:11 +08:00
wawltor
ef86475e11 add the string ops for the fast tokenizer (#718) 2021-07-09 17:36:00 +08:00
Jiaqi Liu
f6047d2b91 fix vae readme (#720) 2021-07-09 17:34:54 +08:00
smallv0221
a1b7bf6f31 fix unified transformer dtype problem (#721) 2021-07-09 16:56:52 +08:00
Jack Zhou
97d5a5bb02 Add hyp thunews (#712)
* add hyp dataset

* add thucnews

* add more comments

* fix some thucnews dataset label path

* add THUCNews, HYP dataset list

* remove LABELS member

Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2021-07-09 11:35:42 +08:00
Jiaqi Liu
21b0cf4fd7 update tinybert png (#714) 2021-07-08 16:10:04 +08:00
Zhong Hui
7c76b2f611 GPT. refine args print. (#701) 2021-07-07 11:17:05 +08:00
Linjie Chen
7be95b5840 Merge pull request #674 from linjieccc/textcnn
[TextCNN] Add TextCNN example for sentiment analysis
2021-07-07 01:07:55 +08:00
Linjie Chen
e50ae68dd0 Merge branch 'develop' into textcnn 2021-07-07 00:28:46 +08:00
Zhong Hui
58db4d0547 GPT. use ClipGradByGlobalNorm, update unittest (#693) 2021-07-06 19:40:37 +08:00
smallv0221
8865c32103 fix plato2 readme (#694)
* remove dead code

* Add finetuned ernie model

* fix nameing

* fix plato2 readme
2021-07-06 13:22:33 +08:00
linjieccc
014f507c3e delete char lower process for device choice 2021-07-06 03:00:07 +00:00
linjieccc
70161cda3b fix README 2021-07-05 03:28:57 +00:00
linjieccc
7e60629a7d fix comments 2021-07-05 03:21:46 +00:00
linjieccc
1fac669b73 change data load mode and add data process file 2021-07-04 10:21:02 +00:00
Linjie Chen
969eb551eb Merge branch 'PaddlePaddle:develop' into textcnn 2021-07-04 18:17:16 +08:00
liu zhengxi
0b4cc4c073 make cmake friendly to user (#668) 2021-07-03 11:52:05 +08:00
Steffy-zxf
b17a3bd487 drop the test evaluation to adapt to the qianyan-lcqmc dataset (#684) 2021-07-03 11:46:57 +08:00
wawltor
0177aa5d32 Merge pull request #681 from wawltor/fix_chnsenticorp
fix the link of ChnSentiCorp in the skep task
2021-07-02 17:00:48 +08:00
wawltor
017058999c fix the link of ChnSentiCorp in the skep task 2021-07-02 15:19:00 +08:00
Linjie Chen
9b7749615a Merge branch 'develop' into textcnn 2021-07-02 11:36:12 +08:00
Zhong Hui
a489bd8b25 bug fix on windows, default convert to int64. (#676) 2021-07-01 19:03:23 +08:00
linjieccc
6ee55b7e14 Add TextCNN for sentiment analysis 2021-07-01 06:41:35 +00:00
wawltor
73cc8f8610 change the position encoding in the ernie-ctm (#656)
* change the position encoding in the ernie-ctm

* change the summary_sum to cls_num
2021-07-01 10:55:57 +08:00
Zhong Hui
aa596fbc71 [GPT] Add MP enhancement and accuracy check scripts. (#624)
* gpt2 parallel emb

* parallel matmul

* split multi head attention

* split attention head

* split cross entropy

* fuse qkv

* update column row parallel linear

* GPT. add unittest.

Co-authored-by: WangXi <wangxi16@baidu.com>
2021-06-30 19:49:55 +08:00
ceci3
de616d0ae5 fix dataset is stsb (#666) 2021-06-29 18:04:51 +08:00
Zeyu Chen
ccd3557f57 Simplify transformer.rst code block 2021-06-28 15:32:27 +08:00
Zeyu Chen
af678fb431 Update README_en.md 2021-06-28 15:31:40 +08:00
Zeyu Chen
6584746d43 Fix README typo 2021-06-28 15:31:10 +08:00
liu zhengxi
e9b3ac67c0 Fix cuda memory leak (#655)
* fix mem leak
2021-06-28 15:14:06 +08:00
Guo Sheng
5a4f57c0ca Fix PretrainedTokenizer saving. (#648) 2021-06-27 11:59:16 +08:00
yafengguo
3038913d51 Create README.md for examples (#645)
example目录下包含了很多有价值的模型和例子,因为内容比较多,能否增加一个readme,帮助用户快速定位?(特别是考虑到找到这个区域的一般是新手用户,有个readme会更醒目)

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-26 17:11:41 +08:00
Jack Zhou
509494e7a7 make imdb dataset return raw data (#646) 2021-06-26 17:08:48 +08:00
Guo Sheng
cd1e30bfde Refine Vocab.to_indice (#641) 2021-06-25 22:15:00 +08:00
BFJL
f142f065a0 Change the _idx_to_token list to a dictionary (#617)
Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
Co-authored-by: Guo Sheng <whucsgs@163.com>
2021-06-25 21:44:45 +08:00
yingyibiao
65db861982 batch bug fix of decoder_weight shape in transformers' model (#608)
* fix a bug of weight shape in bert model

* batch bug fix of decoder_weight shape
2021-06-25 19:46:54 +08:00
smallv0221
aa70c63f70 Add finetuned ernie model (#639)
* remove dead code

* Add finetuned ernie model

* fix nameing
2021-06-25 19:44:25 +08:00
jiaqianjing
9a45f83988 Add COTE-BD & COTE-MFW Dataset (#593)
* Add COTE-BD Dataset #447

* Update cote.py

Add COTE-MFW Dataset #447

* Update cote.py

add annotation of COTE-MFW

* update

* update
2021-06-25 17:17:59 +08:00
Steffy-zxf
a145bca448 fix ernie api docstring (#630) 2021-06-25 11:53:31 +08:00
liu zhengxi
5944cc9b6d Re-organize patches (#621)
* re-organize ops patches
2021-06-25 10:59:30 +08:00
chenxiaozeng
d336030dea Update day12 title (#626)
* fix a readme bug

* update education doc

* update day12 homework

* update title
2021-06-24 19:22:33 +08:00
chenxiaozeng
459d269693 Update day12 homework (#623)
* fix a readme bug

* update education doc

* update day12 homework
2021-06-24 18:01:46 +08:00
Steffy-zxf
c9854327fe Add text classification serving example (#499)
* add serving scripts

* add serving deploy scripts

* rm deploy/serving/README.md

* update docs

* update docs

* update serving usage docs
2021-06-24 16:26:15 +08:00
Jiaqi Liu
53f181d87a add distill example in tutorial, and update augmentation condition (#619) 2021-06-24 16:21:01 +08:00
smallv0221
ee346c3a86 Remove useless code (#618) 2021-06-24 15:49:05 +08:00
chenxiaozeng
00eed30a98 Update education doc (#615)
* fix a readme bug

* update education doc
2021-06-24 15:32:43 +08:00
Zeyu Chen
b7bbdb4cd1 Update README_en.md 2021-06-23 22:39:30 +08:00
Jiaqi Liu
e72b457c70 update course link (#609) 2021-06-23 21:19:03 +08:00
Ming-Xu Huang
bf28087164 Added an example to apply ASP on existed BERT training scripts (#579)
* Added an example to apply ASP on existed BERT training scripts

* Make set_excluded_layers to meaningful

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-22 22:42:29 +08:00
Jiaqi Liu
1757a4fc2a fix distill readme, and upadate aistudio link of day12 course in tutorial (#605) 2021-06-22 15:25:52 +08:00
tianxin
2e9de5252b add MacBERT (#601)
Co-authored-by: yingyibiao <yyb0576@163.com>
2021-06-22 10:55:57 +08:00
Aurelius84
bd2554e72b add @to_static for benchmark (#600) 2021-06-21 17:44:09 +08:00
gongel
0dc095b4c4 docs: update homework (#598) 2021-06-21 17:42:46 +08:00
jiaqianjing
7048bf9dd8 Add SE-ABSA16_CAME Dataset #447 (#592)
Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2021-06-21 16:12:48 +08:00
Steffy-zxf
23fdb24c9a fix seq2vec docs (#595)
Co-authored-by: yingyibiao <yyb0576@163.com>
2021-06-21 15:59:23 +08:00
gongel
b932827624 [Docs] Add homework for live course (#594)
* docs: add homework for live course

* docs: add notes

* docs: add notes

* docs: add notes
2021-06-21 11:25:08 +08:00
Jiaqi Liu
c8b05f0a6a Simplify distill lstm code (#574)
* simplify code

* update README

* improve the interpretability of variables

* English data augmentation performance optimization.

* delete useless comments
2021-06-21 10:08:29 +08:00
gongel
9daabcfadd [Bugfix] Make layout fit Windows OS (#590)
* fix: make layout fit Windows OS

* fix: make layout(Label) fit Windows OS
2021-06-20 11:16:32 +08:00
Zhong Hui
46538346fc [GPT]. Optimize the speed of static graph, fix num_heads, add gpt2-small-en for CE. (#588) 2021-06-18 16:39:48 +08:00
smallv0221
82fb22a730 remove old DuReader example (#586)
* Fix dataset doc

* fix dataset doc

* Change load_dataset design for loading local dataset

* Update softmax_with_cross_entropy to cross_entropy

* Fix community provided datasets and fix cross_entropy for elmo and dgu

* Add course homework answer

* remove old DuReader example
2021-06-18 11:23:19 +08:00
gongel
112390592c docs: add docs for asr application (#582)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-17 23:36:45 +08:00
tianxin
96dc76f648 update to cross_entropy api (#584)
* Rename strategy according to the paper

* change softmax_with_cross_entropy to cross_entropy

Co-authored-by: Jiaqi Liu <liujiaqi06@baidu.com>
2021-06-17 23:34:37 +08:00
smallv0221
995ebc1589 Add course homework answer (#583)
* Fix dataset doc

* fix dataset doc

* Change load_dataset design for loading local dataset

* Update softmax_with_cross_entropy to cross_entropy

* Fix community provided datasets and fix cross_entropy for elmo and dgu

* Add course homework answer
2021-06-17 17:29:46 +08:00
gongel
6f556fe971 fix: softmax_with_cross_entropy --> cross_entropy (#580) 2021-06-17 15:51:37 +08:00
Jiaqi Liu
56fc422e4b Add day12 homework tutorial (#581)
* add day12 homework tutorial

* transform to relative path
2021-06-17 15:51:12 +08:00
tianxin
ac9dbeb544 EFL: Fix save_steps not work bug (#577)
* "add mlm params to dygraph ernie1.0"

* finish p-tuning v1.0

* mend

* delete unused coment

* add label_normalized

* P-tuning: support Chid task of FewCLUE

* 1. decouple evaluate and train

* 1.add FewCLUE datasets(9/9)
2.implement p-tuning strategy by transform_function
3.unify train_script beteween `chid` task and other 8 tasks of FewCLUE

* add README.md

* update FewCLUE data

* add predict.py for FewCLUE

* update README

* update README.md

* add FewCLUE 9 datasets

* update dataset Name

* Tiny fix

* finish EFL for iflytek task

* finish EFL for FewCLUE 9 tasks

* add EFL README.md

* fix save_steps have no effect bug
2021-06-17 12:26:08 +08:00
Jiaqi Liu
9c81a4adf5 Update ofa example Multi cards startup method (#515)
* add device argument and gpu launch method

* update reamde

* fix readme, and remove args.n_gpu

* fix ofa depth multi gpus bug

* add choice to device arg

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-17 12:00:15 +08:00
smallv0221
062e41e62c Fix community provided datasets and fix cross_entropy for elmo and dgu (#576)
* Fix dataset doc

* fix dataset doc

* Change load_dataset design for loading local dataset

* Update softmax_with_cross_entropy to cross_entropy

* Fix community provided datasets and fix cross_entropy for elmo and dgu
2021-06-17 11:56:56 +08:00
frozenfish123
6b1fa66582 modified bq_corpus.py (#562)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
Co-authored-by: smallv0221 <33639025+smallv0221@users.noreply.github.com>
2021-06-17 10:50:16 +08:00
liu zhengxi
480a33d368 [Faster Transformer] Refine transformer cpp inference demo (#575)
* refine faster transformer transformer demo

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-17 09:01:16 +08:00
wawltor
57ce415553 add the time cost counter for the bert (#544)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-17 08:21:04 +08:00
Zhong Hui
840149dfce using new api cross_entropy. (#573) 2021-06-16 21:21:02 +08:00
Jiaqi Liu
fa1e0ba115 update example cross entropy API usage (#572) 2021-06-16 20:48:07 +08:00
smallv0221
332112a6b6 Change load_dataset design for loading local datasets (#565)
* Fix dataset doc

* fix dataset doc

* Change load_dataset design for loading local dataset

* Update softmax_with_cross_entropy to cross_entropy
2021-06-16 13:49:30 +08:00
liu zhengxi
17fe183370 Fix vocab to_token (#570)
* fix

* fix
2021-06-16 13:30:49 +08:00
chenxiaozeng
5be07e4a5a fix a readme bug (#567) 2021-06-15 18:21:27 +08:00
Steffy-zxf
29cd0360cc update skep docs (#566)
* update skep docs
2021-06-15 18:02:11 +08:00
Jack Zhou
108a266b45 add encoding in duee, duie (#564) 2021-06-15 10:43:56 +08:00
liu zhengxi
6305721c2e [Faster Transformer] Collect faster transformer codes (#528)
* collect faster transformer codes

* update from c++ 11 to 14
2021-06-15 09:39:24 +08:00
King
dc8c8f27f1 Add PAWS-X Dataset (#559)
* #530 add parameter verification

* skip illegal lines in dataset likes paws-x-zh

* Add PAWS-X Dataset #447

* Add PAWS-X Dataset #447

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-13 13:44:25 +08:00
ceci3
0c8afd0953 Fix OFA distributed launch bug (#550)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-12 16:05:24 +08:00
King
1f86e82003 optimization for read_func of lcqmc (#553)
* #530 add parameter verification

* skip illegal lines in dataset likes paws-x-zh

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-12 14:33:29 +08:00
yingyibiao
97086d8b8f modify docstrings for tokenizer_utils (#558)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-11 18:57:25 +08:00
yingyibiao
70e3ef5a42 fix model_utils docstrings (#557)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-11 17:34:31 +08:00
tianxin
29a8147186 Tiny fix of README (#548)
* add ernie_matching point-wise & pair-wise

* Rename some Class

* fix some typo

* add FewCLUE 9 datasets

* 1. Using ernie-gram to train ernie_matching point-wise & pair-wise
2. update README.md

* Tiny fix

* Tiny fix of README.md

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-06-11 16:43:23 +08:00
liu zhengxi
9dde7ce097 fix doc (#556) 2021-06-11 16:32:31 +08:00
smallv0221
d72c46af0a Fix dataset doc (#555)
* Fix dataset doc

* fix dataset doc
2021-06-11 16:17:57 +08:00
Zhong Hui
fc3cf74a23 [GPT] small bug fix. (#545)
* GPT: dataset don't use topo.
2021-06-11 14:14:47 +08:00
kinghuin
e7dd95c3bb Add day03.md (#552)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-11 13:18:44 +08:00
liu zhengxi
8252281768 Class Vocab to_token supports numpy ndarray (#549)
* vocab to_token supports numpy ndarray
2021-06-11 12:29:58 +08:00
gongel
d28587dc78 Add speech STACL demo (#542)
* feat: add speech STACL demo

* docs: update README.md

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-10 22:17:26 +08:00
kinghuin
cbcb958eb5 Optimize RAT-SQL code (#543)
* fix IGSQL and ernie_gen bug

* optimize examples code
2021-06-10 16:49:53 +08:00
yingyibiao
1a158b3528 Update README.md (#541)
fix a deadlink
2021-06-10 15:37:37 +08:00
smallv0221
cd2bf8377a Fix dataset doc (#540) 2021-06-10 15:05:37 +08:00
yingyibiao
14c3209118 fix deadlinks (#539) 2021-06-10 12:36:57 +08:00
Zeyu Chen
187ab2af53 Add change log (#538)
* update readme for live class

* Update README

* update readme

* update readme

* add changelog
2021-06-10 11:47:04 +08:00
smallv0221
0a2f592e7c Merge pull request #510 from smallv0221/yxp0602
Add default attention to gpt and generate example
2021-06-10 10:56:05 +08:00
smallv0221
3d4f4e696c Merge branch 'develop' into yxp0602 2021-06-10 10:55:45 +08:00
tianxin
b2e2c02293 add elf readme (#536)
* "add mlm params to dygraph ernie1.0"

* finish p-tuning v1.0

* mend

* delete unused coment

* add label_normalized

* P-tuning: support Chid task of FewCLUE

* 1. decouple evaluate and train

* 1.add FewCLUE datasets(9/9)
2.implement p-tuning strategy by transform_function
3.unify train_script beteween `chid` task and other 8 tasks of FewCLUE

* add README.md

* update FewCLUE data

* add predict.py for FewCLUE

* update README

* update README.md

* add FewCLUE 9 datasets

* update dataset Name

* Tiny fix

* finish EFL for iflytek task

* finish EFL for FewCLUE 9 tasks

* add EFL README.md
2021-06-10 00:23:45 +08:00
smallv0221
f48d158101 Merge branch 'develop' into yxp0602 2021-06-09 20:51:21 +08:00
tianxin
e23850a40e Text matching (#535)
* add ernie_matching point-wise & pair-wise

* Rename some Class

* fix some typo

* add FewCLUE 9 datasets

* 1. Using ernie-gram to train ernie_matching point-wise & pair-wise
2. update README.md

* Tiny fix
2021-06-09 20:15:24 +08:00
smallv0221
ede1cf7766 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into yxp0602 2021-06-09 12:14:17 +00:00
smallv0221
388ee08e48 fix typo 2021-06-09 12:13:22 +00:00
King
0f57261e85 Add parameter verification for dataset (#531)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-09 18:55:52 +08:00
smallv0221
da1bc6e6ef Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into yxp0602 2021-06-09 10:45:47 +00:00
smallv0221
1eacd0a909 change causal mask to -INF 2021-06-09 10:45:07 +00:00
yingyibiao
9b1bdc5c2c fix a tiny bug in XLNetTokenizer (#533) 2021-06-09 18:00:14 +08:00
liu zhengxi
16a525f3d5 Fix Transformer on 32 bit machine (#532)
* fix dtype

* fix windows
2021-06-09 17:11:12 +08:00
yingyibiao
ab9b092dd0 fix albert pretrained model bos url (#529) 2021-06-09 14:54:45 +08:00
smallv0221
d10e4798d2 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into yxp0602 2021-06-09 05:51:20 +00:00
smallv0221
d2697cfee6 change eod to eos 2021-06-09 05:50:35 +00:00
Guo Sheng
311bbfb763 Fix output_handle usage in prediction. (#522) 2021-06-08 22:52:17 +08:00
wawltor
c91641237e fix the windows predict error in glue task
fix the windows predict error in glue task
2021-06-08 21:48:01 +08:00
wawltor
55931f5658 fix the windows predict error in glue task 2021-06-08 21:42:32 +08:00
yingyibiao
0d428ec5ad refine docstrings of model_utils.py (#524)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-08 21:12:40 +08:00
Zeyu Chen
f883e6124b Update docs and readme (#523)
* update readme for live class

* Update README

* update readme

* update readme

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-06-08 20:10:13 +08:00
smallv0221
63063c1d86 add eos bos eol token id to model config 2021-06-08 10:25:07 +00:00
smallv0221
a312e76f36 Merge pull request #518 from fiyen/develop
NLPCC14SC dataset support, bugs fixed.
2021-06-08 17:13:04 +08:00
smallv0221
f7185daf18 Merge branch 'develop' into develop 2021-06-08 17:11:30 +08:00
smallv0221
4213d5400c change causal mask position 2021-06-08 07:35:53 +00:00
Jack Zhou
2079a10adb merge embedding doc (#517)
* merge embedding doc

* modify embedding api link

* fix link

* rename day02->day01

* add directory

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-06-08 15:14:36 +08:00
WinSun
703a35edb4 Update nlpcc14_sc.py
remove some errors in descriptions
2021-06-08 14:42:18 +08:00
WinSun
e6929dd631 Add files via upload
change the name to camel form; add the description of the data.
2021-06-08 14:40:34 +08:00
Zeyu Chen
4a190a7aa4 Update readme (#516)
* update readme for live class

* Update README
2021-06-08 14:22:04 +08:00
kinghuin
9aed17223a fix IGSQL and ernie_gen bug (#512)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-08 11:39:56 +08:00
Jack Zhou
0ca46b4e97 embedding homework day02->day01 (#514)
* add embedding homework

* day02->day01

Co-authored-by: chenxiaozeng <hebiancaozhu@126.com>
2021-06-08 10:44:00 +08:00
WinSun
7fbd5159e4 Add NLPCC14-SC Dataset (#500)
* Add files via upload

上传了NLPCC14-SC数据集的文件

* Update __init__.py

增加了对NLPCC14-SC的支持
2021-06-07 22:03:32 +08:00
tianxin
62ab0ee50e Add EFL strategy for few-shot learning (#506)
* "add mlm params to dygraph ernie1.0"

* finish p-tuning v1.0

* mend

* delete unused coment

* add label_normalized

* P-tuning: support Chid task of FewCLUE

* 1. decouple evaluate and train

* 1.add FewCLUE datasets(9/9)
2.implement p-tuning strategy by transform_function
3.unify train_script beteween `chid` task and other 8 tasks of FewCLUE

* add README.md

* update FewCLUE data

* add predict.py for FewCLUE

* update README

* update README.md

* add FewCLUE 9 datasets

* update dataset Name

* Tiny fix

* finish EFL for iflytek task

* finish EFL for FewCLUE 9 tasks
2021-06-07 22:02:39 +08:00
Jack Zhou
eea6c543b6 Add embedding homework (#507)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-07 21:48:51 +08:00
Guo Sheng
b9e71da705 Add images for education. (#511) 2021-06-07 21:47:13 +08:00
smallv0221
2419e2538a Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into yxp0602 2021-06-07 13:34:23 +00:00
smallv0221
69237759a7 add default attention to gpt and generate example 2021-06-07 13:28:22 +00:00
Zhong Hui
500c8a2926 Small bug fix for GPT (#509) 2021-06-07 21:06:59 +08:00
Zeyu Chen
08e11fb10e update readme for live class (#508) 2021-06-07 20:32:39 +08:00
chenxiaozeng
35a5d15b22 fix link show bug and add course notice (#505)
* fix link show bug

* Update README.md

update img urls

* Delete education/img directory

delete img dir

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-06-07 18:04:00 +08:00
yingyibiao
6198f53146 Add embeddings.md to readthedocs (#503)
* add embeddings.md to readthedocs

* Update README.md
2021-06-07 15:52:18 +08:00
Zeyu Chen
40d2597213 update english readme (#504) 2021-06-07 15:36:55 +08:00
Jiaqi Liu
c5fa3bcf19 fix max_steps invalid bug (#501) 2021-06-07 15:06:08 +08:00
yingyibiao
ca5a3da884 modify readthedocs framework (#502) 2021-06-07 14:58:52 +08:00
Zeyu Chen
32bec79cfa Update README 2021-06-06 13:16:52 +08:00
Zeyu Chen
8f02b4739d Update Readme for introduction and feature 2021-06-06 13:01:16 +08:00
Zeyu Chen
ed467517b4 update README 2021-06-06 12:34:47 +08:00
Zeyu Chen
07e7a6a2dc update english readme 2021-06-06 00:53:03 +08:00
yingyibiao
3b02983cc3 Update transformers.rst (#496)
* modify transformers.rst

* modify transformers.rst

* modify transformers.rst

* modify transformers.rst

* modify transformers.rst

* modify transformers.rst

* modify transformers.rst

* modify transformers.rst

* modify transformers.rst
2021-06-05 23:15:40 +08:00
WinSun
2df16859e7 Update __init__.py
增加了对NLPCC14-SC的支持
2021-06-05 18:01:45 +08:00
WinSun
8c3ea28816 Add files via upload
上传了NLPCC14-SC数据集的文件
2021-06-05 18:00:48 +08:00
yingyibiao
091ce4eb5a fix deadlinks (#497) 2021-06-05 16:43:58 +08:00
tianxin
3a6610e13b Using ERNIE-Gram to implement ernie_matching (#498)
* add ernie_matching point-wise & pair-wise

* Rename some Class

* fix some typo

* add FewCLUE 9 datasets

* 1. Using ernie-gram to train ernie_matching point-wise & pair-wise
2. update README.md
2021-06-05 16:43:07 +08:00
Zeyu Chen
cba1e7fb51 Update README 2021-06-05 02:32:41 +08:00
kinghuin
ed9be049c1 Add IGSQL model (#476)
* begin adding

* finish code del

* finish igsql

* modify igsql readme

* modify igsql code

* modify igsql readme and bert api
2021-06-04 22:03:41 +08:00
Zeyu Chen
3fa457c63d update readthedocs index 2021-06-04 21:52:04 +08:00
yingyibiao
befdca5ae2 Update transformers.rst (#493)
* modify transformers.rst

* modify transformers.rst

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-04 21:46:18 +08:00
chenxiaozeng
0dc31b60e7 add course tutorial (#494) 2021-06-04 21:36:09 +08:00
Jiaqi Liu
60dba8ce43 Add perplexity metric doc (#492) 2021-06-04 16:08:32 +08:00
yingyibiao
f50b3ca5d3 Fix deadlines (#491)
* fix deadlinks

* fix deadlinks
2021-06-04 15:52:37 +08:00
Zeyu Chen
9f9f0b1adc Update README 2021-06-04 13:44:48 +08:00
yingyibiao
f5449dc9ed Delete transformers.md (#490)
delete transformers.md
2021-06-04 13:21:31 +08:00
yingyibiao
7026953c48 modify transformers.md (#478)
* modify transformers.md

* modify README.md

* unify transformers overview doc

* unify transformers overview doc

* unify transformers overview doc

* unify transformers overview doc

* unify transformers overview doc

* unify transformers overview doc
2021-06-04 12:45:14 +08:00
Jack Zhou
8ca071983b fix embedding deadlink (#488) 2021-06-04 12:02:37 +08:00
Zhong Hui
decf736505 Fix GPT modle error link. (#487) 2021-06-04 12:02:10 +08:00
smallv0221
a0c0aba252 fix squad example (#489)
* update chnsenticorp and lcqmc to qianyan format

* update md5 check

* minor fix
2021-06-04 11:51:07 +08:00
smallv0221
c190dad38c Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into yxp0602 2021-06-04 03:43:47 +00:00
smallv0221
5678c61cfe minor fix 2021-06-04 03:42:59 +00:00
Jack Zhou
d777dbba4f fix einsum squeeze (#486) 2021-06-04 11:21:23 +08:00
Jiaqi Liu
ff17c362c0 Remove F.softmax_with_cross_entropy in paddlenlp (#484)
* upgrade F.cross_entropy usage

* fix sample code bug

* fix ppl shape error
2021-06-04 10:58:11 +08:00
Steffy-zxf
bac370b54b Update chnsenticorp examples for qianyan dataset modification(#485) 2021-06-03 21:38:24 +08:00
smallv0221
07d414a41d update chnsenticorp and lcqmc to qianyan format (#482)
* update chnsenticorp and lcqmc to qianyan format

* update md5 check
2021-06-03 19:07:01 +08:00
smallv0221
60b45271d4 update md5 check 2021-06-03 08:38:53 +00:00
smallv0221
e41b9023f7 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into yxp0602 2021-06-03 08:21:41 +00:00
smallv0221
000762fd34 update chnsenticorp and lcqmc to qianyan format 2021-06-03 08:19:38 +00:00
Jack Zhou
3ce34a1504 fix dtype bug in windows (#481) 2021-06-03 15:24:55 +08:00
Jack Zhou
4ede05ae27 fix crf inference bug and lac doc (#480) 2021-06-03 15:07:56 +08:00
kinghuin
4167404b52 Rename SQLParser to RAT-SQL (#479)
* rename SQLParser to EnRATSQL

* rename EnRATSQL to RAT-SQL
2021-06-03 13:20:12 +08:00
Jiaqi Liu
ca145bbb82 Add tiny bert model (#313)
* add tinybert model

* add distilbert model

* add tinybert model

* update tinybert's forward

* update tokenizer path

* add small model in transformers.md

* add task_distill and data augmentation

* simplify the task distill, and update distillation result

* update readme and copyright

* remove distillation from pretrainingmodel, update readme

* fix distillation program error, modify tinybert modeling

* update experiment result

* move distiller out of tinybert modeling

* remove import from transformer init, and update distillation result

* rename distiller-> distill_utils
2021-06-03 13:18:05 +08:00
liu zhengxi
3b0a95d46f add data copy (#475)
[FasterTransformer] Add data copy to implement ChooseKernel and DataTransform in Paddle
2021-06-03 11:17:29 +08:00
tianxin
62b460c3f0 Fix print format of fewshot (#474)
* "add mlm params to dygraph ernie1.0"

* finish p-tuning v1.0

* mend

* delete unused coment

* add label_normalized

* P-tuning: support Chid task of FewCLUE

* 1. decouple evaluate and train

* 1.add FewCLUE datasets(9/9)
2.implement p-tuning strategy by transform_function
3.unify train_script beteween `chid` task and other 8 tasks of FewCLUE

* add README.md

* update FewCLUE data

* add predict.py for FewCLUE

* update README

* update README.md

* add FewCLUE 9 datasets

* update dataset Name

* Tiny fix
2021-06-02 17:49:39 +08:00
smallv0221
37d96f8c4f Add ernie_gram for QA and updata examples (#472)
* Add ernie_gram for QA and updata example
2021-06-02 16:16:51 +08:00
Steffy-zxf
ec400d87fe Add ernie gram (#469)
* add ernie-gram chinese model
2021-06-02 11:12:37 +08:00
tianxin
e2cf9a9cb4 Fix dataset name of fewshot (#466)
* "add mlm params to dygraph ernie1.0"

* finish p-tuning v1.0

* mend

* delete unused coment

* add label_normalized

* P-tuning: support Chid task of FewCLUE

* 1. decouple evaluate and train

* 1.add FewCLUE datasets(9/9)
2.implement p-tuning strategy by transform_function
3.unify train_script beteween `chid` task and other 8 tasks of FewCLUE

* add README.md

* update FewCLUE data

* add predict.py for FewCLUE

* update README

* update README.md

* add FewCLUE 9 datasets

* update dataset Name

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-06-01 22:52:55 +08:00
jm12138
0d50462dbe Add NeZha Language Model (#467)
* Add NeZha Language Model

Add NeZha Language Model

* Add NeZha model

Add NeZha model

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-06-01 21:56:26 +08:00
liu zhengxi
61ba9eb6f6 delete distribute in yaml (#470) 2021-06-01 19:47:45 +08:00
smallv0221
354bf8e91a Merge pull request #468 from LiuChiachi/make-seq2seq-fit-benchmark-log
Add benchmark log for seq2seq
2021-06-01 17:37:52 +08:00
Jiaqi Liu
cd64ac00d8 Merge branch 'develop' into make-seq2seq-fit-benchmark-log 2021-06-01 17:33:12 +08:00
Guo Sheng
d82da85a4a [WIP] Update api docs for PretrainedModel and PretrainedTokenizer (#289)
* Update api docs for PretrainedModel.

* Update api docs for PretrainedTokenizer.

* Doc tmp

* Update api docs for PretrainedTokenizer.__call__.

* Add special-members for tokenizer_utils docs.

* Add append_docstr.

* Remove append_docstr.

* Remove append_docstr.

Co-authored-by: yingyibiao <yyb0576@163.com>
2021-06-01 16:19:29 +08:00
LiuChiaChi
059a33ea4a update seq2seq to fit benchmark log 2021-06-01 07:46:48 +00:00
liu zhengxi
0f6951cf41 [FasterTransformer] Update FasterTransformer and add performance info logger (#397) 2021-06-01 15:14:03 +08:00
Jack Zhou
4d3905b9f0 fix 2.0.1 crf bug (#464)
* 1.fix 2.0.1 slice bug; 2. cast int32 label which returned in Windows to int64

* change input_id, token_type_id dtype: int64->int32
2021-05-31 20:57:58 +08:00
jm12138
880b4e2762 Add a pretrained model “CPM-Distill” (#459) 2021-05-30 23:07:43 +08:00
WangXi
fe4b9387de fix gpt static check_nan_inf (#461) 2021-05-29 19:00:19 +08:00
liu zhengxi
7470d80c75 [FasterTransformer] GPT with paddle inference (#415)
* add save inference model sample for gpt

* add gpt.cc

* delete useless info

* update

* total length

* wstring

* delete useless code

* update max_len

* update readme

* eos stop

* fix
2021-05-28 16:08:52 +08:00
liu zhengxi
5d0ae66cb2 Upgrade transformer-xl to use paddlenlp.ops.einsum (#362)
Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-05-28 16:07:50 +08:00
Qi Li
d19c67f63d Add bert infer predict script for sst-2 (#449)
* add bert infer predict script for sst-2, test=develop

* fix doc, test=develop

* address review comments, test=develop
2021-05-28 16:03:16 +08:00
gongel
b524a6763e Add BSTC dataset (#418)
* feat: add BSTC dataset

* refactor: simplify code

* docs: add BSTC dataset doc

* docs: add doc to dataset_list.md

* docs: rm data_prepare/dataset_list.rst

Co-authored-by: Zeyu Chen <chenzeyu01@baidu.com>
2021-05-28 16:02:41 +08:00
Jiaqi Liu
1a6ca897eb Add depth search for ofa BERT (#450)
* add depth search script

* add width_mult 100 description in README

* delete dataset_list rst

* modify width_mult 100 to teacher model

* update paddleslim version description
2021-05-28 16:02:07 +08:00
Jack Zhou
5020221f6b Optimize viterbi decoder perf (#431)
* remove scatter

* expand some tensor to avoid broadcast computation

* remove fill constant in iteration

* remove no_grad
2021-05-28 15:58:29 +08:00
tianxin
eb94c262a5 add FewCLUE 9 datasets (#457) 2021-05-28 15:56:47 +08:00
wawltor
7955b9302c Merge pull request #435 from ZHUI/gpt/mp_fix
GPT Fix Tensor Parallelism and  DistributedBatchSampler
2021-05-27 23:48:14 +08:00
Zhong Hui
d16c983f63 Merge branch 'develop' into gpt/mp_fix 2021-05-27 23:05:57 +08:00
smallv0221
8fe0f91b54 Merge pull request #444 from LiuChiachi/add-some-clue-datasets
Add some clue datasets
2021-05-27 16:04:36 +08:00
LiuChiaChi
5ffbddcff8 Merge branch 'develop' of https://github.com/PaddlePaddle/PaddleNLP into add-some-clue-datasets 2021-05-27 07:57:51 +00:00
LiuChiaChi
28e25d74ba delete dataset_list.rst 2021-05-27 07:57:40 +00:00
tianxin
ca75dc8720 update few-shot README.md (#455)
* "add mlm params to dygraph ernie1.0"

* finish p-tuning v1.0

* mend

* delete unused coment

* add label_normalized

* P-tuning: support Chid task of FewCLUE

* 1. decouple evaluate and train

* 1.add FewCLUE datasets(9/9)
2.implement p-tuning strategy by transform_function
3.unify train_script beteween `chid` task and other 8 tasks of FewCLUE

* add README.md

* update FewCLUE data

* add predict.py for FewCLUE

* update README

* update README.md
2021-05-27 15:37:54 +08:00
LiuChiaChi
1878a0224b update url to original url, and add dataset_list.md 2021-05-27 06:44:34 +00:00
tianxin
605f96c4e8 Update Few shot learning (#445)
* "add mlm params to dygraph ernie1.0"

* finish p-tuning v1.0

* mend

* delete unused coment

* add label_normalized

* P-tuning: support Chid task of FewCLUE

* 1. decouple evaluate and train

* 1.add FewCLUE datasets(9/9)
2.implement p-tuning strategy by transform_function
3.unify train_script beteween `chid` task and other 8 tasks of FewCLUE

* add README.md

* update FewCLUE data

* add predict.py for FewCLUE
2021-05-27 11:02:48 +08:00
LiuChiaChi
673fe9dfa7 update usage in dataset overview 2021-05-27 02:50:20 +00:00
LiuChiaChi
6d12a71ce2 fix md5 error, and update dataset __init__ 2021-05-27 02:43:33 +00:00
LiuChiaChi
e61988258d delete individual clue dataset files 2021-05-26 12:54:08 +00:00
LiuChiaChi
a5dc249991 update clue, add overview in rst 2021-05-26 12:51:29 +00:00
LiuChiaChi
cb2fec0963 update clue, add overview in rst 2021-05-26 12:50:56 +00:00
Zhong Hui
82652b7fbc GPT: add ips. 2021-05-26 17:33:54 +08:00
Zhong Hui
7fac24aa0c GPT: fix dropout. 2021-05-26 16:26:05 +08:00
LiuChiaChi
50dc97958d fix cmnli dev read error, cause cmnli also has '-' label 2021-05-26 05:35:34 +00:00
LiuChiaChi
815e00d8da support ocnli ori and clean dataset 2021-05-26 03:47:30 +00:00
LiuChiaChi
7c8247a5b2 add some clue datasets 2021-05-25 13:18:56 +00:00
kinghuin
6c614e98b2 fix SQLParser (#439)
* fix SQLParser

* fix 2.1 error
2021-05-25 18:08:57 +08:00
tianxin
06368bf720 Few shot (#443)
* "add mlm params to dygraph ernie1.0"

* finish p-tuning v1.0

* mend

* delete unused coment

* add label_normalized

* P-tuning: support Chid task of FewCLUE

* 1. decouple evaluate and train

* 1.add FewCLUE datasets(9/9)
2.implement p-tuning strategy by transform_function
3.unify train_script beteween `chid` task and other 8 tasks of FewCLUE

* add README.md

* update FewCLUE data
2021-05-25 18:07:06 +08:00
Steffy-zxf
5e2dc12bfd update returned data of cote dataset (#442)
* update returned data of cote dataset

* update dataset_list.rst
2021-05-25 18:06:41 +08:00
Steffy-zxf
c3d1df6e9e add cote-dp & seabsa16_phns dataset docs (#436)
* add cote-dp & seabsa16_phns dataset docs
2021-05-24 16:58:11 +08:00
Zhong Hui
054ae13bc4 GPT use DistributedBatchSampler to broardcast data. 2021-05-24 14:11:25 +08:00
Zhong Hui
5c5268cfde Tensor Parallelism, fix as paddle #33015 . 2021-05-24 11:20:54 +08:00
Zeyu Chen
9feb9414c5 Update README.md 2021-05-23 00:52:24 +08:00
Zeyu Chen
b87906b2e2 Update README.md 2021-05-23 00:47:38 +08:00
Zeyu Chen
9a5b16ff37 fix readme typo 2021-05-23 00:37:58 +08:00
Zeyu Chen
8e14f1f4c8 fix readme typo 2021-05-23 00:18:22 +08:00
Zeyu Chen
ef04bafb60 Update PaddleNLP 2.0 Readme 2021-05-22 23:59:14 +08:00
Zeyu Chen
7199e05e99 add ChangeLog 2021-05-22 21:42:30 +08:00
Steffy-zxf
ac6602c409 Fix crf usage of information extraction (#427)
* fix crf usage

* update crf usage for all example with crf
2021-05-22 20:46:45 +08:00
smallv0221
a54ab85b45 Add benchmark log for rnnlm (#426)
* Dataset contribute example

* minor fix

* Add dataset description and md5 check

* Add more description

* add doc string for squad metric

* minor fix

* remove dureader metric

* fix space and gramma

* add benchmark log for rnnlm

Co-authored-by: chenxiaozeng <hebiancaozhu@126.com>
2021-05-22 20:45:35 +08:00
tianxin
43bd75b24b Add P-tuning for few_shot (#380)
* "add mlm params to dygraph ernie1.0"

* finish p-tuning v1.0

* mend

* delete unused coment

* add label_normalized

* P-tuning: support Chid task of FewCLUE

* 1. decouple evaluate and train

* 1.add FewCLUE datasets(9/9)
2.implement p-tuning strategy by transform_function
3.unify train_script beteween `chid` task and other 8 tasks of FewCLUE

* add README.md
2021-05-22 20:42:58 +08:00
Guo Sheng
b0bb3d13d2 Fix CUDA_HOME in Windows CPU breaking import. (#428)
* Fix CUDA_HOME in Windows CPU breaking import.

* Update lastest change in README.
2021-05-21 17:30:37 +08:00
Peihan
05f3e4644a unify python inference benchmark log style (#429) 2021-05-21 16:08:33 +08:00
Jiaqi Liu
dc318f4bd0 Merge pull request #422 from PaddlePaddle/fix-ofa-readme
fix ofa readme
2021-05-21 10:14:24 +08:00
Jiaqi Liu
a46086b335 Merge branch 'develop' into fix-ofa-readme 2021-05-21 10:14:04 +08:00
Zeyu Chen
b57958ced3 Update 2.0 readme 2021-05-21 02:20:07 +08:00
Zeyu Chen
5f200e6734 Update 2.0 readme 2021-05-21 02:08:27 +08:00
Zhong Hui
3ae072a891 fix deadlink (#423) 2021-05-20 21:04:43 +08:00
Jiaqi Liu
6f15889baa fix ofa readme
2.1.0修复了2.0.0中存在的bug,该bug不能让ofa bert跑通
2021-05-20 15:24:33 +08:00
6632 changed files with 1015019 additions and 304038 deletions

134
.copyright.hook Normal file
View File

@@ -0,0 +1,134 @@
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import io
import re
import sys
import os
import datetime
COPYRIGHT = '''Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.'''
def _generate_copyright(comment_mark):
copyright=COPYRIGHT.split(os.linesep)
header = copyright[0].rstrip()
p = re.search('(\d{4})', header).group(0)
now = datetime.datetime.now()
header = header.replace(p,str(now.year))
ans=[comment_mark + " " + header + os.linesep]
for idx, line in enumerate(copyright[1:]):
ans.append(comment_mark + " " + line.rstrip() + os.linesep)
return ans
def _get_comment_mark(path):
lang_type=re.compile(r"\.(py|sh)$")
if lang_type.search(path) is not None:
return "#"
lang_type=re.compile(r"\.(h|c|hpp|cc|cpp|cu|go|cuh|proto)$")
if lang_type.search(path) is not None:
return "//"
return None
RE_ENCODE = re.compile(r"^[ \t\v]*#.*?coding[:=]", re.IGNORECASE)
RE_COPYRIGHT = re.compile(r".*Copyright( \(c\))* \d{4}", re.IGNORECASE)
RE_SHEBANG = re.compile(r"^[ \t\v]*#[ \t]?\!")
def _check_copyright(path):
head=[]
try:
with open(path, encoding="utf-8") as f:
head = [next(f) for x in range(4)]
except StopIteration:
pass
for idx, line in enumerate(head):
if RE_COPYRIGHT.search(line) is not None:
return True
return False
def generate_copyright(path, comment_mark):
original_contents = io.open(path, encoding="utf-8").readlines()
head = original_contents[0:4]
insert_line_no=0
for i, line in enumerate(head):
if RE_ENCODE.search(line) or RE_SHEBANG.search(line):
insert_line_no=i+1
copyright = _generate_copyright(comment_mark)
if insert_line_no == 0:
new_contents = copyright
if len(original_contents) > 0 and len(original_contents[0].strip()) != 0:
new_contents.append(os.linesep)
new_contents.extend(original_contents)
else:
new_contents=original_contents[0:insert_line_no]
new_contents.append(os.linesep)
new_contents.extend(copyright)
if len(original_contents) > insert_line_no and len(original_contents[insert_line_no].strip()) != 0:
new_contents.append(os.linesep)
new_contents.extend(original_contents[insert_line_no:])
new_contents="".join(new_contents)
with io.open(path, 'w') as output_file:
output_file.write(new_contents)
def main(argv=None):
parser = argparse.ArgumentParser(
description='Checker for copyright declaration.')
parser.add_argument('filenames', nargs='*', help='Filenames to check')
args = parser.parse_args(argv)
retv = 0
for path in args.filenames:
comment_mark = _get_comment_mark(path)
if comment_mark is None:
print("warning:Unsupported file", path, file=sys.stderr)
continue
if _check_copyright(path):
continue
generate_copyright(path, comment_mark)
if __name__ == '__main__':
exit(main())

7
.flake8 Normal file
View File

@@ -0,0 +1,7 @@
[flake8]
ignore = E203, E402, E501, E731, E741, W503, W605, E722
max-line-length = 119
# E402: module level import not at top of file
per-file-ignores =
__init__.py:F401,F403,E402

89
.github/CODE_OF_CONDUCT.md vendored Normal file
View File

@@ -0,0 +1,89 @@
**简体中文**🀄 | [English🌎](./CODE_OF_CONDUCT_en.md)
# 贡献者公约
## 我们的承诺
身为社区成员、贡献者和领袖,我们承诺使社区参与者不受骚扰,无论其年龄、体型、可见或不可见的缺陷、族裔、性征、性别认同和表达、经验水平、教育程度、社会与经济地位、国籍、相貌、种族、种姓、肤色、宗教信仰、性倾向或性取向如何。
我们承诺以有助于建立开放、友善、多样化、包容、健康社区的方式行事和互动。
## 我们的准则
有助于为我们的社区创造积极环境的行为例子包括但不限于:
* 表现出对他人的同情和善意
* 尊重不同的主张、观点和感受
* 提出和大方接受建设性意见
* 承担责任并向受我们错误影响的人道歉
* 注重社区共同诉求,而非个人得失
不当行为例子包括:
* 使用情色化的语言或图像,及性引诱或挑逗
* 嘲弄、侮辱或诋毁性评论,以及人身或政治攻击
* 公开或私下的骚扰行为
* 未经他人明确许可,公布他人的私人信息,如物理或电子邮件地址
* 其他有理由认定为违反职业操守的不当行为
## 责任和权力
社区领袖有责任解释和落实我们所认可的行为准则,并妥善公正地对他们认为不当、威胁、冒犯或有害的任何行为采取纠正措施。
社区领导有权力和责任删除、编辑或拒绝或拒绝与本行为准则不相符的评论(comment)、提交(commits)、代码、维基(wiki)编辑、议题(issues)或其他贡献,并在适当时机知采取措施的理由。
## 适用范围
本行为准则适用于所有社区场合,也适用于在公共场所代表社区时的个人。
代表社区的情形包括使用官方电子邮件地址、通过官方社交媒体帐户发帖或在线上或线下活动中担任指定代表。
## 监督
辱骂、骚扰或其他不可接受的行为可通过 paddlenlp@baidu.com 向负责监督的社区领袖报告。
所有投诉都将得到及时和公平的审查和调查。
所有社区领袖都有义务尊重任何事件报告者的隐私和安全。
## 处理方针
社区领袖将遵循下列社区处理方针来明确他们所认定违反本行为准则的行为的处理方式:
### 1. 纠正
**社区影响**:使用不恰当的语言或其他在社区中被认定为不符合职业道德或不受欢迎的行为。
**处理意见**:由社区领袖发出非公开的书面警告,明确说明违规行为的性质,并解释举止如何不妥。或将要求公开道歉。
### 2. 警告
**社区影响**:单个或一系列违规行为。
**处理意见**:警告并对连续性行为进行处理。在指定时间内,不得与相关人员互动,包括主动与行为准则执行者互动。这包括避免在社区场所和外部渠道中的互动。违反这些条款可能会导致临时或永久封禁。
### 3. 临时封禁
**社区影响**: 严重违反社区准则,包括持续的不当行为。
**处理意见**: 在指定时间内,暂时禁止与社区进行任何形式的互动或公开交流。在此期间,不得与相关人员进行公开或私下互动,包括主动与行为准则执行者互动。违反这些条款可能会导致永久封禁。
### 4. 永久封禁
**社区影响**:行为模式表现出违反社区准则,包括持续的不当行为、骚扰个人或攻击或贬低某个类别的个体。
**处理意见**:永久禁止在社区内进行任何形式的公开互动。
## 参见
本行为准则改编自 [Contributor Covenant][homepage] 2.1 版, 参见 [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]。
社区处理方针灵感来源于 [Mozilla's code of conduct enforcement ladder][Mozilla CoC]。
有关本行为准则的常见问题的答案,参见 [https://www.contributor-covenant.org/faq][FAQ]。
其他语言翻译参见 [https://www.contributor-covenant.org/translations][translations]。
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

134
.github/CODE_OF_CONDUCT_en.md vendored Normal file
View File

@@ -0,0 +1,134 @@
[简体中文🀄](./CODE_OF_CONDUCT.md) | **English**🌎
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
paddlenlp@baidu.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

154
.github/CONTRIBUTING_en.md vendored Normal file
View File

@@ -0,0 +1,154 @@
[简体中文🀄](../CONTRIBUTING.md) | **English**🌎
# Contributing to PaddleNLP
We highly welcome and value your contributions to `PaddleNLP`. The first step to start your contribution is to sign the [PaddlePaddle Contributor License Agreement](https://cla-assistant.io/PaddlePaddle/PaddleNLP).
This document explains our workflow and work style:
## Finding out what to work on Workflow
## Development Workflow
PaddleNLP uses the [Git branching model](http://nvie.com/posts/a-successful-git-branching-model/). The following steps guide usual contributions.
#### 1. Fork
Our development community has been growing fastly; it doesn't make sense for everyone to write into the official repo. So, please file Pull Requests from your fork. To make a fork, just head over to the GitHub page and click the ["Fork" button](https://help.github.com/articles/fork-a-repo/).
#### 2. Clone
To make a copy of your fork to your local computers, please run
```bash
git clone https://github.com/<your-github-account>/PaddleNLP
cd PaddleNLP
```
#### 3. Create the local feature branch
For daily works like adding a new feature or fixing a bug, please open your feature branch before coding:
```bash
git checkout -b my-cool-feature
```
#### 4. Set up the development environment
Before you start coding, you need to setup the development environment. We highly recommend doing all your development in a virtual environment such as
[venv](https://docs.python.org/3/library/venv.html) or [conda](https://docs.conda.io/en/latest/). After you setup and activated your virtual environment,
run the following command:
```bash
make install
```
This will setup all the dependencies of `PaddleNLP` as well as the [`pre-commit`](http://pre-commit.com/) tool.
If you are working on the `examples` or `applications` module and require importing from `PaddleNLP`, make sure you install `PaddleNLP` in editable mode.
If `PaddleNLP` is already installed in the virtual environment, remove it with `pip uninstall paddlenlp` before reinstalling it in editable mode with
`pip install -e .`
#### 5. Develop
As you develop your new exciting feature, keep in mind that it should be covered by unit tests. All of our unit tests can be found under the `tests` directory.
You can either modify existing unit test to cover the new feature, or create a new test from scratch.
As you finish up the your code, you should make sure the test suite passes. You can run the tests impacted by your changes like this:
```bash
pytest tests/<test_to_run>.py
```
#### 6. Commit
We utilizes [`pre-commit`](http://pre-commit.com/) (with [black](https://black.readthedocs.io/en/stable/), [isort](https://pycqa.github.io/isort/) and
[flake8](https://flake8.pycqa.org/en/latest/) under the hood) to check the style of code and documentation in every commit. When you run run `git commit`, you will see
something like the following:
```
➜ (my-virtual-env) git commit -m "commiting my cool feature"
black....................................................................Passed
isort....................................................................Passed
flake8...................................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
detect private key.......................................................Passed
fix end of files.....................................(no files to check)Skipped
trim trailing whitespace.............................(no files to check)Skipped
CRLF end-lines checker...............................(no files to check)Skipped
CRLF end-lines remover...............................(no files to check)Skipped
No-tabs checker......................................(no files to check)Skipped
Tabs remover.........................................(no files to check)Skipped
copyright_checker........................................................Passed
```
But most of the time things don't go so smoothly. When your code or documentation doesn't meet the standard, the `pre-commit` check will fail.
```
➜ (my-virtual-env) git commit -m "commiting my cool feature"
black....................................................................Passed
isort....................................................................Failed
- hook id: isort
- files were modified by this hook
Fixing examples/information_extraction/waybill_ie/run_ernie_crf.py
flake8...................................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
detect private key.......................................................Passed
fix end of files.....................................(no files to check)Skipped
trim trailing whitespace.............................(no files to check)Skipped
CRLF end-lines checker...............................(no files to check)Skipped
CRLF end-lines remover...............................(no files to check)Skipped
No-tabs checker......................................(no files to check)Skipped
Tabs remover.........................................(no files to check)Skipped
copyright_checker........................................................Passed
```
But **don't panic**!
Our tooling will fix most of the style errors automatically. Some errors will need to be addressed manually. Fortunately, the error messages are straight forward and
the errors are usually simple to fix. After addressing the errors, you can run `git add <files>` and `git commit` again, which will trigger `pre-commit` again.
Once the `pre-commit` checks pass, you are ready to push the code.
[Google][http://google.com/] or [StackOverflow](https://stackoverflow.com/) are great tools to help you understand the code style errors.
Don't worry if you still can't figure it out. You can commit with `git commit -m "style error" --no-verify` and we are happy to help you once you create a Pull Request.
#### 7. Keep pulling
An experienced Git user pulls from the official repo often -- daily or even hourly, so they notice conflicts with others work early, and it's easier to resolve smaller conflicts.
```bash
git remote add upstream https://github.com/PaddlePaddle/PaddleNLP
git pull upstream develop
```
#### 8. Push and file a pull request
You can "push" your local work into your forked repo:
```bash
git push origin my-cool-stuff
```
The push allows you to create a pull request, requesting owners of this [official repo](https://github.com/PaddlePaddle/PaddleNLP) to pull your change into the official one.
To create a pull request, please follow [these steps](https://help.github.com/articles/creating-a-pull-request/).
#### 9. Delete local and remote branches
To keep your local workspace and your fork clean, you might want to remove merged branches:
```bash
git push origin my-cool-stuff
git checkout develop
git pull upstream develop
git branch -d my-cool-stuff
```
## Code Review
- Please feel free to ping your reviewers by @-mentioning the in the Pull Request. Please do this after your pull request passes the CI.
- Please answer reviewers' every comment. If you are to follow the comment, please write "Done"; Otherwise, please start a discussion under the comment.
- If you don't want your reviewers to get overwhelmed by email notifications, you might reply their comments by [in a batch](https://help.github.com/articles/reviewing-proposed-changes-in-a-pull-request/).

23
.github/ISSUE_TEMPLATE/ask-question.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: 🐛 Ask Question
description: 请描述您使用PaddleNLP时遇到的问题
title: "[Question]: "
labels:
- question
body:
- type: markdown
attributes:
value: >
#### 你可以在这里提出一个使用/咨询问题,提问之前请确保:
- 1)已经百度/谷歌搜索过你的问题,但是没有找到解答;
- 2)已经在官网查询过[API文档](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html)与[FAQ](https://www.paddlepaddle.org.cn/documentation/docs/zh/faq/index_cn.html),但是没有找到解答;
- 3)已经在[历史issue](https://github.com/PaddlePaddle/Paddle/issues)中搜索过,没有找到同类issue或issue未被解答。
- type: textarea
id: question
attributes:
label: 请提出你的问题
validations:
required: true

45
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: 🐛 Bug Report
description: PaddleNLP问题反馈
title: "[Bug]: "
labels: bug
body:
- type: textarea
id: environment
attributes:
label: 软件环境
description: |
请使用以下命令给出您本地Paddle相关包信息
```sh
pip list | grep paddle
```
value: |
- paddlepaddle:
- paddlepaddle-gpu:
- paddlenlp:
render: Markdown
validations:
required: true
- type: checkboxes
id: dumplicated-problem
attributes:
label: 重复问题
description: 是否已在issues中搜索相关问题
options:
- label: I have searched the existing issues
required: true
- type: textarea
id: descripton
attributes:
label: 错误描述
description: 给出错误详细描述,以便能够更好的追踪相关问题
render: Markdown
validations:
required: true
- type: textarea
id: mvp-code
attributes:
label: 稳定复现步骤 & 代码
description: 请给出稳定复现该问题的步骤 & 代码,以便相关人员能够快速定位到具体问题。
validations:
required: true

32
.github/ISSUE_TEMPLATE/docs-report.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
name: 🐛 Docs Report
description: PaddleNLP文档反馈
title: "[Docs]: "
labels:
- documentation
body:
- type: textarea
id: environment
attributes:
label: 软件环境
description: |
请使用以下命令给出您本地Paddle相关包信息
```sh
pip list | grep paddle
```
value: |
- paddlepaddle:
- paddlepaddle-gpu:
- paddlenlp:
render: Markdown
validations:
required: true
- type: textarea
id: description
attributes:
label: 详细描述
description: 请详细描述您想要反馈的具体问题
render: Markdown
validations:
required: true

View File

@@ -0,0 +1,30 @@
name: "\U0001F680 Feature request"
description: 请详细描述您所需功能
labels: [ "feature" ]
body:
- type: textarea
id: feature-request
validations:
required: true
attributes:
label: Feature request
description: |
对特性提案的清晰而简明的描述。如果论文和代码存在,请提供链接。
- type: textarea
id: motivation
validations:
required: true
attributes:
label: Motivation
description: |
请概述这项建议的动机。您的特性要求与问题有关吗?
- type: textarea
id: contribution
validations:
required: true
attributes:
label: Your contribution
description: |
Is there any way that you could help, e.g. by submitting a PR? Make sure to read the CONTRIBUTING.MD [readme](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md)

28
.github/ISSUE_TEMPLATE/new-model.yaml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: "\U0001F31F 添加新模型"
description: 请为新模型提交一份说明
labels: [ "New model" ]
body:
- type: textarea
id: description-request
validations:
required: true
attributes:
label: 简要描述
description: |
请简要描述模型的类型、解决的问题等。
- type: checkboxes
id: information-tasks
attributes:
label: 是否已开源
options:
- label: 已开源
- label: 未开源
- type: textarea
id: additional-info
attributes:
label: 模型详细信息
description: |
请给出新模型相关信息,如论文地址、现存代码地址等。

23
.github/ISSUE_TEMPLATE/others.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: 🧩 其他 Others
description: 提出其他问题。
labels: [others]
body:
- type: markdown
attributes:
value: >
#### 你可以在这里提出任何前面几类模板不适用的问题,包括但不限于:优化性建议、框架使用体验反馈、版本兼容性问题、报错信息不清楚等。
- type: textarea
id: others
attributes:
label: 问题描述
validations:
required: true
- type: markdown
attributes:
value: >
感谢你的贡献 🎉!

View File

@@ -1,4 +1,18 @@
<!-- Demo: https://github.com/PaddlePaddle/PaddleNLP/pull/26 -->
#### Before submitting
- [ ] Lint code. If there are lint issues, please format the code first.
```shell
# Install and register `pre-commit` in the project folder
pip install pre-commit && pre-commit install
# Process previous code files separately
pre-commit run --file XXXX.py
```
- [ ] Add test cases into `tests` folder. If there are codecov issues, please add tests cases first.
### PR types
<!-- One of [ New features | Bug fixes | Function optimization | Performance optimization | Breaking changes | Others ] -->

41
.github/actions/check-bypass/action.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: "Check bypass"
description: "A custom action to encapsulate PFCCLab/ci-bypass"
inputs:
github-token:
description: "GitHub token"
required: true
workflow-name:
description: "Workflow name"
required: true
outputs:
can-skip:
description: "Whether the workflow can be skipped."
value: ${{ steps.check-bypass.outputs.can-skip }}
runs:
using: "composite"
steps:
- id: check-bypass
name: Check Bypass
env:
CI_TEAM_MEMBERS: '["tianshuo78520a", "swgu98", "risemeup1", "XieYunshen","luotao1","From00"]'
uses: PFCCLab/ci-bypass@v1
with:
github-token: ${{ inputs.github-token }}
non-pull-request-event-strategy: 'never-skipped'
type: 'composite'
composite-rule: |
{
"any": [
{
"type": "labeled",
"label": ["skip-ci: ${{ inputs.workflow-name }}", "skip-ci: all"],
"username": ${{ env.CI_TEAM_MEMBERS }}
},
{
"type": "commented",
"comment-pattern": [".*/skip-ci ${{ inputs.workflow-name }}.*", ".*/skip-ci all.*"],
"username": ${{ env.CI_TEAM_MEMBERS }}
}
]
}

View File

@@ -0,0 +1,30 @@
name: 'Rerun Workflow'
description: 'Re-run GitHub Actions workflow for a given Pull Request'
inputs:
GITHUB_TOKEN:
description: 'GitHub token with repo scope'
required: true
OWNER:
description: 'Repository owner'
required: true
REPO:
description: 'Repository name'
required: true
PR_ID:
description: 'Pull Request ID'
required: true
JOB_NAME:
description: 'Job name to rerun'
required: true
runs:
using: 'composite'
steps:
- run: bash ./.github/actions/rerun-workflow/rerun.sh
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
OWNER: ${{ inputs.OWNER }}
REPO: ${{ inputs.REPO }}
PR_ID: ${{ inputs.PR_ID }}
JOB_NAME: ${{ inputs.JOB_NAME }}

77
.github/actions/rerun-workflow/rerun.sh vendored Normal file
View File

@@ -0,0 +1,77 @@
# Copyright (c) 2025 PaddleNLP Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
COMMIT_SHA=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$OWNER/$REPO/pulls/$PR_ID" | jq -r '.head.sha')
echo "Commit SHA: $COMMIT_SHA"
response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$OWNER/$REPO/actions/runs?head_sha=$COMMIT_SHA&per_page=100")
echo "Response: $response"
run_ids=$(echo "$response" | jq -r '.workflow_runs[].id')
if [ -n "$run_ids" ]; then
echo "Found run_ids for commit $COMMIT_SHA: $run_ids"
for run_id in $run_ids; do
if [ "$JOB_NAME" = "all-failed" ]; then
echo "Rerunning all failed jobs for run_id: $run_id"
rerun_response=$(curl -X POST -s -w "%{http_code}" -o /dev/null \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/repos/$OWNER/$REPO/actions/runs/$run_id/rerun-failed-jobs")
if [ "$rerun_response" -eq 201 ]; then
echo "Successfully requested rerun for all blocked jobs in run_id: $run_id"
else
echo "Failed to request rerun for run_id: $run_id with status code $rerun_response"
fi
else
jobs_response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$OWNER/$REPO/actions/runs/$run_id/jobs")
echo "Jobs Response for run_id $run_id: $jobs_response"
# if [[ "$JOB_NAME" == *"bypass"* ]]; then
block_jobs=$(echo "$jobs_response" | jq -r --arg job_name "$JOB_NAME" \
'.jobs[] | select(.name == $job_name) | .id')
# else
# block_jobs=$(echo "$jobs_response" | jq -r --arg job_name "$JOB_NAME" \
# '.jobs[] | select(.name == $job_name and .conclusion != "success") | .id')
# fi
if [ -n "$block_jobs" ]; then
echo "Found block jobs for run_id $run_id: $block_jobs"
for job_id in $block_jobs; do
echo "Rerunning job_id: $job_id"
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$OWNER/$REPO/actions/jobs/$job_id/rerun"
done
else
echo "No block jobs found for run_id $run_id with name $JOB_NAME."
fi
fi
done
else
echo "No matching workflow runs found for commit $COMMIT_SHA."
exit 1
fi

13
.github/codecov.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
codecov:
notify:
wait_for_ci: false
coverage:
status:
project:
default:
target: 58% # overall project Coverage
threshold: 1% # Allow the coverage to drop by 1%, and posting a success status.
patch:
default:
target: 80% # lines adjusted Coverage < 80% CI will fail

View File

@@ -0,0 +1,47 @@
name: PaddleFormers PR Check
on:
pull_request:
types: [opened, synchronize]
env:
BRANCH: ${{ github.base_ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
token: ${{ vars.ACTION_GITHUB_TOKEN }}
jobs:
check-approvers:
name: Check approval
runs-on:
group: APPROVAL
steps:
- name: Cleanup
run: |
rm -rf * .[^.]*
- name: Update paddle
run: |
wget -q --no-proxy https://xly-devops.bj.bcebos.com/PaddleTest/PaddleNLP/PaddleNLP-develop.tar.gz --no-check-certificate
tar zxf PaddleNLP-develop.tar.gz --strip-components=1 >/dev/null
rm -rf PaddleNLP-develop.tar.gz >/dev/null
git fetch origin pull/${PR_ID}/head
git checkout -b origin_pr FETCH_HEAD
git remote add upstream https://github.com/PaddlePaddle/PaddleNLP.git
git fetch upstream
git checkout -b test_pr upstream/${BRANCH}
git merge --no-edit origin_pr
git log --pretty=oneline -10
- name: Check bypass
id: check-bypass
uses: ./.github/actions/check-bypass
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
workflow-name: approval
- name: Display Required Approvers
if: steps.check-bypass.outputs.can-skip != 'true'
run: |
cd scripts/ci_approval
bash run_ci_approval_cherry-pick.sh

47
.github/workflows/approval.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
name: Approval
on:
pull_request:
types: [opened, synchronize]
env:
BRANCH: ${{ github.base_ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
token: ${{ vars.ACTION_GITHUB_TOKEN }}
jobs:
check-approvers:
name: Check approval
runs-on:
group: APPROVAL
steps:
- name: Cleanup
run: |
rm -rf * .[^.]*
- name: Update paddle
run: |
wget -q --no-proxy https://xly-devops.bj.bcebos.com/PaddleTest/PaddleNLP/PaddleNLP-develop.tar.gz --no-check-certificate
tar zxf PaddleNLP-develop.tar.gz --strip-components=1 >/dev/null
rm -rf PaddleNLP-develop.tar.gz >/dev/null
git fetch origin pull/${PR_ID}/head
git checkout -b origin_pr FETCH_HEAD
git remote add upstream https://github.com/PaddlePaddle/PaddleNLP.git
git fetch upstream
git checkout -b test_pr upstream/${BRANCH}
git merge --no-edit origin_pr
git log --pretty=oneline -10
- name: Check bypass
id: check-bypass
uses: ./.github/actions/check-bypass
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
workflow-name: approval
- name: Display Required Approvers
if: steps.check-bypass.outputs.can-skip != 'true'
run: |
cd scripts/ci_approval
bash -x run_ci_approval.sh

52
.github/workflows/check-bypass.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
on:
workflow_call:
inputs:
workflow-name:
required: true
type: string
secrets:
github-token:
required: true
outputs:
can-skip:
description: "Whether the workflow can be skipped."
value: ${{ jobs.check-bypass.outputs.can-skip }}
jobs:
check-bypass:
name: Check bypass
runs-on:
group: APPROVAL
permissions:
contents: read
env:
CI_TEAM_MEMBERS: '["tianshuo78520a", "swgu98", "risemeup1" , "XieYunshen","luotao1","From00"]'
outputs:
can-skip: ${{ steps.check-bypass.outputs.can-skip }}
steps:
- name: Cleanup
run: |
rm -rf * .[^.]*
- id: check-bypass
name: Check Bypass
uses: PFCCLab/ci-bypass@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
non-pull-request-event-strategy: 'never-skipped'
type: 'composite'
composite-rule: |
{
"any": [
{
"type": "labeled",
"label": ["skip-ci: ${{ inputs.workflow-name }}", "skip-ci: all"],
"username": ${{ env.CI_TEAM_MEMBERS }}
},
{
"type": "commented",
"comment-pattern": [".*/skip-ci ${{ inputs.workflow-name }}.*", ".*/skip-ci all.*"],
"username": ${{ env.CI_TEAM_MEMBERS }}
}
]
}

113
.github/workflows/lint.yml vendored Normal file
View File

@@ -0,0 +1,113 @@
name: Codestyle Check
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
BRANCH: ${{ github.event.pull_request.base.ref }}
TASK: PaddleNLP-CI-Lint-${{ github.event.pull_request.number }}
jobs:
check-bypass:
name: Check bypass
uses: ./.github/workflows/check-bypass.yml
with:
workflow-name: 'lint'
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
Lint:
name: Lint
needs: check-bypass
if: ${{ needs.check-bypass.outputs.can-skip != 'true' }}
runs-on: [self-hosted, ernie-cpu]
steps:
- name: Run Container
env:
work_dir: ${{ github.workspace }}
python_version: "3.10"
run: |
container_name=${TASK}-$(date +%Y%m%d-%H%M%S)
echo "container_name=${container_name}" >> ${{ github.env }}
docker_image="iregistry.baidu-int.com/paddlecloud/base-images:paddlecloud-ubuntu20.04-gcc12.2-cuda12.3-cudnn9.0-nccl2.20.3.1-openmpi4.1.5-latest"
docker run -d -t --name ${container_name} --net=host -v /dev/shm:/dev/shm --shm-size=32G \
-v $work_dir/../../..:$work_dir/../../.. \
-v $work_dir:/workspace \
-v /home/.cache/pip:/home/.cache/pip \
-e BRANCH \
-e PR_ID \
-e COMMIT_ID \
-e work_dir \
-e no_proxy \
-e python_version \
-w /workspace ${docker_image}
- name: Download Code
env:
work_dir: ${{ github.workspace }}
run: |
docker exec -t ${container_name} /bin/bash -c '
rm -rf * .[^.]*
echo "Downloading PaddleNLP.tar"
wget -q --no-proxy https://paddle-qa.bj.bcebos.com/CodeSync/develop/PaddleNLP.tar --no-check-certificate
echo "Extracting PaddleNLP.tar"
tar xf PaddleNLP.tar && rm -rf PaddleNLP.tar
source $work_dir/../../../proxy
cd PaddleNLP
git config --global user.name "PaddleCI"
git config --global user.email "paddle_ci@example.com"
git pull
git submodule update --init --recursive --force
if [ -n "${PR_ID}" ]; then
git fetch origin pull/${PR_ID}/head
git checkout -b PR_${PR_ID} FETCH_HEAD
git remote add upstream https://github.com/PaddlePaddle/PaddleNLP.git
git fetch upstream ${BRANCH}
git merge ${BRANCH} --no-edit
git diff --numstat ${BRANCH} -- | awk "{print \$NF}"
else
echo "Not in a pull_request event. Skipping PR-specific operations."
fi
git log --pretty=oneline -10
if ! git show-ref --quiet refs/heads/develop; then \
echo "local develop branch is missing, creating local develop branch that tracks remote develop branch"
git fetch origin develop
git branch develop --track origin/develop
else
echo "local develop branch exist, skipping"
fi
'
- name: Setup Environment
run: |
docker exec -t $container_name /bin/bash -c '
unlink /usr/local/bin/python
ln -sf $(which python${python_version}) /usr/local/bin/python
set -e
python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
python -m pip config set global.cache-dir "/home/.cache/pip"
source $work_dir/../../../proxy
python -m pip install --upgrade pip
cd /workspace/PaddleNLP && git config --global --add safe.directory $PWD
make install
'
- name: Test
run: |
docker exec -t $container_name /bin/bash -c '
set -e
source $work_dir/../../../proxy
cd /workspace/PaddleNLP
make lint
'
- name: Terminate And Delete the Container
if: always()
run: |
docker rm -f $container_name 2>/dev/null || true

207
.github/workflows/llm.yml vendored Normal file
View File

@@ -0,0 +1,207 @@
# Disabled LLM CI workflow - manually enabled when needed
name: LLM CI (DISABLED)
#on:
# pull_request:
# types: [opened, synchronize, reopened]
# branches: [develop]
# schedule:
# - cron: "2 0 * * *"
# workflow_call:
# inputs:
# run_downstream:
# required: true
# type: string
# image_name:
# required: true
# type: string
#concurrency:
# group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
# cancel-in-progress: true
#env:
# PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
TASK: paddlenlp-CI-${{ github.event.pull_request.number }}-llm
ci_scripts: /workspace/PaddleNLP/scripts/regression
BRANCH: ${{ github.event.pull_request.base.ref }}
AGILE_COMPILE_BRANCH: ${{ github.event.pull_request.base.ref }}
CI_name: llm-ci
no_proxy: "localhost,bj.bcebos.com,su.bcebos.com,bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn"
HF_ENDPOINT: https://hf-mirror.com
STUDIO_GIT_HOST: http://git.prod.idc-to-cloud.aistudio.baidu-int.com
PPNLP_HOME: /ssd1/paddlenlp
HF_DATASETS_CACHE: /ssd1/paddlenlp/huggingface/datasets
TRANSFORMERS_CACHE: /ssd1/paddlenlp/huggingface
CCACHE_DIR: /home/data/gzcfs/.ccache/gpubox
RUN_DOWNSTREAM: ${{ inputs.run_downstream }}
#defaults:
# run:
# shell: bash
#jobs:
# llm-ci:
# name: llm-ci (DISABLED)
runs-on: [self-hosted, ernie-8gpu]
steps:
- name: Determine Image Name
env:
IMAGE_NAME: ${{ inputs.image_name }}
run: |
if [[ -n "${IMAGE_NAME}" ]]; then
echo "IMAGE_NAME=${IMAGE_NAME}" >> "$GITHUB_ENV"
else
echo "IMAGE_NAME=iregistry.baidu-int.com/paddlecloud/base-images:paddlecloud-ubuntu18.04-gcc8.2-cuda11.8-cudnn8.6-nccl2.15.5-paddlenlp-latest" >> "$GITHUB_ENV"
fi
- name: Run Container
env:
work_dir: ${{ github.workspace }}
CACHE_DIR: /home/data/cfs/.cache
FLAGS_dynamic_static_unified_comm: "True"
python_version: "3.10"
paddle_whl: https://paddle-qa.bj.bcebos.com/paddle-pipeline/Develop-GpuSome-LinuxCentos-Gcc82-Cuda118-Cudnn86-Trt85-Py310-CINN-Compile/latest/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
run: |
container_name=${TASK}-$(date +%Y%m%d-%H%M%S)
echo "container_name=${container_name}" >> "$GITHUB_ENV"
if [[ "$RUN_DOWNSTREAM" == "false" ]]; then
echo "Not in a pull_request or test_build event. Skipping..."
else
docker run -d -t --name ${container_name} --net=host -v /dev/shm:/dev/shm --shm-size=32G \
-v $work_dir/../../..:$work_dir/../../.. \
-v $work_dir:/workspace \
-v /home/.cache/pip:/home/.cache/pip \
-v /ssd1/paddlenlp:/ssd1/paddlenlp \
-v /home/data/gzcfs/.ccache/gpubox:/home/data/gzcfs/.ccache/gpubox \
-e BRANCH \
-e AGILE_COMPILE_BRANCH \
-e PR_ID \
-e COMMIT_ID \
-e work_dir \
-e ci_scripts \
-e no_proxy \
-e CI_name \
-e paddle_whl \
-e HF_ENDPOINT \
-e STUDIO_GIT_HOST \
-e PPNLP_HOME \
-e HF_DATASETS_CACHE \
-e TRANSFORMERS_CACHE \
-e CACHE_DIR \
-e FLAGS_dynamic_static_unified_comm \
-e python_version \
-w /workspace --runtime=nvidia $IMAGE_NAME
fi
- name: Download Code
env:
work_dir: ${{ github.workspace }}
run: |
if [[ "$RUN_DOWNSTREAM" == "false" ]]; then
echo "Not in a pull_request or test_build event. Skipping.."
else
docker exec -t $container_name /bin/bash -c '
rm -rf * .[^.]*
echo "Downloading PaddleNLP.tar.gz"
wget -q --no-proxy https://paddle-qa.bj.bcebos.com/CodeSync/develop/PaddleNLP.tar --no-check-certificate
echo "Extracting PaddleNLP.tar.gz"
tar xf PaddleNLP.tar && rm -rf PaddleNLP.tar
source $work_dir/../../../proxy
cd PaddleNLP
git config --global user.name "PaddleCI"
git config --global user.email "paddle_ci@example.com"
git pull
git submodule update --init --recursive --force
if [ -n "${PR_ID}" ]; then
git fetch origin pull/${PR_ID}/head
git checkout -b PR_${PR_ID} FETCH_HEAD
git remote add upstream https://github.com/PaddlePaddle/PaddleNLP.git
git fetch upstream ${BRANCH}
git merge ${BRANCH} --no-edit
git diff --numstat ${BRANCH} -- | awk "{print \$NF}"
else
echo "Not in a pull_request event. Skipping PR-specific operations."
fi
git log --pretty=oneline -10
'
fi
- name: Skip For Bug
run: |
if [[ "$RUN_DOWNSTREAM" == "false" ]]; then
echo "Not in a pull_request or test_build event. Skipping..."
else
docker exec -t $container_name /bin/bash -c '
cd /workspace/PaddleNLP
git revert f2477c07272d04244cd3287d1f21c70482a4a85f --no-edit # 套件PR#10413引入bug-待修复
git revert d74c950e15a35b7a100d1688c89318195cc83bca --no-edit # 框架升级后配合修改,当前因框架bug固定commit适配
'
fi
- name: Test
run: |
if [[ "$RUN_DOWNSTREAM" == "false" ]]; then
echo "Not in a pull_request or test_build event. Skipping..."
else
docker exec -t $container_name /bin/bash -c '
ldconfig
unlink /usr/bin/python3
ln -sf $(which python${python_version}) /usr/bin/python3
pip config set global.cache-dir "/home/.cache/pip"
set -e
source $work_dir/../../../proxy
cd /workspace/PaddleNLP && git config --global --add safe.directory $PWD
echo "Paddle PR#73283 PR#74484 import bug, set paddle_commit=8ae742 to skip "
export paddle_whl=https://paddle-qa.bj.bcebos.com/paddle-pipeline/Develop-GpuSome-LinuxCentos-Gcc82-Cuda118-Cudnn86-Trt85-Py310-CINN-Compile/8ae7423e99b2ea96e410968a0ebb3f1795e37205/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
timeout 2h bash scripts/regression/run_ci.sh python${python_version} ${paddle_whl}
'
fi
- name: Upload Allure-reports & Logs
if: always()
env:
home_path: ${{ github.workspace }}/../../..
bos_file: ${{ github.workspace }}/../../../bos/BosClient.py
allure_file: ${{ github.workspace }}/../../../allure-2.19.0/bin/allure
run: |
if [[ "$RUN_DOWNSTREAM" == "false" ]]; then
echo "Not in a pull_request or test_build event. Skipping..."
else
docker exec -t $container_name /bin/bash -c '
unset http_proxy && unset https_proxy
if [ ! -f "${{ env.bos_file }}" ]; then
wget -q --no-proxy -O ${{ env.home_path }}/bos_new.tar.gz https://xly-devops.bj.bcebos.com/home/bos_new.tar.gz --no-check-certificate
mkdir ${{ env.home_path }}/bos
tar xf ${{ env.home_path }}/bos_new.tar.gz -C ${{ env.home_path }}/bos
fi
if [ ! -f "${{ env.allure_file }}" ]; then
wget -q --no-proxy -O ${{ env.home_path }}/allure-2.19.0.zip https://xly-devops.bj.bcebos.com/tools/allure-2.19.0.zip --no-check-certificate
unzip -q ${{ env.home_path }}/allure-2.19.0.zip -d ${{ env.home_path }}/
fi
if [[ "${{ env.RUN_DOWNSTREAM }}" == "" && -n "${PR_ID}" ]]; then
bos_prefix="${PR_ID}/${COMMIT_ID}"
elif [[ "${{ env.RUN_DOWNSTREAM }}" == "true" && -n "${PR_ID}" ]]; then
bos_prefix="${PR_ID}/${COMMIT_ID}/test_build"
else
bos_prefix="schedule/$(date +%Y%m%d)"
fi
cd /workspace/PaddleNLP/model_logs
for FILE in /workspace/PaddleNLP/model_logs/*; do
file=$(basename "$FILE")
python ${{ env.bos_file }} $file paddle-github-action/PR/PaddleNLP/llm/${bos_prefix}/logs
echo "$file: https://paddle-github-action.bj.bcebos.com/PR/PaddleNLP/llm/${bos_prefix}/logs/$file"
done
cd /workspace/PaddleNLP/
${{ env.allure_file }} generate result -o report
tar -czf products.tar.gz report model_logs
python ${{ env.bos_file }} products.tar.gz paddle-github-action/PR/PaddleNLP/llm/${bos_prefix}/logs
echo "products: https://paddle-github-action.bj.bcebos.com/PR/PaddleNLP/llm/${bos_prefix}/logs/products.tar.gz"
'
fi
- name: Terminate And Delete the Container
if: always()
run: |
docker rm -f ${{ env.container_name }} 2>/dev/null || true

30
.github/workflows/pipelines.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: Pipelines-Test
on:
push:
paths:
- 'slm/pipelines/*'
pull_request:
paths:
- 'slm/pipelines/*'
jobs:
Pipelines-Test:
name: Pipelines-Test
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip' # caching pip dependencies
- name: Install dependencies
working-directory: ./slm/pipelines
run: |
python -m pip install --upgrade pip
make install
pip install -r tests/requirements.txt
- name: run the command
working-directory: ./slm/pipelines
run: make test

58
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,58 @@
name: Release
on:
workflow_dispatch:
inputs:
package:
description: 'Package to be deployed'
required: true
default: 'paddlenlp'
type: choice
options:
- paddlenlp
- paddle-pipelines
- ppdiffusers
jobs:
Release:
name: Release
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Should Deploy
id: should-deploy
env:
PACKAGE: ${{ inputs.package }}
run: python scripts/should_deploy.py --name $PACKAGE >> $GITHUB_OUTPUT
- name: Check Branch
id: check-branch
run: |
if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "match=true" >> $GITHUB_OUTPUT
fi # See: https://stackoverflow.com/a/58869470/1123955
- name: Is A Publish Branch
if: steps.check-branch.outputs.match == 'true' && steps.should-deploy.outputs.should_deploy == 'true'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.paddlenlp }}
PACKAGE: ${{ inputs.package }}
PADDLENLP_STABLE_VERSION: "true"
run: |
make deploy-$PACKAGE
- name: Should Not Deploy To Pypi Server
if: steps.should-deploy.outputs.should_deploy != 'true'
run: echo 'should not deploy pypi server'
- name: Is Not A Publish Branch
if: steps.check-branch.outputs.match != 'true'
run: echo 'Not A Publish Branch'

73
.github/workflows/rerun.yml vendored Normal file
View File

@@ -0,0 +1,73 @@
name: Re-run
on:
issue_comment:
types: [created]
jobs:
re-run:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/re-run') && github.event.comment.user.login == github.event.issue.user.login }}
runs-on: [self-hosted, ernie-cpu]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Rerun all failed jobs
if: ${{ contains(github.event.comment.body, 'all-failed') }}
uses: ./.github/actions/rerun-workflow
with:
PR_ID: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
JOB_NAME: 'all-failed'
- name: Rerun LLM
if: ${{ contains(github.event.comment.body, 'LLM') }}
uses: ./.github/actions/rerun-workflow
with:
PR_ID: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
JOB_NAME: 'LLM CI / llm-ci'
- name: Unittest GPU
if: ${{ contains(github.event.comment.body, 'Unittest GPU') }}
uses: ./.github/actions/rerun-workflow
with:
PR_ID: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
JOB_NAME: 'Unittest GPU CI / unittest-gpu-ci'
- name: Rerun Unittest CPU
if: ${{ contains(github.event.comment.body, 'Unittest CPU') }}
uses: ./.github/actions/rerun-workflow
with:
PR_ID: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
JOB_NAME: 'Unittest CPU CI / unit-cpu-ci'
- name: Rerun Distribute (V100)
if: ${{ contains(github.event.comment.body, 'Distribute (V100)') }}
uses: ./.github/actions/rerun-workflow
with:
PR_ID: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
JOB_NAME: 'Distribute CI (V100)/ distribute-v100-ci'
- name: Rerun Codestyle Check
if: ${{ contains(github.event.comment.body, 'Codestyle Check') }}
uses: ./.github/actions/rerun-workflow
with:
PR_ID: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
JOB_NAME: 'Codestyle Check / Lint'

35
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Stale
on:
# Allow manual run via GitHub web or CLI
workflow_dispatch:
schedule:
# Run daily at midnight UTC
- cron: 0 0 * * *
permissions:
issues: write
pull-requests: write
jobs:
stale:
runs-on: ubuntu-24.04
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v6.0.1
with:
days-before-issue-stale: 60
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。"
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale. 当前issue 被标记为stale已有14天,即将关闭。"
exempt-issue-labels: 'triage,keep'
days-before-pr-stale: 60
days-before-pr-close: -1
stale-pr-label: "stale"
stale-pr-message: "This Pull Request is stale because it has been open for 60 days with no activity. 当前Pull Request 60天内无活动,被标记为stale。"
operations-per-run: 400

120
.github/workflows/unittest-cpu.yml vendored Normal file
View File

@@ -0,0 +1,120 @@
# Disabled unittest CPU workflow - manually enabled when needed
name: Unittest CPU CI (DISABLED)
#on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
BRANCH: ${{ github.event.pull_request.base.ref }}
TASK: PaddleNLP-CI-${{ github.event.pull_request.number }}-unittest-cpu
HF_ENDPOINT: https://hf-mirror.com
STUDIO_GIT_HOST: http://git.prod.idc-to-cloud.aistudio.baidu-int.com
PPNLP_HOME: /home/disk1/cache
HF_DATASETS_CACHE: /home/disk1/cache/huggingface/datasets
TRANSFORMERS_CACHE: /home/disk1/cache/huggingface
#jobs:
# unittest-cpu-ci:
# name: unittest-cpu-ci (DISABLED)
runs-on: [self-hosted, ernie-cpu]
permissions:
pull-requests: write
contents: read
id-token: write
steps:
- name: Run Container
env:
work_dir: ${{ github.workspace }}
python_version: "3.10"
run: |
container_name=${TASK}-$(date +%Y%m%d-%H%M%S)
echo "container_name=${container_name}" >> ${{ github.env }}
docker_image="iregistry.baidu-int.com/paddlecloud/base-images:paddlecloud-ubuntu20.04-gcc12.2-cuda12.3-cudnn9.0-nccl2.20.3.1-openmpi4.1.5-latest"
docker run -d -t --name ${container_name} --net=host -v /dev/shm:/dev/shm --shm-size=32G \
-v $work_dir/../../..:$work_dir/../../.. \
-v $work_dir:/workspace \
-v /home/.cache/pip:/home/.cache/pip \
-v /home/disk1/cache:/home/disk1/cache \
-e BRANCH \
-e PR_ID \
-e COMMIT_ID \
-e work_dir \
-e no_proxy \
-e python_version \
-e HF_ENDPOINT \
-e STUDIO_GIT_HOST \
-e PPNLP_HOME \
-e HF_DATASETS_CACHE \
-e TRANSFORMERS_CACHE \
-w /workspace ${docker_image}
- name: Download Code
env:
work_dir: ${{ github.workspace }}
run: |
docker exec -t ${container_name} /bin/bash -c '
rm -rf * .[^.]*
echo "Downloading PaddleNLP.tar"
wget -q --no-proxy https://paddle-qa.bj.bcebos.com/CodeSync/develop/PaddleNLP.tar --no-check-certificate
echo "Extracting PaddleNLP.tar"
tar xf PaddleNLP.tar && rm -rf PaddleNLP.tar
source $work_dir/../../../proxy
cd PaddleNLP
git config --global user.name "PaddleCI"
git config --global user.email "paddle_ci@example.com"
git pull
git submodule update --init --recursive --force
if [ -n "${PR_ID}" ]; then
git fetch origin pull/${PR_ID}/head
git checkout -b PR_${PR_ID} FETCH_HEAD
git remote add upstream https://github.com/PaddlePaddle/PaddleNLP.git
git fetch upstream ${BRANCH}
git merge ${BRANCH} --no-edit
git diff --numstat ${BRANCH} -- | awk "{print \$NF}"
else
echo "Not in a pull_request event. Skipping PR-specific operations."
fi
git log --pretty=oneline -10
'
- name: Setup Environment
run: |
docker exec -t $container_name /bin/bash -c '
unlink /usr/bin/python3
ln -sf $(which python${python_version}) /usr/bin/python3
set -e
python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
python -m pip config set global.cache-dir "/home/.cache/pip"
source $work_dir/../../../proxy
python -m pip install --upgrade pip
cd /workspace/PaddleNLP && git config --global --add safe.directory $PWD
pip install -r tests/requirements.txt
make install
'
- name: Test
run: |
docker exec -t $container_name /bin/bash -c '
source $work_dir/../../../proxy
cd /workspace/PaddleNLP
set -e
make test
'
# - name: Upload Coverage To Codecov
# uses: codecov/codecov-action@v3
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./PaddleNLP/coverage.xml
- name: Terminate And Delete the Container
if: always()
run: |
docker rm -f $container_name 2>/dev/null || true

204
.github/workflows/unittest-gpu.yml vendored Normal file
View File

@@ -0,0 +1,204 @@
# Disabled unittest GPU workflow - manually enabled when needed
name: Unittest GPU CI (DISABLED)
#on:
# pull_request:
# types: [opened, synchronize, reopened]
# branches: [develop]
# schedule:
# - cron: "3 0 * * *"
# workflow_call:
# inputs:
# run_downstream:
# required: true
# type: string
# image_name:
# required: true
# type: string
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
PR_ID: ${{ github.event.pull_request.number }}
COMMIT_ID: ${{ github.event.pull_request.head.sha }}
TASK: paddlenlp-CI-${{ github.event.pull_request.number }}-unit-gpu
ci_scripts: /workspace/PaddleNLP/scripts/unit_test
BRANCH: ${{ github.event.pull_request.base.ref }}
AGILE_COMPILE_BRANCH: ${{ github.event.pull_request.base.ref }}
CI_name: unittest-gpu-ci
no_proxy: "localhost,bj.bcebos.com,su.bcebos.com,bcebos.com,apiin.im.baidu.com,gitee.com,aliyun.com,.baidu.com,.tuna.tsinghua.edu.cn"
HF_ENDPOINT: https://hf-mirror.com
STUDIO_GIT_HOST: http://git.prod.idc-to-cloud.aistudio.baidu-int.com
PPNLP_HOME: /ssd1/paddlenlp
HF_DATASETS_CACHE: /ssd1/paddlenlp/huggingface/datasets
TRANSFORMERS_CACHE: /ssd1/paddlenlp/huggingface
CCACHE_DIR: /home/data/gzcfs/.ccache/gpubox
RUN_DOWNSTREAM: ${{ inputs.run_downstream }}
defaults:
run:
shell: bash
#jobs:
# unittest-gpu-ci:
# name: unittest-gpu-ci (DISABLED)
runs-on: [self-hosted, ernie-8gpu]
steps:
- name: Determine Image Name
env:
IMAGE_NAME: ${{ inputs.image_name }}
run: |
if [[ -n "${IMAGE_NAME}" ]]; then
echo "IMAGE_NAME=${IMAGE_NAME}" >> "$GITHUB_ENV"
else
echo "IMAGE_NAME=iregistry.baidu-int.com/paddlecloud/base-images:paddlecloud-ubuntu18.04-gcc8.2-cuda11.8-cudnn8.6-nccl2.15.5-paddlenlp-latest" >> "$GITHUB_ENV"
fi
- name: Run Container
env:
work_dir: ${{ github.workspace }}
CACHE_DIR: /home/data/cfs/.cache
FLAGS_dynamic_static_unified_comm: "True"
python_version: "3.10"
paddle_whl: https://paddle-qa.bj.bcebos.com/paddle-pipeline/Develop-GpuSome-LinuxCentos-Gcc82-Cuda118-Cudnn86-Trt85-Py310-CINN-Compile/latest/paddlepaddle_gpu-0.0.0-cp310-cp310-linux_x86_64.whl
run: |
container_name=${TASK}-$(date +%Y%m%d-%H%M%S)
echo "container_name=${container_name}" >> "$GITHUB_ENV"
if [[ "$RUN_DOWNSTREAM" == "false" ]]; then
echo "Not in a pull_request or test_build event. Skipping..."
else
docker run -d -t --name ${container_name} --net=host -v /dev/shm:/dev/shm --shm-size=32G \
-v $work_dir/../../..:$work_dir/../../.. \
-v $work_dir:/workspace \
-v /home/.cache/pip:/home/.cache/pip \
-v /ssd1/paddlenlp:/ssd1/paddlenlp \
-v /home/data/gzcfs/.ccache/gpubox:/home/data/gzcfs/.ccache/gpubox \
-e BRANCH \
-e AGILE_COMPILE_BRANCH \
-e PR_ID \
-e COMMIT_ID \
-e work_dir \
-e ci_scripts \
-e no_proxy \
-e CI_name \
-e paddle_whl \
-e HF_ENDPOINT \
-e STUDIO_GIT_HOST \
-e PPNLP_HOME \
-e HF_DATASETS_CACHE \
-e TRANSFORMERS_CACHE \
-e CACHE_DIR \
-e FLAGS_dynamic_static_unified_comm \
-e python_version \
-w /workspace --runtime=nvidia $IMAGE_NAME
fi
- name: Download Code
env:
work_dir: ${{ github.workspace }}
run: |
if [[ "$RUN_DOWNSTREAM" == "false" ]]; then
echo "Not in a pull_request or test_build event. Skipping.."
else
docker exec -t $container_name /bin/bash -c '
rm -rf * .[^.]*
echo "Downloading PaddleNLP.tar.gz"
wget -q --no-proxy https://paddle-qa.bj.bcebos.com/CodeSync/develop/PaddleNLP.tar --no-check-certificate
echo "Extracting PaddleNLP.tar.gz"
tar xf PaddleNLP.tar && rm -rf PaddleNLP.tar
source $work_dir/../../../proxy
cd PaddleNLP
git config --global user.name "PaddleCI"
git config --global user.email "paddle_ci@example.com"
git pull
git submodule update --init --recursive --force
if [ -n "${PR_ID}" ]; then
git fetch origin pull/${PR_ID}/head
git checkout -b PR_${PR_ID} FETCH_HEAD
git remote add upstream https://github.com/PaddlePaddle/PaddleNLP.git
git fetch upstream ${BRANCH}
git merge ${BRANCH} --no-edit
git diff --numstat ${BRANCH} -- | awk "{print \$NF}"
else
echo "Not in a pull_request event. Skipping PR-specific operations."
fi
git log --pretty=oneline -10
'
fi
- name: Skip For Bug
run: |
if [[ "$RUN_DOWNSTREAM" == "false" ]]; then
echo "Not in a pull_request or test_build event. Skipping..."
else
docker exec -t $container_name /bin/bash -c '
cd /workspace/PaddleNLP
echo "no skip for bug"
'
fi
- name: Test
run: |
if [[ "$RUN_DOWNSTREAM" == "false" ]]; then
echo "Not in a pull_request or test_build event. Skipping..."
else
docker exec -t $container_name /bin/bash -c '
ldconfig
unlink /usr/bin/python3
ln -sf $(which python${python_version}) /usr/bin/python3
pip config set global.cache-dir "/home/.cache/pip"
source $work_dir/../../../proxy
set -e
cd /workspace/PaddleNLP && git config --global --add safe.directory $PWD
timeout 50m bash scripts/unit_test/ci_unit.sh ${paddle_whl}
'
fi
- name: Upload Allure-reports & Logs
if: always()
env:
home_path: ${{ github.workspace }}/../../..
bos_file: ${{ github.workspace }}/../../../bos/BosClient.py
allure_file: ${{ github.workspace }}/../../../allure-2.19.0/bin/allure
run: |
if [[ "$RUN_DOWNSTREAM" == "false" ]]; then
echo "Not in a pull_request or test_build event. Skipping..."
else
docker exec -t $container_name /bin/bash -c '
unset http_proxy && unset https_proxy
if [ ! -f "${{ env.bos_file }}" ]; then
wget -q --no-proxy -O ${{ env.home_path }}/bos_new.tar.gz https://xly-devops.bj.bcebos.com/home/bos_new.tar.gz --no-check-certificate
mkdir ${{ env.home_path }}/bos
tar xf ${{ env.home_path }}/bos_new.tar.gz -C ${{ env.home_path }}/bos
fi
if [ ! -f "${{ env.allure_file }}" ]; then
wget -q --no-proxy -O ${{ env.home_path }}/allure-2.19.0.zip https://xly-devops.bj.bcebos.com/tools/allure-2.19.0.zip --no-check-certificate
unzip -q ${{ env.home_path }}/allure-2.19.0.zip -d ${{ env.home_path }}/
fi
if [[ "${{ env.RUN_DOWNSTREAM }}" == "" && -n "${PR_ID}" ]]; then
bos_prefix="${PR_ID}/${COMMIT_ID}"
elif [[ "${{ env.RUN_DOWNSTREAM }}" == "true" && -n "${PR_ID}" ]]; then
bos_prefix="${PR_ID}/${COMMIT_ID}/test_build"
else
bos_prefix="schedule/$(date +%Y%m%d)"
fi
cd /workspace/PaddleNLP/unittest_logs
for FILE in /workspace/PaddleNLP/unittest_logs/*; do
file=$(basename "$FILE")
python ${{ env.bos_file }} $file paddle-github-action/PR/PaddleNLP/unittest-gpu/${bos_prefix}/logs
echo "$file: https://paddle-github-action.bj.bcebos.com/PR/PaddleNLP/unittest-gpu/${bos_prefix}/logs/$file"
done
cd /workspace/PaddleNLP/
${{ env.allure_file }} generate result -o report
tar -czf products.tar.gz report unittest_logs
python ${{ env.bos_file }} products.tar.gz paddle-github-action/PR/PaddleNLP/unittest-gpu/${bos_prefix}/logs
echo "report: https://paddle-github-action.bj.bcebos.com/PR/PaddleNLP/unittest-gpu/${bos_prefix}/logs/products.tar.gz"
'
fi
- name: Terminate And Delete the Container
if: always()
run: |
docker rm -f $container_name 2>/dev/null || true

20
.gitignore vendored
View File

@@ -9,6 +9,7 @@ __pycache__/
# Distribution / packaging
.Python
build/
build*
develop-eggs/
dist/
downloads/
@@ -52,6 +53,7 @@ coverage.xml
# Translations
*.mo
*.pot
*.doctree
# Django stuff:
*.log
@@ -121,3 +123,21 @@ FETCH_HEAD
# vscode
.vscode
./ppdiffusers/ppdiffusers/version.py
# third party
csrc/third_party/
dataset/
output/
# gen codes
autogen/
# cutlass kernel
!csrc/gpu/cutlass_kernels/gemm/collective/builders
#fp8
ops/csrc/fp8/deep_gemm/include/cutlass
ops/csrc/fp8/deep_gemm/include/cute
.ccls-cache

6
.gitmodules vendored Normal file
View File

@@ -0,0 +1,6 @@
[submodule "csrc/third_party/cutlass"]
path = csrc/third_party/cutlass
url = https://github.com/NVIDIA/cutlass.git
[submodule "csrc/third_party/nlohmann_json"]
path = csrc/third_party/nlohmann_json
url = https://github.com/nlohmann/json.git

View File

@@ -1,10 +1,22 @@
- repo: https://github.com/PaddlePaddle/mirrors-yapf.git
sha: 0d79c0c469bab64f7229c9aca2b1186ef47f0e37
exclude: 'slm/model_zoo/gpt-3;csrc/third_party'
repos:
# For Python files
- repo: https://github.com/psf/black.git
rev: 22.8.0
hooks:
- id: yapf
files: \.py$
- id: black
files: \.(py|pyi)$
additional_dependencies: [toml]
- repo: https://github.com/PyCQA/isort
rev: 5.11.5
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
sha: a11d9314b22d8f8c7556443875b731ef05965464
rev: v4.1.0
hooks:
- id: check-merge-conflict
- id: check-symlinks
@@ -15,7 +27,7 @@
- id: trailing-whitespace
files: \.md$
- repo: https://github.com/Lucas-C/pre-commit-hooks
sha: v1.0.1
rev: v1.1.14
hooks:
- id: forbid-crlf
files: \.md$
@@ -25,11 +37,37 @@
files: \.md$
- id: remove-tabs
files: \.md$
- repo: local
hooks:
- id: copyright_checker
name: copyright_checker
entry: python .copyright.hook
language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|xpu|kps|py|sh)$
# For Markdown files
- repo: local
hooks:
- id: add-spaces-between-chinese-and-english
name: Add spaces between Chinese and English characters
entry: python scripts/codestyle/check_spaces.py
language: python
files: \.(md|markdown)$
pass_filenames: true
# For dead links
- repo: local
hooks:
- id: check-dead-links
name: Check dead links
entry: python scripts/codestyle/check_dead_links.py
language: python
files: \.(md|markdown|rst)$
pass_filenames: true
- repo: local
hooks:
- id: clang-format
name: clang-format
description: Format files with ClangFormat
entry: bash .clang_format.hook -i
description: Format files with ClangFormat.
entry: bash ./tools/codestyle/clang_format.sh -i
language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps)$

View File

@@ -4,6 +4,10 @@
# Required
version: 2
build:
os: "ubuntu-20.04"
tools:
python: "3.10"
submodules:
include: all
@@ -11,7 +15,7 @@ submodules:
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
configuration: docs/zh/conf.py
# Optionally build your docs in additional formats such as PDF
#formats:
@@ -19,10 +23,5 @@ sphinx:
# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: docs/requirements.txt
- requirements: requirements.txt
- method: setuptools
path: .
system_packages: true

View File

@@ -1,3 +0,0 @@
[style]
based_on_style = pep8
column_limit = 80

158
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,158 @@
**简体中文**🀄 | [English🌎](.github/CONTRIBUTING_en.md)
# Contributing to PaddleNLP
我们非常欢迎并希望您对`PaddleNLP`做出开源贡献。在您开始提交您的贡献之前,请先行签署[PaddlePaddle 贡献者许可协议](https://cla-assistant.io/PaddlePaddle/PaddleNLP)。
本文接下来将介绍我们的开发与贡献流程:
## 贡献方式
我们欢迎不同的向`PaddleNLP`做出贡献的方式,例如:
- 修复已知的 Issue
- 提交新的 Issue,例如提出功能需求或者 bug 报告
- 实现新的模型结构
如果您不知道从哪里开始,请查看 Issues 板块中的`Good First Issue`标签。它为您提供一个对初学者友好的已知 Issue 列表,可以降低贡献的门槛,帮助您开始为开源做出贡献。您只需在您想处理的 Issue 中告知我们您想负责此 Issue 即可。
## 开发流程
PaddleNLP 使用 [Git 分支模型](http://nvie.com/posts/a-successful-git-branching-model/)。对于常见的开源贡献,我们有以下的贡献流程:
### 1. Fork
因为 PaddleNLP 的开发社区一直在发展,如果每位贡献者都直接向官方 Repo 提交 commit 将会难以管理。因此,请从您的分支中提交 Pull Requests。建议您通过 GitHub 的[“Fork”按钮](https://help.github.com/articles/fork-a-repo/)来创建您的 Fork 分支。
### 2. Clone
请运行一下命令将您的分支 clone 到本地
```bash
git clone https://github.com/<your-github-account>/PaddleNLP
cd PaddleNLP
```
### 3. 创建本地开发分支
对于添加新功能或修复错误等日常工作,请在开发前创建您的本地开发分支:
```bash
git checkout -b my-cool-feature
```
### 4. 配置开发环境
在开始编码之前,您需要设置开发环境。我们强烈建议您在虚拟环境中进行所有开发,例如[venv](https://docs.python.org/3/library/venv.html)或[conda](https://docs.conda.io/en/latest/)。
请您设置并激活虚拟环境后,运行以下命令:
```bash
make install
```
这将设置 `PaddleNLP` 的所有依赖以及 [`pre-commit`](http://pre-commit.com/) 工具。
如果您需要开发 `examples` 或 `applications` 模块并加载 `PaddleNLP`,请确保以可编辑模式(`-e`)安装 `PaddleNLP`。
如果在虚拟环境中已经安装 `PaddleNLP` ,请使用 `pip uninstall paddlenlp` 将其删除,然后以可编辑模式重新安装它
`pip install -e .`
### 5. 开发
当您开发时,请确保您新增的代码会被单元测试所覆盖。我们所有的单元测试都可以在 `tests` 目录下找到。
您可以修改现有单元测试以覆盖新功能,也可以从头开始创建新测试。
当您完成代码时,您应该确保相关的单元测试可以通过。您可以像这样运行受更改影响的测试:
```bash
pytest tests/<test_to_run>.py
```
### 6. Commit
我们使用 [`pre-commit`](http://pre-commit.com/)工具(包括[black](https://black.readthedocs.io/en/stable/)、[isort](https:/ /pycqa.github.io/isort/) 和
[flake8](https://flake8.pycqa.org/en/latest/))来检查每次提交中的代码和文档的风格。当你运行 `git commit` 时,你会看到
类似于以下内容:
```text
➜ (my-virtual-env) git commit -m "committing my cool feature"
black....................................................................Passed
isort....................................................................Passed
flake8...................................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
detect private key.......................................................Passed
fix end of files.....................................(no files to check)Skipped
trim trailing whitespace.............................(no files to check)Skipped
CRLF end-lines checker...............................(no files to check)Skipped
CRLF end-lines remover...............................(no files to check)Skipped
No-tabs checker......................................(no files to check)Skipped
Tabs remover.........................................(no files to check)Skipped
copyright_checker........................................................Passed
```
但大多数时候事情并没有那么顺利。当您的代码或文档不符合标准时,`pre-commit` 检查将失败。
```text
➜ (my-virtual-env) git commit -m "committing my cool feature"
black....................................................................Passed
isort....................................................................Failed
- hook id: isort
- files were modified by this hook
Fixing examples/information_extraction/waybill_ie/run_ernie_crf.py
flake8...................................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
detect private key.......................................................Passed
fix end of files.....................................(no files to check)Skipped
trim trailing whitespace.............................(no files to check)Skipped
CRLF end-lines checker...............................(no files to check)Skipped
CRLF end-lines remover...............................(no files to check)Skipped
No-tabs checker......................................(no files to check)Skipped
Tabs remover.........................................(no files to check)Skipped
copyright_checker........................................................Passed
```
我们的工具将自动修复大部分样式错误,但是有些错误需要手动解决。幸运的是,错误信息一般通俗易懂,很容易修复。
解决错误后,您可以再次运行 `git add <files>` 和 `git commit`,这将再次触发 pre-commit 。
一旦 pre-commit 检查通过,您就可以推送代码了。
[Google](https://google.com/) 或 [StackOverflow](https://stackoverflow.com/) 是帮助您了解代码风格错误的好工具。
如果您仍然无法弄清楚,请不要担心。您可以使用 `git commit -m "style error" --no-verify` 提交,我们很乐意在您创建 Pull Request 后帮助您。
### 7. git pull 与代码冲突
有经验的 Git 用户经常从官方 Repo 中 git pull。因为这样子他们会及早注意到与其他人的代码冲突,并且让代码冲突更容易解决
```bash
git remote add upstream https://github.com/PaddlePaddle/PaddleNLP
git pull upstream develop
```
### 8. git push 与提交 Pull Request
您可以将您的本地开发分支中的工作 push 到您的 fork 的分支中:
```bash
git push origin my-cool-stuff
```
git push 之后,您可以提交 Pull Request,请求[官方 repo](https://github.com/PaddlePaddle/PaddleNLP) 采纳您的开发工作。请您依照[这些步骤](https://help.github.com/articles/creating-a-pull-request/)创建 Pull Request。
### 9. 删除已经合入的本地和远程分支
为了保持您本地的工作区和 fork 分支的干净整洁,建议您在 Pull Request 合入之后删除本地的残余分支:
```bash
git push origin my-cool-stuff
git checkout develop
git pull upstream develop
git branch -d my-cool-stuff
```
## 代码 Review
- 在您的 Pull Request 能够顺利通过本地测试以及 CI 的情况下,您可以在 Pull Request 中 @ 相关的 Reviewer,提醒他们尽快对您的 Pull Request 进行 Review。
- 请处理 Reviewer 的每一条评论。如果您已按照评论修改,请回复“完成”;否则,可以在评论下展开讨论。
- 如果您不希望您的 Reviewer 被电子邮件通知淹没,您可以[批量回复](https://help.github.com/articles/reviewing-proposed-changes-in-a-pull-request/)。

79
Makefile Normal file
View File

@@ -0,0 +1,79 @@
# Makefile for PaddleNLP
#
# GitHb: https://github.com/PaddlePaddle/PaddleNLP
# Author: Paddle Team https://github.com/PaddlePaddle
#
.PHONY: all
all : lint test
check_dirs := applications examples model_zoo paddlenlp pipelines ppdiffusers scripts tests
# # # # # # # # # # # # # # # Format Block # # # # # # # # # # # # # # #
format:
pre-commit run isort
pre-commit run black
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # Lint Block # # # # # # # # # # # # # # #
.PHONY: lint
lint:
$(eval modified_py_files := $(shell python scripts/get_modified_files.py $(check_dirs)))
@if test -n "$(modified_py_files)"; then \
echo ${modified_py_files}; \
pre-commit run --files ${modified_py_files}; \
else \
echo "No library .py files were modified"; \
fi
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # Test Block # # # # # # # # # # # # # # #
.PHONY: test
test: unit-test
unit-test:
PYTHONPATH=$(shell pwd) pytest -v \
-n auto \
--retries 1 --retry-delay 1 \
--durations 20 \
--cov paddlenlp \
--cov-report xml:coverage.xml
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.PHONY: install
install:
pip install --pre paddlepaddle -i https://www.paddlepaddle.org.cn/packages/nightly/cpu/
pip install -r requirements-dev.txt
pip install -r requirements.txt
pip install -r paddlenlp/experimental/autonlp/requirements.txt
pre-commit install
.PHONY: deploy-ppdiffusers
deploy-ppdiffusers:
cd ppdiffusers && make install && make
.PHONY: deploy-paddle-pipelines
deploy-paddle-pipelines:
cd pipelines && make install && make
.PHONY: deploy-paddlenlp
deploy-paddlenlp:
# install related package
make install
# build
python3 setup.py sdist bdist_wheel
# upload
twine upload --skip-existing dist/*
.PHONY: regression-all
release:
bash ./scripts/regression/run_release.sh 0 0,1 all
.PHONY: regression-key
key:
bash ./scripts/regression/run_release.sh 0 0,1 p0

383
README.md
View File

@@ -1,185 +1,298 @@
简体中文 | [English](./README_en.md)
**简体中文**🀄 | [English🌎](./README_en.md)
<p align="center">
<img src="./docs/imgs/paddlenlp.png" width="720" height ="100" />
<img src="https://user-images.githubusercontent.com/1371212/175816733-8ec25eb0-9af3-4380-9218-27c154518258.png" align="middle" width="500" />
</p>
------------------------------------------------------------------------------------------
[![PyPI - PaddleNLP Version](https://img.shields.io/pypi/v/paddlenlp.svg?label=pip&logo=PyPI&logoColor=white)](https://pypi.org/project/paddlenlp/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/paddlenlp)](https://pypi.org/project/paddlenlp/)
[![PyPI Status](https://pepy.tech/badge/paddlenlp/month)](https://pepy.tech/project/paddlenlp)
![python version](https://img.shields.io/badge/python-3.6+-orange.svg)
![support os](https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-yellow.svg)
![GitHub](https://img.shields.io/github/license/paddlepaddle/paddlenlp)
<p align="center">
<a href="https://paddlenlp.readthedocs.io/en/latest/?badge=latest"><img src="https://readthedocs.org/projects/paddlenlp/badge/?version=latest">
<a href="https://github.com/PaddlePaddle/PaddleNLP/releases"><img src="https://img.shields.io/github/v/release/PaddlePaddle/PaddleNLP?color=ffa"></a>
<a href=""><img src="https://img.shields.io/badge/python-3.7+-aff.svg"></a>
<a href=""><img src="https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-pink.svg"></a>
<a href="https://github.com/PaddlePaddle/PaddleNLP/graphs/contributors"><img src="https://img.shields.io/github/contributors/PaddlePaddle/PaddleNLP?color=9ea"></a>
<a href="https://github.com/PaddlePaddle/PaddleNLP/commits"><img src="https://img.shields.io/github/commit-activity/m/PaddlePaddle/PaddleNLP?color=3af"></a>
<a href="https://pypi.org/project/paddlenlp/"><img src="https://img.shields.io/pypi/dm/paddlenlp?color=9cf"></a>
<a href="https://github.com/PaddlePaddle/PaddleNLP/issues"><img src="https://img.shields.io/github/issues/PaddlePaddle/PaddleNLP?color=9cc"></a>
<a href="https://github.com/PaddlePaddle/PaddleNLP/stargazers"><img src="https://img.shields.io/github/stars/PaddlePaddle/PaddleNLP?color=ccf"></a>
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache%202-dfd.svg"></a>
</p>
## 简介
<h4 align="center">
<a href=#特性> 特性 </a> |
<a href=#模型支持> 模型支持 </a> |
<a href=#安装> 安装 </a> |
<a href=#快速开始> 快速开始 </a> |
<a href=#社区交流> 社区交流 </a>
</h4>
PaddleNLP 2.0拥有**覆盖多场景的模型库**、**简洁易用的全流程API**与**动静统一的高性能分布式训练**能力,旨在为飞桨开发者提升文本领域建模效率,并提供基于PaddlePaddle 2.0的NLP领域最佳实践。
**PaddleNLP**是一款基于飞桨深度学习框架的大语言模型(LLM)开发套件,支持在多种硬件上进行高效的大模型训练、无损压缩以及高性能推理。PaddleNLP 具备**简单易用**和**性能极致**的特点,致力于助力开发者实现高效的大模型产业级应用。
<a href="https://trendshift.io/repositories/2246" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2246" alt="PaddlePaddle%2FPaddleNLP | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
## News 📢
* **2025.04.29 PaddleNLP 现已支持 Qwen3 系列模型**: Qwen3 系列模型支持持两种思考模式,预训练约 36 万亿个 token、119 种语言和方言。包括六个 Dense 模型, Qwen3-32B、Qwen3-14B、Qwen3-8B、Qwen3-4B、Qwen3-1.7B 和 Qwen3-0.6B。两个 MoE 模型的权重:Qwen3-235B-A22B,Qwen3-30B-A3B。
* **2025.03.12 [PaddleNLP v3.0 Beta4](https://github.com/PaddlePaddle/PaddleNLP/releases/tag/v3.0.0-beta4)**:全面支持 DeepSeek V3/R1/R1-Distill, 及 QwQ-32B 等热门思考模型。**DeepSeek V3/R1完整版支持 FP8、INT8、4-bit 量化推理,MTP 投机解码**。单机 FP8推理输出超**1000 tokens/s**; 4-bit 推理输出超**2100 tokens/s**! 发布新版推理部署镜像,热门模型[一键部署](https://paddlenlp.readthedocs.io/zh/latest/llm/server/docs/general_model_inference.html)。推理部署[使用文档](https://paddlenlp.readthedocs.io/zh/latest/llm/docs/predict/index.html)全面更新,体验全面提升!自研下一代通用信息抽取模型 PP-UIE [全新发布](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/application/information_extraction),支持8K 长度信息抽取。新增大模型 Embedding 训练,支持 INF-CL 超大 batch size 训练。新增[MergeKit](https://paddlenlp.readthedocs.io/zh/latest/llm/docs/mergekit.html)模型融合工具,缓解对齐代价。低资源训练全面优化,16G 小显存可以流畅训练。
* **2025.02.10 PaddleNLP 现已支持 DeepSeek-R1系列模型,[在线使用](https://aistudio.baidu.com/projectdetail/8775758)**:依托全新的 PaddleNLP 3.0套件,DeepSeek-R1系列模型现已全面支持。凭借数据并行、数据分组切分并行、模型并行、流水线并行以及专家并行等一系列先进的分布式训练能力,结合 Paddle 框架独有的列稀疏注意力掩码表示技术——FlashMask 方法,DeepSeek-R1系列模型在训练过程中显著降低了显存消耗,同时取得了卓越的训练性能提升。
<details><summary> <b>点击展开</b> </summary><div>
* **2025.03.17 《DeepSeek-R1满血版单机部署实测》** 🔥🔥🔥 飞桨框架3.0大模型推理部署全面升级,支持多款主流大模型,DeepSeek-R1满血版实现单机部署,吞吐提升一倍!欢迎广大用户开箱体验~现已开启有奖活动:完成 DeepSeek-R1-MTP 单机部署任务、提交高质量测评 blog,即可实时赢取奖金!💰💰💰
报名[地址](https://www.wjx.top/vm/OlzzmbG.aspx#), 活动详情:https://github.com/PaddlePaddle/PaddleNLP/issues/10166 , 参考文档:https://github.com/PaddlePaddle/PaddleNLP/issues/10157 。
* **2025.03.06 PaddleNLP 现已支持 Qwen/QwQ-32B 模型**: 其模型参数仅有 32B,但其数学推理、编程能力和通用能力可与具备 671B 参数(其中 37B 被激活)的 DeepSeek-R1 媲美。借助 PaddleNLP 3.0套件,现可实现多种并行策略[微调训练](./llm/README.md)、[高性能推理、低比特量化](./llm/docs/predict/qwen.md)和[服务化部署](./llm/server/README.md)。
* **2025.02.20 🔥🔥《PP-UIE 信息抽取智能引擎全新升级》** 强化零样本学习能力,支持极少甚至零标注数据实现高效冷启动与迁移学习,显著降低数据标注成本;具备处理长文本能力,支持 8192 个 Token 长度文档信息抽取,实现跨段落识别关键信息,形成完整理解;提供完整可定制化的训练和推理全流程,训练效率相较于 LLama-Factory 实现了1.8倍的提升。
2月26日(周三)19:00为您深度解析全新 PP-UIE 技术方案及在部署方面的功能、优势与技巧。报名链接:https://www.wjx.top/vm/mBKC6pb.aspx?udsid=606418
* **2024.12.16 [PaddleNLP v3.0 Beta3](https://github.com/PaddlePaddle/PaddleNLP/releases/tag/v3.0.0-beta3)**:大模型功能全新升级,新增了 Llama-3.2、DeepSeekV2模型,升级了 TokenizerFast,快速分词,重构了 SFTTrainer,一键开启 SFT 训练。此外,PaddleNLP 还支持了优化器状态的卸载和重载功能,实现了精细化的重新计算,训练性能提升7%。在 Unified Checkpoint 方面,进一步优化了异步保存逻辑,新增 Checkpoint 压缩功能,可节省78.5%存储空间。
最后,在大模型推理方面,升级 Append Attention,支持了 FP8量化,支持投机解码。
* **2024.12.13 📚《飞桨大模型套件 Unified Checkpoint 技术》**,加速模型存储95%,节省空间78%。支持全分布式策略调整自适应转换,提升模型训练的灵活性与可扩展性。训练-压缩-推理统一存储协议,无需手动转换提升全流程体验。Checkpoint 无损压缩结合异步保存,实现秒级存储并降低模型存储成本。适用于智能制造、指挥交通、医疗健康、金融服务等产业实际场景。12月24日(周二)19:00直播为您详细解读该技术如何优化大模型训练流程。报名链接:https://www.wjx.top/vm/huZkHn9.aspx?udsid=787976
* **2024.11.28 📚《FlashRAG-Paddle | 基于 PaddleNLP 的高效开发与评测 RAG 框架》**,为文本更快更好构建准确嵌入表示、加速推理生成速度。PaddleNLP 支持超大 Batch 嵌入表示学习与多硬件高性能推理,涵盖 INT8/INT4量化技术及多种高效注意力机制优化与 TensorCore 深度优化。内置全环节算子融合技术,使得 FlashRAG 推理性能相比 transformers 动态图提升70%以上,结合检索增强知识输出结果更加准确,带来敏捷高效的使用体验。直播时间:12月3日(周二)19:00。报名链接:https://www.wjx.top/vm/eaBa1vA.aspx?udsid=682361
* **2024.08.08 📚《飞桨产业级大语言模型开发利器 PaddleNLP 3.0 重磅发布》**,训压推全流程贯通,主流模型全覆盖。大模型自动并行,千亿模型训推全流程开箱即用。提供产业级高性能精调与对齐解决方案,压缩推理领先,多硬件适配。覆盖产业级智能助手、内容创作、知识问答、关键信息抽取等应用场景。直播时间:8月22日(周四)19:00。报名链接:https://www.wjx.top/vm/Y2f7FFY.aspx?udsid=143844
* **2024.06.27 [PaddleNLP v3.0 Beta](https://github.com/PaddlePaddle/PaddleNLP/releases/tag/v3.0.0-beta0)**:拥抱大模型,体验全升级。统一大模型套件,实现国产计算芯片全流程接入;全面支持飞桨4D 并行配置、高效精调策略、高效对齐算法、高性能推理等大模型产业级应用流程;自研极致收敛的 RsLoRA+算法、自动扩缩容存储机制 Unified Checkpoint 和通用化支持的 FastFFN、FusedQKV 助力大模型训推;主流模型持续支持更新,提供高效解决方案。
* **2024.04.24 [PaddleNLP v2.8](https://github.com/PaddlePaddle/PaddleNLP/releases/tag/v2.8.0)**:自研极致收敛的 RsLoRA+算法,大幅提升 PEFT 训练收敛速度以及训练效果;引入高性能生成加速到 RLHF PPO 算法,打破 PPO 训练中生成速度瓶颈,PPO 训练性能大幅领先。通用化支持 FastFFN、FusedQKV 等多个大模型训练性能优化方式,大模型训练更快、更稳定。
</div></details>
## 特性
- **覆盖多场景的模型库**
- PaddleNLP集成了RNN与Transformer等多种主流模型结构,涵盖从[词向量](./examples/word_embedding/)、[词法分析](./examples/lexical_analysis/)、[命名实体识别](./examples/information_extraction/msra_ner/)、[语义表示](./examples/language_model/)等NLP基础技术,到[文本分类](./examples/text_classification/)、[文本匹配](./examples/text_matching/)、[文本生成](./examples/text_generation/)、[文本图学习](./examples/text_graph/erniesage/)、[信息抽取](./examples/information_extraction)等NLP核心技术。同时针对[机器翻译](./examples/machine_translation/)、[通用对话](./examples/dialogue/)、[阅读理解](./examples/machine_reading_comprehension/)等系统应用提供相应核心组件与预训练模型。更多详细介绍请查看[PaddleNLP应用示例](./examples/)。
### <a href=#多硬件训推一体> 🔧 多硬件训推一体 </a>
支持英伟达 GPU、昆仑 XPU、昇腾 NPU、燧原 GCU 和海光 DCU 等多个硬件的大模型和自然语言理解模型训练和推理,套件接口支持硬件快速切换,大幅降低硬件切换研发成本。
当前支持的自然语言理解模型:[多硬件自然语言理解模型列表](./docs/zh/model_zoo/model_list_multy_device.md)
### <a href=#高效易用的预训练> 🚀 高效易用的预训练 </a>
支持纯数据并行策略、分组参数切片的数据并行策略、张量模型并行策略和流水线模型并行策略的4D 高性能训练,Trainer 支持分布式策略配置化,降低复杂分布式组合带来的使用成本;
[Unified Checkpoint 大模型存储工具](./llm/docs/unified_checkpoint.md)可以使得训练断点支持机器资源动态扩缩容恢复。此外,异步保存,模型存储可加速95%,Checkpoint 压缩,可节省78.5%存储空间。
### <a href=#高效精调> 🤗 高效精调 </a>
精调算法深度结合零填充数据流和 [FlashMask](./llm/docs/flashmask.md) 高性能算子,降低训练无效数据填充和计算,大幅提升精调训练吞吐。
### <a href=#无损压缩和高性能推理> 🎛️ 无损压缩和高性能推理 </a>
大模型套件高性能推理模块内置动态插入和全环节算子融合策略,极大加快并行推理速度。底层实现细节封装化,实现开箱即用的高性能并行推理能力。
## 文档
更多详细文档, 请访问 [PaddleNLP Documentation](https://paddlenlp.readthedocs.io/).
------------------------------------------------------------------------------------------
## 模型支持
* 模型参数已支持 LLaMA 系列、Baichuan 系列、Bloom 系列、ChatGLM 系列、Gemma 系列、Mistral 系列、OPT 系列和 Qwen 系列,详细列表👉【LLM】模型参数支持列表如下:
| 模型系列 | 模型名称 |
|:-------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PP-UIE](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/application/information_extraction) | paddlenlp/PP-UIE-0.5B, paddlenlp/PP-UIE-1.5B, paddlenlp/PP-UIE-7B, paddlenlp/PP-UIE-14B |
| [LLaMA](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/llama) | facebook/llama-7b, facebook/llama-13b, facebook/llama-30b, facebook/llama-65b |
| [Llama2](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/llama) | meta-llama/Llama-2-7b, meta-llama/Llama-2-7b-chat, meta-llama/Llama-2-13b, meta-llama/Llama-2-13b-chat, meta-llama/Llama-2-70b, meta-llama/Llama-2-70b-chat |
| [Llama3](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/llama) | meta-llama/Meta-Llama-3-8B, meta-llama/Meta-Llama-3-8B-Instruct, meta-llama/Meta-Llama-3-70B, meta-llama/Meta-Llama-3-70B-Instruct |
| [Llama3.1](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/llama) | meta-llama/Meta-Llama-3.1-8B, meta-llama/Meta-Llama-3.1-8B-Instruct, meta-llama/Meta-Llama-3.1-70B, meta-llama/Meta-Llama-3.1-70B-Instruct, meta-llama/Meta-Llama-3.1-405B, meta-llama/Meta-Llama-3.1-405B-Instruct, meta-llama/Llama-Guard-3-8B |
| [Llama3.2](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/llama) | meta-llama/Llama-3.2-1B, meta-llama/Llama-3.2-1B-Instruct, meta-llama/Llama-3.2-3B, meta-llama/Llama-3.2-3B-Instruct, meta-llama/Llama-Guard-3-1B |
| [Llama3.3](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/llama) | meta-llama/Llama-3.3-70B-Instruct |
| [Baichuan](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/baichuan) | baichuan-inc/Baichuan-7B, baichuan-inc/Baichuan-13B-Base, baichuan-inc/Baichuan-13B-Chat |
| [Baichuan2](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/baichuan) | baichuan-inc/Baichuan2-7B-Base, baichuan-inc/Baichuan2-7B-Chat, baichuan-inc/Baichuan2-13B-Base, baichuan-inc/Baichuan2-13B-Chat |
| [Bloom](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/bloom) | bigscience/bloom-560m, bigscience/bloom-560m-bf16, bigscience/bloom-1b1, bigscience/bloom-3b, bigscience/bloom-7b1, bigscience/bloomz-560m, bigscience/bloomz-1b1, bigscience/bloomz-3b, bigscience/bloomz-7b1-mt, bigscience/bloomz-7b1-p3, bigscience/bloomz-7b1, bellegroup/belle-7b-2m |
| [ChatGLM](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/chatglm/) | THUDM/chatglm-6b, THUDM/chatglm-6b-v1.1 |
| [ChatGLM2](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/chatglm2) | THUDM/chatglm2-6b |
| [ChatGLM3](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/chatglm2) | THUDM/chatglm3-6b |
| [DeepSeekV2](https://github.com/PaddlePaddle/PaddleNLP/blob/develop/llm/config/deepseek-v2) | deepseek-ai/DeepSeek-V2, deepseek-ai/DeepSeek-V2-Chat, deepseek-ai/DeepSeek-V2-Lite, deepseek-ai/DeepSeek-V2-Lite-Chat, deepseek-ai/DeepSeek-Coder-V2-Base, deepseek-ai/DeepSeek-Coder-V2-Instruct, deepseek-ai/DeepSeek-Coder-V2-Lite-Base, deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct |
| [DeepSeekV3](https://github.com/PaddlePaddle/PaddleNLP/blob/develop/llm/config/deepseek-v2) | deepseek-ai/DeepSeek-V3, deepseek-ai/DeepSeek-V3-Base |
| [DeepSeek-R1](https://github.com/PaddlePaddle/PaddleNLP/blob/develop/llm/config/deepseek-v2) | deepseek-ai/DeepSeek-R1, deepseek-ai/DeepSeek-R1-Zero, deepseek-ai/DeepSeek-R1-Distill-Llama-70B, deepseek-ai/DeepSeek-R1-Distill-Llama-8B, deepseek-ai/DeepSeek-R1-Distill-Qwen-14B, deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B, deepseek-ai/DeepSeek-R1-Distill-Qwen-32B, deepseek-ai/DeepSeek-R1-Distill-Qwen-7B |
| [Gemma](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/gemma) | google/gemma-7b, google/gemma-7b-it, google/gemma-2b, google/gemma-2b-it |
| [Mistral](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/mistral) | mistralai/Mistral-7B-Instruct-v0.3, mistralai/Mistral-7B-v0.1 |
| [Mixtral](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/mixtral) | mistralai/Mixtral-8x7B-Instruct-v0.1 |
| [OPT](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/opt) | facebook/opt-125m, facebook/opt-350m, facebook/opt-1.3b, facebook/opt-2.7b, facebook/opt-6.7b, facebook/opt-13b, facebook/opt-30b, facebook/opt-66b, facebook/opt-iml-1.3b, opt-iml-max-1.3b |
| [Qwen](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/qwen/) | qwen/qwen-7b, qwen/qwen-7b-chat, qwen/qwen-14b, qwen/qwen-14b-chat, qwen/qwen-72b, qwen/qwen-72b-chat, |
| [Qwen1.5](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/qwen/) | Qwen/Qwen1.5-0.5B, Qwen/Qwen1.5-0.5B-Chat, Qwen/Qwen1.5-1.8B, Qwen/Qwen1.5-1.8B-Chat, Qwen/Qwen1.5-4B, Qwen/Qwen1.5-4B-Chat, Qwen/Qwen1.5-7B, Qwen/Qwen1.5-7B-Chat, Qwen/Qwen1.5-14B, Qwen/Qwen1.5-14B-Chat, Qwen/Qwen1.5-32B, Qwen/Qwen1.5-32B-Chat, Qwen/Qwen1.5-72B, Qwen/Qwen1.5-72B-Chat, Qwen/Qwen1.5-110B, Qwen/Qwen1.5-110B-Chat, Qwen/Qwen1.5-MoE-A2.7B, Qwen/Qwen1.5-MoE-A2.7B-Chat |
| [Qwen2](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/qwen/) | Qwen/Qwen2-0.5B, Qwen/Qwen2-0.5B-Instruct, Qwen/Qwen2-1.5B, Qwen/Qwen2-1.5B-Instruct, Qwen/Qwen2-7B, Qwen/Qwen2-7B-Instruct, Qwen/Qwen2-72B, Qwen/Qwen2-72B-Instruct, Qwen/Qwen2-57B-A14B, Qwen/Qwen2-57B-A14B-Instruct |
| [Qwen2-Math](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/qwen/) | Qwen/Qwen2-Math-1.5B, Qwen/Qwen2-Math-1.5B-Instruct, Qwen/Qwen2-Math-7B, Qwen/Qwen2-Math-7B-Instruct, Qwen/Qwen2-Math-72B, Qwen/Qwen2-Math-72B-Instruct, Qwen/Qwen2-Math-RM-72B |
| [Qwen2.5](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/qwen/) | Qwen/Qwen2.5-0.5B, Qwen/Qwen2.5-0.5B-Instruct, Qwen/Qwen2.5-1.5B, Qwen/Qwen2.5-1.5B-Instruct, Qwen/Qwen2.5-3B, Qwen/Qwen2.5-3B-Instruct, Qwen/Qwen2.5-7B, Qwen/Qwen2.5-7B-Instruct, Qwen/Qwen2.5-7B-Instruct-1M, Qwen/Qwen2.5-14B, Qwen/Qwen2.5-14B-Instruct, Qwen/Qwen2.5-14B-Instruct-1M, Qwen/Qwen2.5-32B, Qwen/Qwen2.5-32B-Instruct, Qwen/Qwen2.5-72B, Qwen/Qwen2.5-72B-Instruct |
| [Qwen2.5-Math](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/qwen/) | Qwen/Qwen2.5-Math-1.5B, Qwen/Qwen2.5-Math-1.5B-Instruct, Qwen/Qwen2.5-Math-7B, Qwen/Qwen2.5-Math-7B-Instruct, Qwen/Qwen2.5-Math-72B, Qwen/Qwen2.5-Math-72B-Instruct, Qwen/Qwen2.5-Math-RM-72B |
| [Qwen2.5-Coder](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/qwen/) | Qwen/Qwen2.5-Coder-1.5B, Qwen/Qwen2.5-Coder-1.5B-Instruct, Qwen/Qwen2.5-Coder-7B, Qwen/Qwen2.5-Coder-7B-Instruct |
| [Qwen3](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/qwen/) | Qwen/Qwen3-0.6B, Qwen/Qwen3-1.7B, Qwen/Qwen3-4B, Qwen/Qwen3-8B, Qwen/Qwen3-14B, Qwen/Qwen3-32B, Qwen/Qwen3-30B-A3B, Qwen/Qwen3-235B-A22B, Qwen/Qwen3-0.6B-Base, Qwen/Qwen3-1.7B-Base, Qwen/Qwen3-4B-Base, Qwen/Qwen3-8B-Base, Qwen/Qwen3-14B-Base, Qwen/Qwen3-30B-A3B-Base |
| [QwQ](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/qwen/) | Qwen/QwQ-32B, Qwen/QwQ-32B-Preview |
| [Yuan2](https://github.com/PaddlePaddle/PaddleNLP/tree/develop/llm/config/yuan/) | IEITYuan/Yuan2-2B, IEITYuan/Yuan2-51B, IEITYuan/Yuan2-102B |
* 4D 并行和算子优化已支持 LLaMA 系列、Baichuan 系列、Bloom 系列、ChatGLM 系列、Gemma 系列、Mistral 系列、OPT 系列和 Qwen 系列,【LLM】模型4D 并行和算子支持列表如下:
| 模型名称/并行能力支持 | 数据并行 | 张量模型并行 | | 参数分片并行 | | | 流水线并行 |
|:---------------------:|:--------:|:------------:|:--------:|:------------:|:------:|:------:|:----------:|
| | | 基础能力 | 序列并行 | stage1 | stage2 | stage3 | |
| Llama | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Qwen | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Qwen1.5 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Qwen2 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Mixtral(moe) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
| Mistral | ✅ | ✅ | 🚧 | ✅ | ✅ | ✅ | 🚧 |
| Baichuan | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Baichuan2 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| ChatGLM | ✅ | ✅ | 🚧 | ✅ | ✅ | ✅ | 🚧 |
| ChatGLM2 | ✅ | 🚧 | 🚧 | ✅ | ✅ | ✅ | 🚧 |
| ChatGLM3 | ✅ | 🚧 | 🚧 | ✅ | ✅ | ✅ | 🚧 |
| Bloom | ✅ | ✅ | 🚧 | ✅ | ✅ | ✅ | 🚧 |
| GPT-2/GPT-3 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| OPT | ✅ | ✅ | 🚧 | ✅ | ✅ | ✅ | 🚧 |
| Gemma | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Yuan2 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
* 大模型预训练、精调(包含 SFT、PEFT 技术)、对齐、量化已支持 LLaMA 系列、Baichuan 系列、Bloom 系列、ChatGLM 系列、Mistral 系列、OPT 系列和 Qwen 系列,【LLM】模型预训练、精调、对齐、量化支持列表如下:
- **简洁易用的全流程API**
- 深度兼容飞桨2.0的[高层API](https://www.paddlepaddle.org.cn/documentation/docs/zh/tutorial/quick_start/high_level_api/high_level_api.html)体系,内置可复用的文本建模模块([Embedding](./docs/embeddings.md), [CRF](./paddlenlp/layers/crf.py), [Seq2Vec](./paddlenlp/seq2vec/encoder.py), [Transformer](./docs/transformers.md)),可大幅度减少在数据处理、模型组网、训练与评估、推理部署环节的开发量,提升NLP任务迭代与落地的效率。
- **动静统一的高性能分布式训练**
- 基于飞桨2.0核心框架『动静统一』的特性与领先的混合精度优化策略,结合Fleet分布式训练API,可充分利用GPU集群资源,高效完成大规模预训练模型的分布式训练。
| Model | Pretrain | SFT | LoRA | FlashMask | Prefix Tuning | DPO/SimPO/ORPO/KTO | RLHF | Mergekit | Quantization |
|--------------------------------------------|:--------:|:---:|:----:|:---------:|:-------------:|:------------------:|:----:|:--------:|:------------:|
| [Llama](./llm/config/llama) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [Qwen](./llm/config/qwen) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 | ✅ | 🚧 |
| [Mixtral](./llm/config/mixtral) | ✅ | ✅ | ✅ | 🚧 | 🚧 | ✅ | 🚧 | ✅ | 🚧 |
| [Mistral](./llm/config/mistral) | ✅ | ✅ | ✅ | 🚧 | ✅ | ✅ | 🚧 | ✅ | 🚧 |
| [Baichuan/Baichuan2](./llm/config/llama) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 | ✅ | ✅ |
| [ChatGLM-6B](./llm/config/chatglm) | ✅ | ✅ | ✅ | 🚧 | ✅ | 🚧 | 🚧 | ✅ | ✅ |
| [ChatGLM2/ChatGLM3](./llm/config/chatglm2) | ✅ | ✅ | ✅ | 🚧 | ✅ | ✅ | 🚧 | ✅ | ✅ |
| [Bloom](./llm/config/bloom) | ✅ | ✅ | ✅ | 🚧 | ✅ | 🚧 | 🚧 | ✅ | ✅ |
| [GPT-3](./llm/config/gpt-3) | ✅ | ✅ | 🚧 | 🚧 | 🚧 | 🚧 | 🚧 | ✅ | 🚧 |
| [OPT](./llm/config/opt) | ✅ | ✅ | ✅ | 🚧 | 🚧 | 🚧 | 🚧 | ✅ | 🚧 |
| [Gemma](./llm/config/gemma) | ✅ | ✅ | ✅ | 🚧 | 🚧 | ✅ | 🚧 | ✅ | 🚧 |
| [Yuan](./llm/config/yuan) | ✅ | ✅ | ✅ | 🚧 | 🚧 | ✅ | 🚧 | ✅ | 🚧 |
* [大模型推理](./llm/docs/predict/inference.md)已支持 LLaMA 系列、Qwen 系列、DeepSeek 系列、Mistral 系列、ChatGLM 系列、Bloom 系列和 Baichuan 系列,支持 Weight Only INT8及 INT4推理,支持 WAC(权重、激活、Cache KV)进行 INT8、FP8量化的推理,【LLM】模型推理支持列表如下:
| 模型名称/量化类型支持 | FP16/BF16 | WINT8 | WINT4 | INT8-A8W8 | FP8-A8W8 | INT8-A8W8C8 |
|:------------------------------------------:|:---------:|:-----:|:-----:|:---------:|:--------:|:-----------:|
| [LLaMA](./llm/docs/predict/llama.md) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [Qwen](./llm/docs/predict/qwen.md) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [DeepSeek](./llm/docs/predict/deepseek.md) | ✅ | ✅ | ✅ | 🚧 | ✅ | 🚧 |
| [Qwen-Moe](./llm/docs/predict/qwen.md) | ✅ | ✅ | ✅ | 🚧 | 🚧 | 🚧 |
| [Mixtral](./llm/docs/predict/mixtral.md) | ✅ | ✅ | ✅ | 🚧 | 🚧 | 🚧 |
| ChatGLM | ✅ | ✅ | ✅ | 🚧 | 🚧 | 🚧 |
| Bloom | ✅ | ✅ | ✅ | 🚧 | 🚧 | 🚧 |
| BaiChuan | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 |
## 安装
### 环境依赖
- python >= 3.6
- paddlepaddle >= 2.0.1
* python >= 3.8
* paddlepaddle >= 3.0.0rc1
### pip安装
如果您尚未安装 PaddlePaddle,请参考 [飞桨官网](https://www.paddlepaddle.org.cn/) 进行安装。
```
pip install --upgrade paddlenlp -i https://pypi.org/simple
### pip 安装
```shell
pip install --upgrade paddlenlp==3.0.0b4
```
### 源码安装
或者可通过以下命令安装最新 develop 分支代码:
如果您想体验最新的版本,可以使用以下命令进行源码安装,支持GitHub和Gitee两种方式。
```
pip install --upgrade git+https://github.com/PaddlePaddle/PaddleNLP.git
pip install --upgrade git+https://gitee.com/PaddlePaddle/PaddleNLP.git
```shell
pip install --pre --upgrade paddlenlp -f https://www.paddlepaddle.org.cn/whl/paddlenlp.html
```
更多关于 PaddlePaddle 和 PaddleNLP 安装的详细教程请查看[Installation](./docs/zh/get_started/installation.rst)。
更多关于PaddlePaddle的安装和PaddleNLP安装详细教程请查看[Installation](./docs/get_started/installation.rst)
------------------------------------------------------------------------------------------
## 快速开始
### 数据集快速加载
### 大模型文本生成
PaddleNLP 提供了方便易用的 Auto API,能够快速的加载模型和 Tokenizer。这里以使用 `Qwen/Qwen2-0.5B` 模型做文本生成为例:
```python
from paddlenlp.datasets import load_dataset
train_ds, dev_ds, test_ds = load_dataset("chnsenticorp", splits=["train", "dev", "test"])
from paddlenlp.transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-0.5B")
# if using CPU, please change float16 to float32
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2-0.5B", dtype="float16")
input_features = tokenizer("你好!请自我介绍一下。", return_tensors="pd")
outputs = model.generate(**input_features, max_new_tokens=128)
print(tokenizer.batch_decode(outputs[0], skip_special_tokens=True))
# ['我是一个AI语言模型,我可以回答各种问题,包括但不限于:天气、新闻、历史、文化、科学、教育、娱乐等。请问您有什么需要了解的吗?']
```
可参考[Dataset文档](./docs/datasets.md)查看更多数据集。
### 大模型预训练
### 一键加载预训练中文词向量
```shell
git clone https://github.com/PaddlePaddle/PaddleNLP.git && cd PaddleNLP # 如已clone或下载PaddleNLP可跳过
mkdir -p llm/data && cd llm/data
wget https://bj.bcebos.com/paddlenlp/models/transformers/llama/data/llama_openwebtext_100k.bin
wget https://bj.bcebos.com/paddlenlp/models/transformers/llama/data/llama_openwebtext_100k.idx
cd .. # change folder to PaddleNLP/llm
# 如需使用use_fused_rms_norm=true,需要前往slm/model_zoo/gpt-3/external_ops安装fused_ln
python -u run_pretrain.py ./config/qwen/pretrain_argument_0p5b.json
```
### 大模型 SFT 精调
```shell
git clone https://github.com/PaddlePaddle/PaddleNLP.git && cd PaddleNLP # 如已clone或下载PaddleNLP可跳过
mkdir -p llm/data && cd llm/data
wget https://bj.bcebos.com/paddlenlp/datasets/examples/AdvertiseGen.tar.gz && tar -zxvf AdvertiseGen.tar.gz
cd .. # change folder to PaddleNLP/llm
python -u run_finetune.py ./config/qwen/sft_argument_0p5b.json
```
更多大模型全流程步骤,请参考[飞桨大模型套件](./llm)介绍。
另外我们还提供了快速微调方式, 无需 clone 源代码:
```python
from paddlenlp.embeddings import TokenEmbedding
from paddlenlp.trl import SFTConfig, SFTTrainer
from datasets import load_dataset
wordemb = TokenEmbedding("w2v.baidu_encyclopedia.target.word-word.dim300")
print(wordemb.cosine_sim("国王", "王后"))
>>> 0.63395125
wordemb.cosine_sim("艺术", "火车")
>>> 0.14792643
dataset = load_dataset("ZHUI/alpaca_demo", split="train")
training_args = SFTConfig(output_dir="Qwen/Qwen2.5-0.5B-SFT", device="gpu")
trainer = SFTTrainer(
args=training_args,
model="Qwen/Qwen2.5-0.5B-Instruct",
train_dataset=dataset,
)
trainer.train()
```
内置50+中文词向量,更多使用方法请参考[Embedding文档](./examples/word_embedding/README.md)。
更多 PaddleNLP 内容可参考:
* [精选模型库](./slm/model_zoo),包含优质预训练模型的端到端全流程使用。
* [多场景示例](./slm/examples),了解如何使用 PaddleNLP 解决 NLP 多种技术问题,包含基础技术、系统应用与拓展应用。
* [交互式教程](https://aistudio.baidu.com/aistudio/personalcenter/thirdview/574995),在🆓免费算力平台 AI Studio 上快速学习 PaddleNLP。
### 一键加载高质量中文预训练模型
------------------------------------------------------------------------------------------
```python
from paddlenlp.transformers import ErnieModel, BertModel, RobertaModel, ElectraModel, GPTForPretraining
## 社区交流
ernie = ErnieModel.from_pretrained('ernie-1.0')
bert = BertModel.from_pretrained('bert-wwm-chinese')
roberta = RobertaModel.from_pretrained('roberta-wwm-ext')
electra = ElectraModel.from_pretrained('chinese-electra-small')
gpt = GPTForPretraining.from_pretrained('gpt-cpm-large-cn')
```
### 便捷获取文本特征
```python
import paddle
from paddlenlp.transformers import ErnieTokenizer, ErnieModel
tokenizer = ErnieTokenizer.from_pretrained('ernie-1.0')
model = ErnieModel.from_pretrained('ernie-1.0')
text = tokenizer('自然语言处理')
pooled_output, sequence_output = model(input_ids=paddle.to_tensor([text['input_ids']]))
```
请参考[Transformer API文档](./docs/transformers.md)查看目前支持的预训练模型。
## 模型库及其应用
PaddleNLP模型库整体介绍请参考文档[PaddleNLP Model Zoo](./docs/model_zoo.md)。
模型应用场景介绍请参考[PaddleNLP Examples](./examples/)。
- [词向量](./examples/word_embedding/)
- [词法分析](./examples/lexical_analysis/)
- [命名实体识别](./examples/information_extraction/msra_ner/)
- [语言模型](./examples/language_model/)
- [文本分类](./examples/text_classification/)
- [文本生成](./examples/text_generation/)
- [语义匹配](./examples/text_matching/)
- [文本图学习](./examples/text_graph/erniesage/)
- [信息抽取](./examples/information_extraction/)
- [通用对话](./examples/dialogue/)
- [机器翻译](./examples/machine_translation/)
- [阅读理解](./examples/machine_reading_comprehension/)
## 进阶应用
- [模型压缩](./examples/model_compression/)
## API 使用文档
- [Transformer API](./docs/transformers.md)
* 基于Transformer结构相关的预训练模型API,包含ERNIE, BERT, RoBERTa, Electra等主流经典结构和下游任务。
- [Data API](./docs/data.md)
* 文本数据处理Pipeline的相关API说明。
- [Dataset API](./docs/datasets.md)
* 数据集相关API,包含自定义数据集,数据集贡献与数据集快速加载等功能说明。
- [Embedding API](./docs/embeddings.md)
* 词向量相关API,支持一键快速加载包预训练的中文词向量,VisulDL高维可视化等功能说明。
- [Metrics API](./docs/metrics.md)
* 针对NLP场景的评估指标说明,与飞桨2.0框架高层API兼容。
## 交互式Notebook教程
- [使用Seq2Vec模块进行句子情感分类](https://aistudio.baidu.com/aistudio/projectdetail/1283423)
- [如何通过预训练模型Fine-tune下游任务](https://aistudio.baidu.com/aistudio/projectdetail/1294333)
- [使用BiGRU-CRF模型完成快递单信息抽取](https://aistudio.baidu.com/aistudio/projectdetail/1317771)
- [使用预训练模型ERNIE优化快递单信息抽取](https://aistudio.baidu.com/aistudio/projectdetail/1329361)
- [使用Seq2Seq模型完成自动对联](https://aistudio.baidu.com/aistudio/projectdetail/1321118)
- [使用预训练模型ERNIE-GEN实现智能写诗](https://aistudio.baidu.com/aistudio/projectdetail/1339888)
- [使用TCN网络完成新冠疫情病例数预测](https://aistudio.baidu.com/aistudio/projectdetail/1290873)
更多教程参见[PaddleNLP on AI Studio](https://aistudio.baidu.com/aistudio/personalcenter/thirdview/574995)。
## 最近更新(自2.0.0版本)
### paddlenlp文本领域API
- 修复Windows CPU环境下的import问题。
## 社区贡献与技术交流
### 特殊兴趣小组
- 欢迎您加入PaddleNLP的SIG社区,贡献优秀的模型实现、公开数据集、教程与案例、外围小工具。
### QQ
- 现在就加入PaddleNLP的QQ技术交流群,一起交流NLP技术吧!⬇️
* 微信扫描二维码并填写问卷,即可加入交流群与众多社区开发者以及官方团队深度交流.
<div align="center">
<img src="./docs/imgs/qq.png" width="200" height="200" />
</div>
<img src="https://github.com/user-attachments/assets/3a58cc9f-69c7-4ccb-b6f5-73e966b8051a" width="150" height="150" />
</div>
### Slack
- 欢迎加入[PaddleNLP Slack channel](https://paddlenlp.slack.com/)与我们的开发者进行技术交流。
## Citation
如果 PaddleNLP 对您的研究有帮助,欢迎引用
```bibtex
@misc{=paddlenlp,
title={PaddleNLP: An Easy-to-use and High Performance NLP Library},
author={PaddleNLP Contributors},
howpublished = {\url{https://github.com/PaddlePaddle/PaddleNLP}},
year={2021}
}
```
## Acknowledge
我们借鉴了 Hugging Face 的[Transformers](https://github.com/huggingface/transformers)🤗关于预训练模型使用的优秀设计,在此对 Hugging Face 作者及其开源社区表示感谢。
## License
PaddleNLP遵循[Apache-2.0开源协议](./LICENSE)。
PaddleNLP 遵循[Apache-2.0开源协议](./LICENSE)。

View File

@@ -1,171 +1,168 @@
English | [简体中文](./README.md)
[简体中文🀄](./README.md) | **English🌎**
<p align="center">
<img src="./docs/imgs/paddlenlp.png" width="520" height ="100" />
<img src="https://user-images.githubusercontent.com/1371212/175816733-8ec25eb0-9af3-4380-9218-27c154518258.png" align="middle" width="500" />
</p>
---------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
[![PyPI - PaddleNLP Version](https://img.shields.io/pypi/v/paddlenlp.svg?label=pip&logo=PyPI&logoColor=white)](https://pypi.org/project/paddlenlp/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/paddlenlp)](https://pypi.org/project/paddlenlp/)
[![PyPI Status](https://pepy.tech/badge/paddlenlp/month)](https://pepy.tech/project/paddlenlp)
![support os](https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-yellow.svg)
![GitHub](https://img.shields.io/github/license/paddlepaddle/paddlenlp)
<p align="center">
<a href="https://paddlenlp.readthedocs.io/en/latest/?badge=latest"><img src="https://readthedocs.org/projects/paddlenlp/badge/?version=latest">
<a href="https://github.com/PaddlePaddle/PaddleNLP/releases"><img src="https://img.shields.io/github/v/release/PaddlePaddle/PaddleNLP?color=ffa"></a>
<a href=""><img src="https://img.shields.io/badge/python-3.7+-aff.svg"></a>
<a href=""><img src="https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-pink.svg"></a>
<a href="https://github.com/PaddlePaddle/PaddleNLP/graphs/contributors"><img src="https://img.shields.io/github/contributors/PaddlePaddle/PaddleNLP?color=9ea"></a>
<a href="https://github.com/PaddlePaddle/PaddleNLP/commits"><img src="https://img.shields.io/github/commit-activity/m/PaddlePaddle/PaddleNLP?color=3af"></a>
<a href="https://pypi.org/project/paddlenlp/"><img src="https://img.shields.io/pypi/dm/paddlenlp?color=9cf"></a>
<a href="https://github.com/PaddlePaddle/PaddleNLP/issues"><img src="https://img.shields.io/github/issues/PaddlePaddle/PaddleNLP?color=9cc"></a>
<a href="https://github.com/PaddlePaddle/PaddleNLP/stargazers"><img src="https://img.shields.io/github/stars/PaddlePaddle/PaddleNLP?color=ccf"></a>
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache%202-dfd.svg"></a>
</p>
## Introduction
<h4 align="center">
<a href=#Features> Features </a> |
<a href=#Support-Models> Supported Models </a> |
<a href=#Installation> Installation </a> |
<a href=#Quick-start> Quick Start </a> |
<a href=#community> Community </a>
</h4>
PaddleNLP aims to accelerate NLP applications through powerful model zoo, easy-to-use API and high performance distributed training. It's also the NLP best practice for PaddlePaddle 2.0 API system.
**PaddleNLP** is a Large Language Model (LLM) development suite based on the PaddlePaddle deep learning framework, supporting efficient large model training, lossless compression, and high-performance inference on various hardware devices. With its **simplicity** and **ultimate performance**, PaddleNLP is dedicated to helping developers achieve efficient industrial applications of large models.
## News 📢
* **2024.06.27 [PaddleNLP v3.0 Beta](https://github.com/PaddlePaddle/PaddleNLP/releases/tag/v3.0.0-beta0)**:Embrace large models and experience a complete upgrade. With a unified large model suite, we achieve full-process access to domestically produced computing chips. We fully support industrial-level application processes for large models, such as PaddlePaddle's 4D parallel configuration, efficient fine-tuning strategies, efficient alignment algorithms, and high-performance reasoning. Our developed RsLoRA+ algorithm, full checkpoint storage mechanism Unified Checkpoint, and generalized support for FastFNN and FusedQKV all contribute to the training and inference of large models. We continuously support updates to mainstream models for providing efficient solutions.
* **2024.04.24 [PaddleNLP v2.8](https://github.com/PaddlePaddle/PaddleNLP/releases/tag/v2.8.0)**:Our self-developed RsLoRA+ algorithm with extreme convergence significantly improves the convergence speed and training effectiveness of PEFT training. By introducing high-performance generation acceleration into the RLHF PPO algorithm, we have broken through the generation speed bottleneck in PPO training, achieving a significant lead in PPO training performance. We generally support multiple large model training performance optimization methods such as FastFFN and FusedQKV, making large model training faster and more stable.
## Features
* **Powerful Model Zoo for Rich Senario**
- Our Model Zoo covers mainstream NLP applications, including Lexical Analysis, Text Classification, Text Generation, Text Matching, Text Graph, Information Extraction, Machine Translation, General Dialogue and Question Answering etc.
### <a href=#Integrated training and inference on multiple hardware platforms> 🔧 Integrated training and inference on multiple hardware platforms </a>
* **Easy-to-Use and End-to-End API**
- The API is fully integrated with PaddlePaddle 2.0 high-level API system. It minimizes the number of user actions required for common use cases like data loading, text pre-processing, training and evaluation, which enables you to deal with text problems more productively.
Our development suit supports large model training and inference on multiple hardware platforms, including NVIDIA GPUs, Kunlun XPUs, Ascend NPUs, Enflame GCUs, and Hygon DCUs. The toolkit's interface allows for quick hardware switching, significantly reducing research and development costs associated with hardware transitions.
* **High Performance and Distributed Training**
- We provide a highly optimized ditributed training implementation for BERT with Fleet API, and mixed precision training strategy based on PaddlePaddle 2.0, it can fully utilize GPU clusters for large-scale model pre-training.
### <a href=Efficient and easy-to-use pre-training> 🚀 Efficient and easy-to-use pre-training </a>
We support 4D high-performance training with data parallelism, sharding parallelism, tensor parallelism, and pipeline parallelism. The Trainer supports configurable distributed strategies, reducing the cost associated with complex distributed combinations. The Unified Checkpoint large model storage format supports dynamic scaling of model parameter distribution during training, thereby reducing the migration cost caused by hardware switching.
### <a href=#Efficient fine-tuning> 🤗 Efficient fine-tuning </a>
The fine-tuning algorithms are deeply integrated with zero-padding data streams and high-performance FlashMask operators, reducing invalid data padding and computation during training, and significantly improving the throughput of fine-tuning training.
### <a href=#Lossless compression and high-performance inference> 🎛️ Lossless compression and high-performance inference </a>
The high-performance inference module of the large model toolkit incorporates dynamic insertion and operator fusion strategies throughout the entire process, greatly accelerating parallel inference speed. The underlying implementation details are encapsulated, enabling out-of-the-box high-performance parallel inference capabilities.
## Documentation
For detailed documentation, visit the [PaddleNLP Documentation](https://paddlenlp.readthedocs.io/).
------------------------------------------------------------------------------------------
## Support Models
Detailed list 👉 [Supported Model List](https://github.com/PaddlePaddle/PaddleNLP/issues/8663)
## Installation
### Prerequisites
* python >= 3.6
* paddlepaddle >= 2.0.1
* python >= 3.8
* paddlepaddle >= 3.0.0b0
More information about PaddlePaddle installation please refer to [PaddlePaddle Install](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/conda/linux-conda.html)
### Pip Installation
### PIP Installation
```
pip install --upgrade paddlenlp -i https://pypi.org/simple
```shell
pip install --upgrade paddlenlp==3.0.0b3
```
### Install from Source
or you can install the latest develop branch code with the following command:
```shell
pip install --pre --upgrade paddlenlp -f https://www.paddlepaddle.org.cn/whl/paddlenlp.html
```
pip install --upgrade git+https://github.com/PaddlePaddle/PaddleNLP.git
pip install --upgrade git+https://gitee.com/PaddlePaddle/PaddleNLP.git
```
More information about PaddlePaddle installation please refer to [PaddlePaddle's Website](https://www.paddlepaddle.org.cn).
------------------------------------------------------------------------------------------
## Quick Start
### Quick Dataset Loading
### Text generation with large language model
PaddleNLP provides a convenient and easy-to-use Auto API, which can quickly load models and Tokenizers. Here, we use the `Qwen/Qwen2-0.5B` large model as an example for text generation:
```python
from paddlenlp.datasets import load_dataset
train_ds, dev_ds, test_ds = load_dataset("chnsenticorp", splits=["train", "dev", "test"])
>>> from paddlenlp.transformers import AutoTokenizer, AutoModelForCausalLM
>>> tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-0.5B")
>>> model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2-0.5B", dtype="float16")
>>> input_features = tokenizer("你好!请自我介绍一下。", return_tensors="pd")
>>> outputs = model.generate(**input_features, max_length=128)
>>> print(tokenizer.batch_decode(outputs[0], skip_special_tokens=True))
['我是一个AI语言模型,我可以回答各种问题,包括但不限于:天气、新闻、历史、文化、科学、教育、娱乐等。请问您有什么需要了解的吗?']
```
For more dataset API usage please refer to [Dataset API](./docs/datasets.md).
### Pre-training for large language model
### Pre-trained Text Embedding Loading
```python
from paddlenlp.embeddings import TokenEmbedding
wordemb = TokenEmbedding("fasttext.wiki-news.target.word-word.dim300.en")
wordemb.cosine_sim("king", "queen")
>>> 0.77053076
wordemb.cosine_sim("apple", "rail")
>>> 0.29207364
```shell
git clone https://github.com/PaddlePaddle/PaddleNLP.git && cd PaddleNLP # if cloned or downloaded, can skip this step
mkdir -p llm/data && cd llm/data
wget https://bj.bcebos.com/paddlenlp/models/transformers/llama/data/llama_openwebtext_100k.bin
wget https://bj.bcebos.com/paddlenlp/models/transformers/llama/data/llama_openwebtext_100k.idx
cd .. # change folder to PaddleNLP/llm
python -u -m paddle.distributed.launch --gpus "0,1,2,3,4,5,6,7" run_pretrain.py ./config/llama/pretrain_argument.json
```
For more TokenEmbedding usage, please refer to [Embedding API](./docs/embeddings.md)
### SFT finetuning forlarge language model
### Rich Chinese Pre-trained Models
```python
from paddlenlp.transformers import ErnieModel, BertModel, RobertaModel, ElectraModel, GPTForPretraining
ernie = ErnieModel.from_pretrained('ernie-1.0')
bert = BertModel.from_pretrained('bert-wwm-chinese')
roberta = RobertaModel.from_pretrained('roberta-wwm-ext')
electra = ElectraModel.from_pretrained('chinese-electra-small')
gpt = GPTForPretraining.from_pretrained('gpt-cpm-large-cn')
```shell
git clone https://github.com/PaddlePaddle/PaddleNLP.git && cd PaddleNLP # if cloned or downloaded, can skip this step
mkdir -p llm/data && cd llm/data
wget https://bj.bcebos.com/paddlenlp/datasets/examples/AdvertiseGen.tar.gz && tar -zxvf AdvertiseGen.tar.gz
cd .. # change folder to PaddleNLP/llm
python -u -m paddle.distributed.launch --gpus "0,1,2,3,4,5,6,7" run_finetune.py ./config/llama/sft_argument.json
```
For more pretrained model selection, please refer to [Transformer API](./docs/transformers.md)
For more steps in the entire large model process, please refer to the[Large Model Full-Process Suite](./llm).
### Extract Feature Through Pre-trained Model
For more PaddleNLP content, please refer to:
```python
import paddle
from paddlenlp.transformers import ErnieTokenizer, ErnieModel
tokenizer = ErnieTokenizer.from_pretrained('ernie-1.0')
model = ErnieModel.from_pretrained('ernie-1.0')
text = tokenizer('自然语言处理')
pooled_output, sequence_output = model.forward(input_ids=paddle.to_tensor([text['input_ids']]))
```
## Model Zoo and Applications
For model zoo introduction please refer to[PaddleNLP Model Zoo](./docs/model_zoo.md). As for applicaiton senario please refer to [PaddleNLP Examples](./examples/)。
- [Word Embedding](./examples/word_embedding/)
- [Lexical Analysis](./examples/lexical_analysis/)
- [Named Entity Recognition](./examples/information_extraction/msra_ner/)
- [Language Model](./examples/language_model/)
- [Text Classification](./examples/text_classification/)
- [Text Gneeration](./examples/text_generation/)
- [Semantic Maching](./examples/text_matching/)
- [Text Graph](./examples/text_graph/erniesage/)
- [Information Extraction](./examples/information_extraction/)
- [General Dialogue](./examples/dialogue/)
- [Machine Translation](./examples/machine_translation/)
- [Machine Readeng Comprehension](./examples/machine_reading_comprehension/)
## Advanced Application
- [Model Compression](./examples/model_compression/)
## API Usage
- [Transformer API](./docs/transformers.md)
- [Data API](./docs/data.md)
- [Dataset API](./docs/datasets.md)
- [Embedding API](./docs/embeddings.md)
- [Metrics API](./docs/metrics.md)
## Tutorials
Please refer to our official AI Studio account for more interactive tutorials: [PaddleNLP on AI Studio](https://aistudio.baidu.com/aistudio/personalcenter/thirdview/574995)
* [What's Seq2Vec?](https://aistudio.baidu.com/aistudio/projectdetail/1283423) shows how to use simple API to finish LSTM model and solve sentiment analysis task.
* [Sentiment Analysis with ERNIE](https://aistudio.baidu.com/aistudio/projectdetail/1294333) shows how to exploit the pretrained ERNIE to solve sentiment analysis problem.
* [Waybill Information Extraction with BiGRU-CRF Model](https://aistudio.baidu.com/aistudio/projectdetail/1317771) shows how to make use of Bi-GRU plus CRF to finish information extraction task.
* [Waybill Information Extraction with ERNIE](https://aistudio.baidu.com/aistudio/projectdetail/1329361) shows how to use ERNIE, the Chinese pre-trained model improve information extraction performance.
* [Use TCN Model to predict COVID-19 confirmed cases](https://aistudio.baidu.com/aistudio/projectdetail/1290873)
* [Model Library](./slm/model_zoo),which includes end-to-end usage of high-quality pre-trained models.
* [Multi-scenario Examples](./slm/examples),to understand how to use PaddleNLP to solve various NLP technical problems, including basic techniques, system applications, and extended applications.
* [Interactive Tutorial](https://aistudio.baidu.com/aistudio/personalcenter/thirdview/574995),to quickly learn PaddleNLP on the free computing platform AI Studio.
------------------------------------------------------------------------------------------
## Community
### Special Interest Group(SIG)
Welcome to join [PaddleNLP SIG](https://iwenjuan.baidu.com/?code=bkypg8) for contribution, eg. Dataset, Models and Toolkit.
### Slack
To connect with other users and contributors, welcome to join our [Slack channel](https://paddlenlp.slack.com/).
### QQ
Join our QQ Technical Group for technical exchange right now! ⬇️
### WeChat
Scan the QR code below with your Wechat⬇️. You can access to official technical exchange group. Look forward to your participation.
<div align="center">
<img src="./docs/imgs/qq.png" width="200" height="200" />
<img src="https://github.com/user-attachments/assets/3a58cc9f-69c7-4ccb-b6f5-73e966b8051a" width="150" height="150" />
</div>
## Citation
If you find PaddleNLP useful in your research, please consider citing
```bibtext
@misc{=paddlenlp,
title={PaddleNLP: An Easy-to-use and High Performance NLP Library},
author={PaddleNLP Contributors},
howpublished = {\url{https://github.com/PaddlePaddle/PaddleNLP}},
year={2021}
}
```
## Acknowledge
We have borrowed from Hugging Face's [Transformers](https://github.com/huggingface/transformers)🤗 excellent design on pretrained models usage, and we would like to express our gratitude to the authors of Hugging Face and its open source community.
## License
PaddleNLP is provided under the [Apache-2.0 License](./LICENSE).

28
csrc/README.md Normal file
View File

@@ -0,0 +1,28 @@
# PaddleNLP 大模型高性能自定义推理算子
此文档介绍如何编译安装 PaddleNLP 大模型高性能自定义推理算子的安装教程。
使用这些高性能算子,可以大幅提升大模型推理速度。
大模型推理相关教程详见[此处](https://github.com/PaddlePaddle/PaddleNLP/blob/develop/llm/README.md#6-%E6%8E%A8%E7%90%86)。
## 安装 C++ 依赖
```shell
pip install -r requirements.txt
```
## 编译 Cuda 算子
```shell
python setup_cuda.py install
```
### FP8 GEMM 自动调优
确保 `cutlass` 库已经安装,然后执行以下命令进行自动调优。
- 对于89架构的 GPU,CUDA 版本至少为12.4
- 对于90架构的 GPU,CUDA 版本至少为12.0
```shell
cd tools
sh tune_fp8_gemm.sh
```

View File

@@ -0,0 +1,619 @@
From e479452fdedfd1f0a54cc1134966f2235df14874 Mon Sep 17 00:00:00 2001
From: bukejiyu <395822456@qq.com>
Date: Wed, 21 Aug 2024 22:01:52 +0800
Subject: [PATCH] fp16_bf16
---
cmake/mkl.cmake | 2 +-
cmake/mklml.cmake | 2 +-
cmake/onednn.cmake | 1 +
cmake/xdnn.cmake | 2 +-
include/dtype.h | 5 +
include/layers_decoder.h | 21 +--
src/layers/attention.h | 9 +-
src/layers/decoder_layer.cpp | 256 ++++++++++++++++++++++++-------
src/layers/decoder_layer.h | 4 +-
tests/ut/layers_decoder_test.cpp | 52 ++++---
10 files changed, 255 insertions(+), 99 deletions(-)
diff --git a/cmake/mkl.cmake b/cmake/mkl.cmake
index 0ef2e66..92c6d06 100644
--- a/cmake/mkl.cmake
+++ b/cmake/mkl.cmake
@@ -25,7 +25,7 @@ set(MKL_3rdparty_DIR "${CMAKE_SOURCE_DIR}/3rdparty/mkl")
if(NOT EXISTS ${MKL_3rdparty_DIR})
find_package(Python COMPONENTS Interpreter Development)
execute_process(COMMAND ${Python_EXECUTABLE} -m pip install --force-reinstall
- --prefix=${MKL_3rdparty_DIR} mkl-static==2024.0.0 mkl-include==2024.0.0
+ --prefix=${MKL_3rdparty_DIR} mkl-static==2024.0.0 mkl-include==2024.0.0 -i https://mirrors.aliyun.com/pypi/simple
RESULT_VARIABLE EXIT_CODE)
if(NOT ${EXIT_CODE} EQUAL 0)
diff --git a/cmake/mklml.cmake b/cmake/mklml.cmake
index 4baec46..d89ce46 100644
--- a/cmake/mklml.cmake
+++ b/cmake/mklml.cmake
@@ -28,7 +28,7 @@ include(ExternalProject)
ExternalProject_Add(mklml
URL https://github.com/oneapi-src/oneDNN/releases/download/v0.21/mklml_lnx_2019.0.5.20190502.tgz
URL_HASH MD5=dfcea335652dbf3518e1d02cab2cea97
- TIMEOUT 60
+ TIMEOUT 360
SOURCE_DIR ${CMAKE_SOURCE_DIR}/3rdparty/mklml
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
diff --git a/cmake/onednn.cmake b/cmake/onednn.cmake
index 8efabd1..bfa558a 100644
--- a/cmake/onednn.cmake
+++ b/cmake/onednn.cmake
@@ -36,6 +36,7 @@ if(NOT EXISTS ${ONEDNN_3rdparty_DIR})
ExternalProject_Add(onednn
GIT_REPOSITORY https://github.com/oneapi-src/oneDNN.git
GIT_TAG v3.5
+ TIMEOUT 360
SOURCE_DIR ${ONEDNN_3rdparty_DIR}
BINARY_DIR ${ONEDNN_3rdparty_DIR}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E make_directory "build" && ${CMAKE_COMMAND} -E chdir "build" ${CMAKE_COMMAND} ${ONEDNN_BUILD_OPTIONS} ..
diff --git a/cmake/xdnn.cmake b/cmake/xdnn.cmake
index 7c0e051..721bfe3 100644
--- a/cmake/xdnn.cmake
+++ b/cmake/xdnn.cmake
@@ -28,7 +28,7 @@ include(ExternalProject)
ExternalProject_Add(xdnn_lib
URL https://github.com/intel/xFasterTransformer/releases/download/IntrinsicGemm/xdnn_v1.5.2.tar.gz
URL_HASH MD5=884f2e1e2c846ff19f33c889681f8dc2
- TIMEOUT 120
+ TIMEOUT 360
SOURCE_DIR ${CMAKE_SOURCE_DIR}/3rdparty/xdnn
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
diff --git a/include/dtype.h b/include/dtype.h
index de72bce..9e0a448 100644
--- a/include/dtype.h
+++ b/include/dtype.h
@@ -31,6 +31,7 @@ enum DataType {
w8a8_int8,
w8a8_int4,
w8a8_nf4,
+ fp16_int8,
unknown,
};
@@ -51,4 +52,8 @@ enum ActivationType {
SILU,
};
+enum RopeType {
+ LLAMA_ROPE = 0,
+};
+
} // namespace xft
diff --git a/include/layers_decoder.h b/include/layers_decoder.h
index 34f6aa5..a30e34d 100644
--- a/include/layers_decoder.h
+++ b/include/layers_decoder.h
@@ -17,13 +17,14 @@
#include "dtype.h"
namespace xft {
-
-void invokeLayerLLaMA(DataType dt, ActivationType at, NormType nt, int batchSize, int inputSeqLen, int attHeadDim,
- int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed, int pastSeqLen, int currentSeqLen, int step,
- int hiddenSize, int intermediateSize, void *output, int outputStride, const void *input, int inputStride,
- const float *ln1Gamma, const float *ln1Beta, const void *queryWeight, const void *keyWeight,
- const void *valueWeight, const void *attnOutWeight, const float *ln2Gamma, const float *ln2Beta,
- const void *gateWeight, const void *upWeight, const void *downWeight, const float *queryBias = nullptr,
- const float *keyBias = nullptr, const float *valueBias = nullptr, const float *attnOutBias = nullptr);
-
-} // namespace xft
\ No newline at end of file
+void invokeLayerLLaMA(DataType dt, DataType kvcdt, RopeType rt, ActivationType at, NormType nt, int batchSize,
+ int inputSeqLen, int attHeadDim, int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed,
+ int pastSeqLen, int currentSeqLen, int step, int hiddenSize, int intermediateSize, void *output,
+ int outputStride, const void *input, int inputStride, const float *ln1Gamma, const float *ln1Beta,
+ const void *queryWeight, const void *keyWeight, const void *valueWeight, const void *attnOutWeight,
+ const float *ln2Gamma, const float *ln2Beta, const void *gateWeight, const void *upWeight,
+ const void *downWeight, const float *queryBias = nullptr, const float *keyBias = nullptr,
+ const float *valueBias = nullptr, const float *attnOutBias = nullptr, const void *myqkvWeight = nullptr,
+ const float *gateBias = nullptr, const float *upBias = nullptr, const float *downBias = nullptr,
+ const float *myqkvBias = nullptr);
+} // namespace xft
diff --git a/src/layers/attention.h b/src/layers/attention.h
index 092b3d6..b438837 100644
--- a/src/layers/attention.h
+++ b/src/layers/attention.h
@@ -84,7 +84,8 @@ public:
const float *queryBias, const OriWeiT *keyWeight, const float *keyScale, const float *keyZero,
const float *keyBias, const OriWeiT *valueWeight, const float *valueScale, const float *valueZero,
const float *valueBias, const OriWeiT *attnOutWeight, const float *attnOutScale, const float *attnOutZero,
- const float *attnOutBias, bool doLNorm, const float *gamma1, const float *beta1, bool trans = true) {
+ const float *attnOutBias, bool doLNorm, const float *gamma1, const float *beta1, bool trans = true,
+ const OriWeiT *myqkvWeight = nullptr) {
int hiddenSize = ctx->hiddenSize;
int headSize = ctx->attHeadSize;
@@ -107,7 +108,10 @@ public:
valueWeight + this->startKVHead * headSize * hiddenSize / sizeFactor,
hiddenSize * kvResponsibleCols * sizeof(OriWeiT) / sizeFactor);
} else {
- int qkvStride = (ctx->attHeadNum + ctx->kvHeadNum + ctx->kvHeadNum) * ctx->attHeadSize;
+ if (myqkvWeight != nullptr) {
+ memcpy(concatBuf, myqkvWeight, hiddenSize * responsibleCols * sizeof(OriWeiT) / sizeFactor);
+ } else {
+ int qkvStride = (ctx->attHeadNum + ctx->kvHeadNum + ctx->kvHeadNum) * ctx->attHeadSize;
#pragma omp parallel for
for (int i = 0; i < hiddenSize; ++i) {
memcpy(concatBuf + i * responsibleCols / sizeFactor,
@@ -120,6 +124,7 @@ public:
+ kvResponsibleCols / sizeFactor,
valueWeight + i * qkvStride / sizeFactor + this->startKVHead * headSize / sizeFactor,
kvResponsibleCols * sizeof(OriWeiT) / sizeFactor);
+ }
}
}
float *concatScale = nullptr;
diff --git a/src/layers/decoder_layer.cpp b/src/layers/decoder_layer.cpp
index 02f13cb..0f30f21 100644
--- a/src/layers/decoder_layer.cpp
+++ b/src/layers/decoder_layer.cpp
@@ -21,19 +21,21 @@
#include "layers_mlp.h"
#include "mlp_llama.h"
#include "rms_norm.h"
+#include "numa_allocator.h"
#include <unordered_map>
namespace xft {
-template <typename DataT, typename NormT>
+template <typename DataT, typename KVCacheT, typename RopeT, typename NormT>
void LayerLLaMAImpl(DataType dt, ActivationType at, NormType nt, int batchSize, int inputSeqLen, int attHeadDim,
int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed, int pastSeqLen, int currentSeqLen, int step,
int hiddenSize, int intermediateSize, void *output, int outputStride, const void *input, int inputStride,
const float *ln1Gamma, const float *ln1Beta, const void *queryWeight, const void *keyWeight,
const void *valueWeight, const void *attnOutWeight, const float *ln2Gamma, const float *ln2Beta,
const void *gateWeight, const void *upWeight, const void *downWeight, const float *queryBias,
- const float *keyBias, const float *valueBias, const float *attnOutBias) {
+ const float *keyBias, const float *valueBias, const float *attnOutBias,
+ MMHelper *mmHelper, DecoderContext *ctx, KVCacheManager<KVCacheT> *kvCacheMgr,const void *myqkvWeight = nullptr) {
// TODO: will deprecate attention mask in future, so need to change this
auto prepareAttnMask = [&](DecoderContext *ctx, int step) {
@@ -83,67 +85,46 @@ void LayerLLaMAImpl(DataType dt, ActivationType at, NormType nt, int batchSize,
return mask;
};
- using DECODER = Decoder<Attention<DataT, LlamaRotaryEmbedding, NormT>, LlamaMLP<DataT>>;
- static std::unordered_map<std::string, DECODER *> llama_layer_hub;
- static MMHelper *mmHelper;
- static DecoderContext *ctx;
- static KVCacheManager<float16_t> *kvCacheMgr;
-
- std::string actType;
- if (at == ActivationType::SILU)
- actType = "silu";
- else if (at == ActivationType::RELU)
- actType = "relu";
- else if (at == ActivationType::GELU)
- actType = "gelu";
- else if (at == ActivationType::SWIGLU)
- actType = "swiglu";
- else
- printf(">> unsupported activation type\n");
-
- if (ctx == nullptr
- || (ctx != nullptr && (ctx->hiddenSize != hiddenSize || ctx->intermediateSize != intermediateSize))) {
- if (ctx != nullptr) delete ctx;
- printf(">> create context: %d %d\n", hiddenSize, intermediateSize);
- mmHelper = new MMHelper(Env::getInstance().getEngineKind(), Env::getInstance().getEngineIndex());
- ctx = new DecoderContext(1, hiddenSize, attHeadDim, attHeadNum, kvHeadNum, intermediateSize, actType, 1e-6, 0,
- 0, maxPositions, maxPosEmbed, -1, 0, 1, mmHelper);
- if (kvCacheMgr != nullptr) delete kvCacheMgr;
- kvCacheMgr = new KVCacheManager<float16_t>(1);
- }
-
+ using DECODER = Decoder<Attention<DataT, RopeT, NormT>, LlamaMLP<DataT>>;
+ DECODER *llama_layer;
+ static xft::Matrix<float> actBuffers ;
+ //static std::unordered_map<std::string, DECODER *> llama_layer_hub;
+ static std::unordered_map<std::string, std::tuple<DECODER*>> llama_layer_hub;
// create hash key and value: if hidden and intermediateSize is changed , then memory pointer is also changed.
std::stringstream weights_addr;
weights_addr << queryWeight << "_" << keyWeight << "_" << valueWeight << "_" << attnOutWeight << "_" << gateWeight
<< "_" << upWeight << "_" << downWeight << "_" << dt << "_" << at << "_" << nt << "_" << attHeadDim
<< "_" << attHeadNum << "_" << kvHeadNum;
std::string llama_layer_key = weights_addr.str();
- DECODER *llama_layer;
auto it_created = llama_layer_hub.find(llama_layer_key);
if (it_created == llama_layer_hub.end()) {
+ int firstNode = getenv("FIRST_TOKEN_WEIGHT_LOCATION") ? atoi(getenv("FIRST_TOKEN_WEIGHT_LOCATION")) : -1;
+ int nextNode = getenv("NEXT_TOKEN_WEIGHT_LOCATION") ? atoi(getenv("NEXT_TOKEN_WEIGHT_LOCATION")) : -1;
+ if (step == 0)
+ xft_set_preferred_node(firstNode);
+ else
+ xft_set_preferred_node(nextNode);
llama_layer = new DECODER(ctx, 0);
llama_layer->setWeights(ctx, (const float *)queryWeight, nullptr, nullptr, queryBias, (const float *)keyWeight,
nullptr, nullptr, keyBias, (const float *)valueWeight, nullptr, nullptr, valueBias,
(const float *)attnOutWeight, nullptr, nullptr, attnOutBias, ln1Gamma, ln1Beta,
(const float *)gateWeight, nullptr, nullptr, nullptr, (const float *)upWeight, nullptr, nullptr,
- nullptr, ln2Gamma, ln2Beta, (const float *)downWeight, nullptr, nullptr, false);
- llama_layer_hub[llama_layer_key] = llama_layer;
- printf(">> create llama_layer_key: %s\n", llama_layer_key.c_str());
+ nullptr, ln2Gamma, ln2Beta, (const float *)downWeight, nullptr, nullptr, false,(const float *)myqkvWeight);
+
+
+ llama_layer_hub[llama_layer_key] = std::make_tuple(llama_layer);;
+ // printf(">> create llama_layer_key: %s\n", llama_layer_key.c_str());
+ xft_set_preferred_node(-1);
} else {
- llama_layer = it_created->second;
+ llama_layer = std::get<0>(it_created->second);
}
-
- ctx->resize(batchSize, inputSeqLen, pastSeqLen);
- xft::Matrix<float> actBuffers;
actBuffers.Resize(batchSize * inputSeqLen * 2, hiddenSize);
+ ctx->resize(batchSize, inputSeqLen, pastSeqLen);
float *attnMask = prepareAttnMask(ctx, step);
- int workers = 1;
- int headsPerSplit = (ctx->kvHeadNum + workers - 1) / workers;
- kvCacheMgr->resize(maxPositions, batchSize, headsPerSplit, attHeadDim);
- KVCacheTensor<float16_t> &presentKey = kvCacheMgr->getKey(0);
- KVCacheTensor<float16_t> &presentValue = kvCacheMgr->getValue(0);
+ KVCacheTensor<KVCacheT> &presentKey = kvCacheMgr->getKey(0);
+ KVCacheTensor<KVCacheT> &presentValue = kvCacheMgr->getValue(0);
float *attnOut = (float *)(ctx->tmpBuf.Data());
@@ -159,45 +140,168 @@ void LayerLLaMAImpl(DataType dt, ActivationType at, NormType nt, int batchSize,
llama_layer->forwardFFN(ctx, attnOut, (float *)output, inputStride, outputStride, true);
}
-void invokeLayerLLaMA(DataType dt, ActivationType at, NormType nt, int batchSize, int inputSeqLen, int attHeadDim,
+template <typename KVCacheT, typename RopeT>
+void LayerLLaMAWrapper(DataType dt, ActivationType at, NormType nt, int batchSize, int inputSeqLen, int attHeadDim,
int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed, int pastSeqLen, int currentSeqLen, int step,
int hiddenSize, int intermediateSize, void *output, int outputStride, const void *input, int inputStride,
const float *ln1Gamma, const float *ln1Beta, const void *queryWeight, const void *keyWeight,
const void *valueWeight, const void *attnOutWeight, const float *ln2Gamma, const float *ln2Beta,
const void *gateWeight, const void *upWeight, const void *downWeight, const float *queryBias,
- const float *keyBias, const float *valueBias, const float *attnOutBias) {
+ const float *keyBias, const float *valueBias, const float *attnOutBias,const void *myqkvWeight=nullptr) {
static std::mutex mutex;
std::lock_guard<std::mutex> lock(mutex);
+ std::string actType;
+ if (at == ActivationType::SILU)
+ actType = "silu";
+ else if (at == ActivationType::RELU)
+ actType = "relu";
+ else if (at == ActivationType::GELU)
+ actType = "gelu";
+ else if (at == ActivationType::SWIGLU)
+ actType = "swiglu";
+ else {
+ printf(">> unsupported activation type\n");
+ return;
+ }
+
+ static MMHelper *mmHelper;
+ static DecoderContext *ctx;
+ if (ctx == nullptr
+ || (ctx != nullptr && (ctx->hiddenSize != hiddenSize || ctx->intermediateSize != intermediateSize))) {
+ if (ctx != nullptr) delete ctx;
+ // printf(">> create context: %d %d\n", hiddenSize, intermediateSize);
+ mmHelper = new MMHelper(Env::getInstance().getEngineKind(), Env::getInstance().getEngineIndex());
+ ctx = new DecoderContext(1, hiddenSize, attHeadDim, attHeadNum, kvHeadNum, intermediateSize, actType, 1e-6, 0,
+ 0, maxPositions, maxPosEmbed, -1, 0, 1, mmHelper);
+ }
+
+ KVCacheManager<KVCacheT> *kvCacheMgr;
+ static std::unordered_map<std::string, KVCacheManager<KVCacheT> *> kv_hub;
+
+ // create hash key and value: if hidden and intermediateSize is changed , then memory pointer is also changed.
+ std::stringstream layer_key;
+ layer_key << queryWeight << "_" << keyWeight << "_" << valueWeight << "_" << attnOutWeight << "_" << gateWeight
+ << "_" << upWeight << "_" << downWeight << "_" << dt << "_" << at << "_" << nt << "_" << attHeadDim
+ << "_" << attHeadNum << "_" << kvHeadNum;
+ std::string kv_hub_key = layer_key.str();
+
+ auto it_created = kv_hub.find(kv_hub_key);
+ if (it_created == kv_hub.end()) {
+ int kvcNode = getenv("KVCACHE_LOCATION") ? atoi(getenv("KVCACHE_LOCATION")) : -1;
+ xft_set_preferred_node(kvcNode);
+ kvCacheMgr = new KVCacheManager<KVCacheT>(1);
+ int workers = 1;
+ int headsPerSplit = (ctx->kvHeadNum + workers - 1) / workers;
+ kvCacheMgr->resize(maxPositions, batchSize, headsPerSplit, attHeadDim);
+ kv_hub[kv_hub_key] = kvCacheMgr;
+ // printf(">> create kv_hub_key: %s\n", kv_hub_key.c_str());
+ xft_set_preferred_node(-1);
+ } else {
+ kvCacheMgr = it_created->second;
+ }
+
if (dt == DataType::bf16) {
- if (nt == NormType::RMS)
- LayerLLaMAImpl<bfloat16_t, RmsNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ if (nt == NormType::RMS) {
+ LayerLLaMAImpl<bfloat16_t, KVCacheT, RopeT, RmsNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
- attnOutBias);
- else if (nt == NormType::LN) {
- LayerLLaMAImpl<bfloat16_t, LayerNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ } else if (nt == NormType::LN) {
+ LayerLLaMAImpl<bfloat16_t, KVCacheT, RopeT, LayerNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
- attnOutBias);
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
} else {
printf(">> unsupported norm type\n");
}
} else if (dt == DataType::fp16) {
- if (nt == NormType::RMS)
- LayerLLaMAImpl<float16_t, RmsNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ if (nt == NormType::RMS) {
+ LayerLLaMAImpl<float16_t, KVCacheT, RopeT, RmsNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
- attnOutBias);
- else if (nt == NormType::LN) {
- LayerLLaMAImpl<float16_t, LayerNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ } else if (nt == NormType::LN) {
+ LayerLLaMAImpl<float16_t, KVCacheT, RopeT, LayerNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
- attnOutBias);
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ } else {
+ printf(">> unsupported norm type\n");
+ }
+ } else if (dt == DataType::bf16_int8) {
+ if (nt == NormType::RMS) {
+ auto firstTokenFunc = LayerLLaMAImpl<bfloat16_t, KVCacheT, RopeT, RmsNorm>;
+ auto nextTokenFunc = LayerLLaMAImpl<int8_t, KVCacheT, RopeT, RmsNorm>;
+ if (step == 0) {
+ firstTokenFunc(DataType::bf16, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+
+ } else {
+ nextTokenFunc(DataType::int8, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ }
+ } else if (nt == NormType::LN) {
+ auto firstTokenFunc = LayerLLaMAImpl<bfloat16_t, KVCacheT, RopeT, LayerNorm>;
+ auto nextTokenFunc = LayerLLaMAImpl<int8_t, KVCacheT, RopeT, LayerNorm>;
+ if (step == 0)
+ firstTokenFunc(DataType::bf16, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ else
+ nextTokenFunc(DataType::int8, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ } else {
+ printf(">> unsupported norm type\n");
+ }
+ } else if (dt == DataType::fp16_int8) {
+ if (nt == NormType::RMS) {
+ auto firstTokenFunc = LayerLLaMAImpl<float16_t, KVCacheT, RopeT, RmsNorm>;
+ auto nextTokenFunc = LayerLLaMAImpl<int8_t, KVCacheT, RopeT, RmsNorm>;
+ if (step == 0) {
+ firstTokenFunc(DataType::fp16, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+
+ } else {
+ nextTokenFunc(DataType::int8, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ }
+ } else if (nt == NormType::LN) {
+ auto firstTokenFunc = LayerLLaMAImpl<bfloat16_t, KVCacheT, RopeT, LayerNorm>;
+ auto nextTokenFunc = LayerLLaMAImpl<int8_t, KVCacheT, RopeT, LayerNorm>;
+ if (step == 0)
+ firstTokenFunc(DataType::fp16, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ else
+ nextTokenFunc(DataType::int8, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
} else {
printf(">> unsupported norm type\n");
}
@@ -206,4 +310,40 @@ void invokeLayerLLaMA(DataType dt, ActivationType at, NormType nt, int batchSize
}
}
+void invokeLayerLLaMA(DataType dt, DataType kvcdt, RopeType rt, ActivationType at, NormType nt, int batchSize, int inputSeqLen, int attHeadDim,
+ int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed, int pastSeqLen, int currentSeqLen, int step,
+ int hiddenSize, int intermediateSize, void *output, int outputStride, const void *input, int inputStride,
+ const float *ln1Gamma, const float *ln1Beta, const void *queryWeight, const void *keyWeight,
+ const void *valueWeight, const void *attnOutWeight, const float *ln2Gamma, const float *ln2Beta,
+ const void *gateWeight, const void *upWeight, const void *downWeight, const float *queryBias,
+ const float *keyBias, const float *valueBias, const float *attnOutBias, const void *myqkvWeight ,
+ const float *gateBias , const float *upBias , const float *downBias, const float *myqkvBias) {
+
+ if (kvcdt == DataType::fp16) {
+ if (rt == RopeType::LLAMA_ROPE)
+ return LayerLLaMAWrapper<float16_t, LlamaRotaryEmbedding>(dt, at, nt, batchSize, inputSeqLen, attHeadDim,
+ attHeadNum, kvHeadNum, maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step,
+ hiddenSize, intermediateSize, output, outputStride, input, inputStride,
+ ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight, attnOutWeight, ln2Gamma, ln2Beta,
+ gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias, attnOutBias,myqkvWeight) ;
+ else {
+ printf(">> unsupported Rope type: %d\n", rt);
+ }
+ } else if (kvcdt == DataType::int8) {
+ if (rt == RopeType::LLAMA_ROPE)
+ return LayerLLaMAWrapper<int8_t, LlamaRotaryEmbedding>(dt, at, nt, batchSize, inputSeqLen, attHeadDim,
+ attHeadNum, kvHeadNum, maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step,
+ hiddenSize, intermediateSize, output, outputStride, input, inputStride,
+ ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight, attnOutWeight, ln2Gamma, ln2Beta,
+ gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias, attnOutBias,myqkvWeight) ;
+ else {
+ printf(">> unsupported Rope type: %d\n", rt);
+ }
+ } else {
+ printf(">> unsupported KVcache data type: %d\n", kvcdt);
+ return;
+ }
+
+}
+
} // namespace xft
diff --git a/src/layers/decoder_layer.h b/src/layers/decoder_layer.h
index 3cb5873..570b267 100644
--- a/src/layers/decoder_layer.h
+++ b/src/layers/decoder_layer.h
@@ -83,10 +83,10 @@ public:
const float *fc1Scales, const float *fc1Zeros, const float *fc1Bias, const OriWeiT *fc2Weight,
const float *fc2Scales, const float *fc2Zeros, const float *fc2Bias, const float *ln2Gamma,
const float *ln2Beta, const OriWeiT *fc3Weight, const float *fc3Scales, const float *fc3Zeros,
- bool trans = true) {
+ bool trans = true,const OriWeiT *myqkvWeight = nullptr) {
attn.setWeights(ctx, queryWeight, queryScale, queryZero, queryBias, keyWeight, keyScale, keyZero, keyBias,
valueWeight, valueScale, valueZero, valueBias, attnOutWeight, attnOutScale, attnOutZero, attnOutBias,
- true, ln1Gamma, ln1Beta, trans);
+ true, ln1Gamma, ln1Beta, trans,myqkvWeight);
mlp.setWeights(ctx, fc1Weight, fc1Scales, fc1Zeros, fc1Bias, fc2Weight, fc2Scales, fc2Zeros, fc2Bias, ln2Gamma,
ln2Beta, fc3Weight, fc3Scales, fc3Zeros, trans);
diff --git a/tests/ut/layers_decoder_test.cpp b/tests/ut/layers_decoder_test.cpp
index be75d94..0e56b10 100644
--- a/tests/ut/layers_decoder_test.cpp
+++ b/tests/ut/layers_decoder_test.cpp
@@ -21,8 +21,8 @@
#include "layers_decoder.h"
#include "gtest/gtest.h"
-template <typename T>
-static void compareLayerLLaMA(int step, int batchSize, int inputSeqLen, int pastSeqLen, int currentSeqLen,
+static void compareLayerLLaMA(xft::DataType dt, xft::DataType kvcdt, int step,
+ int batchSize, int inputSeqLen, int pastSeqLen, int currentSeqLen,
int attHeadDim, int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed, int hiddenSize,
int intermediateSize, const float *ln1Gamma, const float *ln1Beta, const void *queryWeight,
const void *keyWeight, const void *valueWeight, const void *attnOutWeight, const float *ln2Gamma,
@@ -36,19 +36,8 @@ static void compareLayerLLaMA(int step, int batchSize, int inputSeqLen, int past
input[i] = static_cast<float>(1.0f * rand() / RAND_MAX);
}
- xft::DataType dt = xft::DataType::unknown;
- if constexpr (std::is_same<T, bfloat16_t>::value) {
- dt = xft::DataType::bf16;
- } else if constexpr (std::is_same<T, float16_t>::value) {
- dt = xft::DataType::fp16;
- } else {
- printf("Unsupported data type\n");
- GTEST_FAIL();
- return;
- }
-
auto start = std::chrono::high_resolution_clock::now();
- invokeLayerLLaMA(dt, xft::ActivationType::SILU, xft::NormType::RMS, batchSize, inputSeqLen, attHeadDim, attHeadNum,
+ invokeLayerLLaMA(dt, kvcdt, xft::RopeType::LLAMA_ROPE, xft::ActivationType::SILU, xft::NormType::RMS, batchSize, inputSeqLen, attHeadDim, attHeadNum,
kvHeadNum, maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize,
(void *)ourOutput, hiddenSize, input, hiddenSize, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
attnOutWeight, ln2Gamma, ln2Beta, gateW, upW, downW);
@@ -60,8 +49,7 @@ static void compareLayerLLaMA(int step, int batchSize, int inputSeqLen, int past
free(ourOutput);
}
-template <typename T>
-void test_LayerLLaMA(void) {
+void test_LayerLLaMA(xft::DataType dt, xft::DataType kvcdt) {
int maxPosEmbed = 4096;
int maxPositions = maxPosEmbed;
int hiddenSize = 4096;
@@ -111,16 +99,16 @@ void test_LayerLLaMA(void) {
int currentSeqLen = inputSeqLen;
int nextTokenNum = 1;
- compareLayerLLaMA<T>(step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ compareLayerLLaMA(dt, kvcdt, step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, hiddenSize, intermediateSize, ln1Gamma, ln1Beta, qkvProj, qkvProj + qSize,
qkvProj + kvSize, oProj, ln2Gamma, ln2Beta, gateW, upW, downW);
pastSeqLen += inputSeqLen;
currentSeqLen = nextTokenNum;
- compareLayerLLaMA<T>(step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ compareLayerLLaMA(dt, kvcdt, step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, hiddenSize, intermediateSize, ln1Gamma, ln1Beta, qkvProj, qkvProj + qSize,
qkvProj + kvSize, oProj, ln2Gamma, ln2Beta, gateW, upW, downW);
pastSeqLen += nextTokenNum;
- compareLayerLLaMA<T>(step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ compareLayerLLaMA(dt, kvcdt, step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, hiddenSize, intermediateSize, ln1Gamma, ln1Beta, qkvProj, qkvProj + qSize,
qkvProj + kvSize, oProj, ln2Gamma, ln2Beta, gateW, upW, downW);
@@ -135,15 +123,31 @@ void test_LayerLLaMA(void) {
free(downW);
}
-TEST(LayerLLaMA, bfloat16_t) {
- test_LayerLLaMA<bfloat16_t>();
+TEST(LayerLLaMA, w_bf16_kv_fp16) {
+ test_LayerLLaMA(xft::DataType::bf16, xft::DataType::fp16);
+}
+
+TEST(LayerLLaMA, w_bf16_kv_int8) {
+ test_LayerLLaMA(xft::DataType::bf16, xft::DataType::int8);
+}
+
+TEST(LayerLLaMA, w_fp16_kv_fp16) {
+ test_LayerLLaMA(xft::DataType::fp16, xft::DataType::fp16);
}
-TEST(LayerLLaMA, float16_t) {
- test_LayerLLaMA<float16_t>();
+TEST(LayerLLaMA, w_fp16_kv_int8) {
+ test_LayerLLaMA(xft::DataType::fp16, xft::DataType::int8);
+}
+
+TEST(LayerLLaMA, w_bf16_int8_kv_fp16) {
+ test_LayerLLaMA(xft::DataType::bf16_int8, xft::DataType::fp16);
+}
+
+TEST(LayerLLaMA, w_bf16_int8_kv_int8) {
+ test_LayerLLaMA(xft::DataType::bf16_int8, xft::DataType::int8);
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
-}
\ No newline at end of file
+}
--
2.25.1

647
csrc/cpu/0001-fp32.patch Normal file
View File

@@ -0,0 +1,647 @@
From 8bb1110823ba646f56aaa459394ffb0b3a940352 Mon Sep 17 00:00:00 2001
From: bukejiyu <395822456@qq.com>
Date: Wed, 21 Aug 2024 22:03:13 +0800
Subject: [PATCH] fp32
---
CMakeLists.txt | 16 +-
cmake/mkl.cmake | 2 +-
cmake/mklml.cmake | 2 +-
cmake/onednn.cmake | 1 +
cmake/xdnn.cmake | 2 +-
include/dtype.h | 5 +
include/layers_decoder.h | 21 +--
src/layers/attention.h | 9 +-
src/layers/decoder_layer.cpp | 256 ++++++++++++++++++++++++-------
src/layers/decoder_layer.h | 4 +-
tests/ut/layers_decoder_test.cpp | 52 ++++---
11 files changed, 263 insertions(+), 107 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aa70d4b..9149154 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -178,14 +178,14 @@ if(WITH_GPU)
add_definitions(-DAVX512_FP32_WEIGHT_ONLY_NF4=true)
else()
# Enable AVX512_FP16 optimization
- # add_definitions(-DAVX512_FP32_WEIGHT_ONLY_FP16=true)
- add_definitions(-DAVX512_FP16_WEIGHT_ONLY_FP16=true)
- add_definitions(-DAVX512_BF16_WEIGHT_ONLY_BF16=true)
- # add_definitions(-DAVX512_FP32_WEIGHT_ONLY_INT8=true)
- add_definitions(-DAVX512_FP16_WEIGHT_ONLY_INT8=true)
- # add_definitions(-DAVX512_FP32_WEIGHT_ONLY_INT4=true)
- add_definitions(-DAVX512_FP16_WEIGHT_ONLY_INT4=true)
- add_definitions(-DAVX512_FP32_WEIGHT_ONLY_NF4=true)
+ add_definitions(-DAVX512_FP32_WEIGHT_ONLY_FP16=true)
+ # add_definitions(-DAVX512_FP16_WEIGHT_ONLY_FP16=true)
+ # add_definitions(-DAVX512_BF16_WEIGHT_ONLY_BF16=true)
+ add_definitions(-DAVX512_FP32_WEIGHT_ONLY_INT8=true)
+ # add_definitions(-DAVX512_FP16_WEIGHT_ONLY_INT8=true)
+ add_definitions(-DAVX512_FP32_WEIGHT_ONLY_INT4=true)
+ # add_definitions(-DAVX512_FP16_WEIGHT_ONLY_INT4=true)
+ # add_definitions(-DAVX512_FP32_WEIGHT_ONLY_NF4=true)
# add_definitions(-DAVX512_FP16_WEIGHT_ONLY_NF4=true)
# Enable AMX_FP16 optimization
# add_definitions(-DAMX_FP16_WEIGHT_ONLY_FP16=true)
diff --git a/cmake/mkl.cmake b/cmake/mkl.cmake
index 0ef2e66..92c6d06 100644
--- a/cmake/mkl.cmake
+++ b/cmake/mkl.cmake
@@ -25,7 +25,7 @@ set(MKL_3rdparty_DIR "${CMAKE_SOURCE_DIR}/3rdparty/mkl")
if(NOT EXISTS ${MKL_3rdparty_DIR})
find_package(Python COMPONENTS Interpreter Development)
execute_process(COMMAND ${Python_EXECUTABLE} -m pip install --force-reinstall
- --prefix=${MKL_3rdparty_DIR} mkl-static==2024.0.0 mkl-include==2024.0.0
+ --prefix=${MKL_3rdparty_DIR} mkl-static==2024.0.0 mkl-include==2024.0.0 -i https://mirrors.aliyun.com/pypi/simple
RESULT_VARIABLE EXIT_CODE)
if(NOT ${EXIT_CODE} EQUAL 0)
diff --git a/cmake/mklml.cmake b/cmake/mklml.cmake
index 4baec46..d89ce46 100644
--- a/cmake/mklml.cmake
+++ b/cmake/mklml.cmake
@@ -28,7 +28,7 @@ include(ExternalProject)
ExternalProject_Add(mklml
URL https://github.com/oneapi-src/oneDNN/releases/download/v0.21/mklml_lnx_2019.0.5.20190502.tgz
URL_HASH MD5=dfcea335652dbf3518e1d02cab2cea97
- TIMEOUT 60
+ TIMEOUT 360
SOURCE_DIR ${CMAKE_SOURCE_DIR}/3rdparty/mklml
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
diff --git a/cmake/onednn.cmake b/cmake/onednn.cmake
index 8efabd1..bfa558a 100644
--- a/cmake/onednn.cmake
+++ b/cmake/onednn.cmake
@@ -36,6 +36,7 @@ if(NOT EXISTS ${ONEDNN_3rdparty_DIR})
ExternalProject_Add(onednn
GIT_REPOSITORY https://github.com/oneapi-src/oneDNN.git
GIT_TAG v3.5
+ TIMEOUT 360
SOURCE_DIR ${ONEDNN_3rdparty_DIR}
BINARY_DIR ${ONEDNN_3rdparty_DIR}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E make_directory "build" && ${CMAKE_COMMAND} -E chdir "build" ${CMAKE_COMMAND} ${ONEDNN_BUILD_OPTIONS} ..
diff --git a/cmake/xdnn.cmake b/cmake/xdnn.cmake
index 7c0e051..721bfe3 100644
--- a/cmake/xdnn.cmake
+++ b/cmake/xdnn.cmake
@@ -28,7 +28,7 @@ include(ExternalProject)
ExternalProject_Add(xdnn_lib
URL https://github.com/intel/xFasterTransformer/releases/download/IntrinsicGemm/xdnn_v1.5.2.tar.gz
URL_HASH MD5=884f2e1e2c846ff19f33c889681f8dc2
- TIMEOUT 120
+ TIMEOUT 360
SOURCE_DIR ${CMAKE_SOURCE_DIR}/3rdparty/xdnn
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
diff --git a/include/dtype.h b/include/dtype.h
index de72bce..9e0a448 100644
--- a/include/dtype.h
+++ b/include/dtype.h
@@ -31,6 +31,7 @@ enum DataType {
w8a8_int8,
w8a8_int4,
w8a8_nf4,
+ fp16_int8,
unknown,
};
@@ -51,4 +52,8 @@ enum ActivationType {
SILU,
};
+enum RopeType {
+ LLAMA_ROPE = 0,
+};
+
} // namespace xft
diff --git a/include/layers_decoder.h b/include/layers_decoder.h
index 34f6aa5..a30e34d 100644
--- a/include/layers_decoder.h
+++ b/include/layers_decoder.h
@@ -17,13 +17,14 @@
#include "dtype.h"
namespace xft {
-
-void invokeLayerLLaMA(DataType dt, ActivationType at, NormType nt, int batchSize, int inputSeqLen, int attHeadDim,
- int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed, int pastSeqLen, int currentSeqLen, int step,
- int hiddenSize, int intermediateSize, void *output, int outputStride, const void *input, int inputStride,
- const float *ln1Gamma, const float *ln1Beta, const void *queryWeight, const void *keyWeight,
- const void *valueWeight, const void *attnOutWeight, const float *ln2Gamma, const float *ln2Beta,
- const void *gateWeight, const void *upWeight, const void *downWeight, const float *queryBias = nullptr,
- const float *keyBias = nullptr, const float *valueBias = nullptr, const float *attnOutBias = nullptr);
-
-} // namespace xft
\ No newline at end of file
+void invokeLayerLLaMA(DataType dt, DataType kvcdt, RopeType rt, ActivationType at, NormType nt, int batchSize,
+ int inputSeqLen, int attHeadDim, int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed,
+ int pastSeqLen, int currentSeqLen, int step, int hiddenSize, int intermediateSize, void *output,
+ int outputStride, const void *input, int inputStride, const float *ln1Gamma, const float *ln1Beta,
+ const void *queryWeight, const void *keyWeight, const void *valueWeight, const void *attnOutWeight,
+ const float *ln2Gamma, const float *ln2Beta, const void *gateWeight, const void *upWeight,
+ const void *downWeight, const float *queryBias = nullptr, const float *keyBias = nullptr,
+ const float *valueBias = nullptr, const float *attnOutBias = nullptr, const void *myqkvWeight = nullptr,
+ const float *gateBias = nullptr, const float *upBias = nullptr, const float *downBias = nullptr,
+ const float *myqkvBias = nullptr);
+} // namespace xft
diff --git a/src/layers/attention.h b/src/layers/attention.h
index 092b3d6..b438837 100644
--- a/src/layers/attention.h
+++ b/src/layers/attention.h
@@ -84,7 +84,8 @@ public:
const float *queryBias, const OriWeiT *keyWeight, const float *keyScale, const float *keyZero,
const float *keyBias, const OriWeiT *valueWeight, const float *valueScale, const float *valueZero,
const float *valueBias, const OriWeiT *attnOutWeight, const float *attnOutScale, const float *attnOutZero,
- const float *attnOutBias, bool doLNorm, const float *gamma1, const float *beta1, bool trans = true) {
+ const float *attnOutBias, bool doLNorm, const float *gamma1, const float *beta1, bool trans = true,
+ const OriWeiT *myqkvWeight = nullptr) {
int hiddenSize = ctx->hiddenSize;
int headSize = ctx->attHeadSize;
@@ -107,7 +108,10 @@ public:
valueWeight + this->startKVHead * headSize * hiddenSize / sizeFactor,
hiddenSize * kvResponsibleCols * sizeof(OriWeiT) / sizeFactor);
} else {
- int qkvStride = (ctx->attHeadNum + ctx->kvHeadNum + ctx->kvHeadNum) * ctx->attHeadSize;
+ if (myqkvWeight != nullptr) {
+ memcpy(concatBuf, myqkvWeight, hiddenSize * responsibleCols * sizeof(OriWeiT) / sizeFactor);
+ } else {
+ int qkvStride = (ctx->attHeadNum + ctx->kvHeadNum + ctx->kvHeadNum) * ctx->attHeadSize;
#pragma omp parallel for
for (int i = 0; i < hiddenSize; ++i) {
memcpy(concatBuf + i * responsibleCols / sizeFactor,
@@ -120,6 +124,7 @@ public:
+ kvResponsibleCols / sizeFactor,
valueWeight + i * qkvStride / sizeFactor + this->startKVHead * headSize / sizeFactor,
kvResponsibleCols * sizeof(OriWeiT) / sizeFactor);
+ }
}
}
float *concatScale = nullptr;
diff --git a/src/layers/decoder_layer.cpp b/src/layers/decoder_layer.cpp
index 02f13cb..0f30f21 100644
--- a/src/layers/decoder_layer.cpp
+++ b/src/layers/decoder_layer.cpp
@@ -21,19 +21,21 @@
#include "layers_mlp.h"
#include "mlp_llama.h"
#include "rms_norm.h"
+#include "numa_allocator.h"
#include <unordered_map>
namespace xft {
-template <typename DataT, typename NormT>
+template <typename DataT, typename KVCacheT, typename RopeT, typename NormT>
void LayerLLaMAImpl(DataType dt, ActivationType at, NormType nt, int batchSize, int inputSeqLen, int attHeadDim,
int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed, int pastSeqLen, int currentSeqLen, int step,
int hiddenSize, int intermediateSize, void *output, int outputStride, const void *input, int inputStride,
const float *ln1Gamma, const float *ln1Beta, const void *queryWeight, const void *keyWeight,
const void *valueWeight, const void *attnOutWeight, const float *ln2Gamma, const float *ln2Beta,
const void *gateWeight, const void *upWeight, const void *downWeight, const float *queryBias,
- const float *keyBias, const float *valueBias, const float *attnOutBias) {
+ const float *keyBias, const float *valueBias, const float *attnOutBias,
+ MMHelper *mmHelper, DecoderContext *ctx, KVCacheManager<KVCacheT> *kvCacheMgr,const void *myqkvWeight = nullptr) {
// TODO: will deprecate attention mask in future, so need to change this
auto prepareAttnMask = [&](DecoderContext *ctx, int step) {
@@ -83,67 +85,46 @@ void LayerLLaMAImpl(DataType dt, ActivationType at, NormType nt, int batchSize,
return mask;
};
- using DECODER = Decoder<Attention<DataT, LlamaRotaryEmbedding, NormT>, LlamaMLP<DataT>>;
- static std::unordered_map<std::string, DECODER *> llama_layer_hub;
- static MMHelper *mmHelper;
- static DecoderContext *ctx;
- static KVCacheManager<float16_t> *kvCacheMgr;
-
- std::string actType;
- if (at == ActivationType::SILU)
- actType = "silu";
- else if (at == ActivationType::RELU)
- actType = "relu";
- else if (at == ActivationType::GELU)
- actType = "gelu";
- else if (at == ActivationType::SWIGLU)
- actType = "swiglu";
- else
- printf(">> unsupported activation type\n");
-
- if (ctx == nullptr
- || (ctx != nullptr && (ctx->hiddenSize != hiddenSize || ctx->intermediateSize != intermediateSize))) {
- if (ctx != nullptr) delete ctx;
- printf(">> create context: %d %d\n", hiddenSize, intermediateSize);
- mmHelper = new MMHelper(Env::getInstance().getEngineKind(), Env::getInstance().getEngineIndex());
- ctx = new DecoderContext(1, hiddenSize, attHeadDim, attHeadNum, kvHeadNum, intermediateSize, actType, 1e-6, 0,
- 0, maxPositions, maxPosEmbed, -1, 0, 1, mmHelper);
- if (kvCacheMgr != nullptr) delete kvCacheMgr;
- kvCacheMgr = new KVCacheManager<float16_t>(1);
- }
-
+ using DECODER = Decoder<Attention<DataT, RopeT, NormT>, LlamaMLP<DataT>>;
+ DECODER *llama_layer;
+ static xft::Matrix<float> actBuffers ;
+ //static std::unordered_map<std::string, DECODER *> llama_layer_hub;
+ static std::unordered_map<std::string, std::tuple<DECODER*>> llama_layer_hub;
// create hash key and value: if hidden and intermediateSize is changed , then memory pointer is also changed.
std::stringstream weights_addr;
weights_addr << queryWeight << "_" << keyWeight << "_" << valueWeight << "_" << attnOutWeight << "_" << gateWeight
<< "_" << upWeight << "_" << downWeight << "_" << dt << "_" << at << "_" << nt << "_" << attHeadDim
<< "_" << attHeadNum << "_" << kvHeadNum;
std::string llama_layer_key = weights_addr.str();
- DECODER *llama_layer;
auto it_created = llama_layer_hub.find(llama_layer_key);
if (it_created == llama_layer_hub.end()) {
+ int firstNode = getenv("FIRST_TOKEN_WEIGHT_LOCATION") ? atoi(getenv("FIRST_TOKEN_WEIGHT_LOCATION")) : -1;
+ int nextNode = getenv("NEXT_TOKEN_WEIGHT_LOCATION") ? atoi(getenv("NEXT_TOKEN_WEIGHT_LOCATION")) : -1;
+ if (step == 0)
+ xft_set_preferred_node(firstNode);
+ else
+ xft_set_preferred_node(nextNode);
llama_layer = new DECODER(ctx, 0);
llama_layer->setWeights(ctx, (const float *)queryWeight, nullptr, nullptr, queryBias, (const float *)keyWeight,
nullptr, nullptr, keyBias, (const float *)valueWeight, nullptr, nullptr, valueBias,
(const float *)attnOutWeight, nullptr, nullptr, attnOutBias, ln1Gamma, ln1Beta,
(const float *)gateWeight, nullptr, nullptr, nullptr, (const float *)upWeight, nullptr, nullptr,
- nullptr, ln2Gamma, ln2Beta, (const float *)downWeight, nullptr, nullptr, false);
- llama_layer_hub[llama_layer_key] = llama_layer;
- printf(">> create llama_layer_key: %s\n", llama_layer_key.c_str());
+ nullptr, ln2Gamma, ln2Beta, (const float *)downWeight, nullptr, nullptr, false,(const float *)myqkvWeight);
+
+
+ llama_layer_hub[llama_layer_key] = std::make_tuple(llama_layer);;
+ // printf(">> create llama_layer_key: %s\n", llama_layer_key.c_str());
+ xft_set_preferred_node(-1);
} else {
- llama_layer = it_created->second;
+ llama_layer = std::get<0>(it_created->second);
}
-
- ctx->resize(batchSize, inputSeqLen, pastSeqLen);
- xft::Matrix<float> actBuffers;
actBuffers.Resize(batchSize * inputSeqLen * 2, hiddenSize);
+ ctx->resize(batchSize, inputSeqLen, pastSeqLen);
float *attnMask = prepareAttnMask(ctx, step);
- int workers = 1;
- int headsPerSplit = (ctx->kvHeadNum + workers - 1) / workers;
- kvCacheMgr->resize(maxPositions, batchSize, headsPerSplit, attHeadDim);
- KVCacheTensor<float16_t> &presentKey = kvCacheMgr->getKey(0);
- KVCacheTensor<float16_t> &presentValue = kvCacheMgr->getValue(0);
+ KVCacheTensor<KVCacheT> &presentKey = kvCacheMgr->getKey(0);
+ KVCacheTensor<KVCacheT> &presentValue = kvCacheMgr->getValue(0);
float *attnOut = (float *)(ctx->tmpBuf.Data());
@@ -159,45 +140,168 @@ void LayerLLaMAImpl(DataType dt, ActivationType at, NormType nt, int batchSize,
llama_layer->forwardFFN(ctx, attnOut, (float *)output, inputStride, outputStride, true);
}
-void invokeLayerLLaMA(DataType dt, ActivationType at, NormType nt, int batchSize, int inputSeqLen, int attHeadDim,
+template <typename KVCacheT, typename RopeT>
+void LayerLLaMAWrapper(DataType dt, ActivationType at, NormType nt, int batchSize, int inputSeqLen, int attHeadDim,
int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed, int pastSeqLen, int currentSeqLen, int step,
int hiddenSize, int intermediateSize, void *output, int outputStride, const void *input, int inputStride,
const float *ln1Gamma, const float *ln1Beta, const void *queryWeight, const void *keyWeight,
const void *valueWeight, const void *attnOutWeight, const float *ln2Gamma, const float *ln2Beta,
const void *gateWeight, const void *upWeight, const void *downWeight, const float *queryBias,
- const float *keyBias, const float *valueBias, const float *attnOutBias) {
+ const float *keyBias, const float *valueBias, const float *attnOutBias,const void *myqkvWeight=nullptr) {
static std::mutex mutex;
std::lock_guard<std::mutex> lock(mutex);
+ std::string actType;
+ if (at == ActivationType::SILU)
+ actType = "silu";
+ else if (at == ActivationType::RELU)
+ actType = "relu";
+ else if (at == ActivationType::GELU)
+ actType = "gelu";
+ else if (at == ActivationType::SWIGLU)
+ actType = "swiglu";
+ else {
+ printf(">> unsupported activation type\n");
+ return;
+ }
+
+ static MMHelper *mmHelper;
+ static DecoderContext *ctx;
+ if (ctx == nullptr
+ || (ctx != nullptr && (ctx->hiddenSize != hiddenSize || ctx->intermediateSize != intermediateSize))) {
+ if (ctx != nullptr) delete ctx;
+ // printf(">> create context: %d %d\n", hiddenSize, intermediateSize);
+ mmHelper = new MMHelper(Env::getInstance().getEngineKind(), Env::getInstance().getEngineIndex());
+ ctx = new DecoderContext(1, hiddenSize, attHeadDim, attHeadNum, kvHeadNum, intermediateSize, actType, 1e-6, 0,
+ 0, maxPositions, maxPosEmbed, -1, 0, 1, mmHelper);
+ }
+
+ KVCacheManager<KVCacheT> *kvCacheMgr;
+ static std::unordered_map<std::string, KVCacheManager<KVCacheT> *> kv_hub;
+
+ // create hash key and value: if hidden and intermediateSize is changed , then memory pointer is also changed.
+ std::stringstream layer_key;
+ layer_key << queryWeight << "_" << keyWeight << "_" << valueWeight << "_" << attnOutWeight << "_" << gateWeight
+ << "_" << upWeight << "_" << downWeight << "_" << dt << "_" << at << "_" << nt << "_" << attHeadDim
+ << "_" << attHeadNum << "_" << kvHeadNum;
+ std::string kv_hub_key = layer_key.str();
+
+ auto it_created = kv_hub.find(kv_hub_key);
+ if (it_created == kv_hub.end()) {
+ int kvcNode = getenv("KVCACHE_LOCATION") ? atoi(getenv("KVCACHE_LOCATION")) : -1;
+ xft_set_preferred_node(kvcNode);
+ kvCacheMgr = new KVCacheManager<KVCacheT>(1);
+ int workers = 1;
+ int headsPerSplit = (ctx->kvHeadNum + workers - 1) / workers;
+ kvCacheMgr->resize(maxPositions, batchSize, headsPerSplit, attHeadDim);
+ kv_hub[kv_hub_key] = kvCacheMgr;
+ // printf(">> create kv_hub_key: %s\n", kv_hub_key.c_str());
+ xft_set_preferred_node(-1);
+ } else {
+ kvCacheMgr = it_created->second;
+ }
+
if (dt == DataType::bf16) {
- if (nt == NormType::RMS)
- LayerLLaMAImpl<bfloat16_t, RmsNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ if (nt == NormType::RMS) {
+ LayerLLaMAImpl<bfloat16_t, KVCacheT, RopeT, RmsNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
- attnOutBias);
- else if (nt == NormType::LN) {
- LayerLLaMAImpl<bfloat16_t, LayerNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ } else if (nt == NormType::LN) {
+ LayerLLaMAImpl<bfloat16_t, KVCacheT, RopeT, LayerNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
- attnOutBias);
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
} else {
printf(">> unsupported norm type\n");
}
} else if (dt == DataType::fp16) {
- if (nt == NormType::RMS)
- LayerLLaMAImpl<float16_t, RmsNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ if (nt == NormType::RMS) {
+ LayerLLaMAImpl<float16_t, KVCacheT, RopeT, RmsNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
- attnOutBias);
- else if (nt == NormType::LN) {
- LayerLLaMAImpl<float16_t, LayerNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ } else if (nt == NormType::LN) {
+ LayerLLaMAImpl<float16_t, KVCacheT, RopeT, LayerNorm>(dt, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
- attnOutBias);
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ } else {
+ printf(">> unsupported norm type\n");
+ }
+ } else if (dt == DataType::bf16_int8) {
+ if (nt == NormType::RMS) {
+ auto firstTokenFunc = LayerLLaMAImpl<bfloat16_t, KVCacheT, RopeT, RmsNorm>;
+ auto nextTokenFunc = LayerLLaMAImpl<int8_t, KVCacheT, RopeT, RmsNorm>;
+ if (step == 0) {
+ firstTokenFunc(DataType::bf16, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+
+ } else {
+ nextTokenFunc(DataType::int8, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ }
+ } else if (nt == NormType::LN) {
+ auto firstTokenFunc = LayerLLaMAImpl<bfloat16_t, KVCacheT, RopeT, LayerNorm>;
+ auto nextTokenFunc = LayerLLaMAImpl<int8_t, KVCacheT, RopeT, LayerNorm>;
+ if (step == 0)
+ firstTokenFunc(DataType::bf16, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ else
+ nextTokenFunc(DataType::int8, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ } else {
+ printf(">> unsupported norm type\n");
+ }
+ } else if (dt == DataType::fp16_int8) {
+ if (nt == NormType::RMS) {
+ auto firstTokenFunc = LayerLLaMAImpl<float16_t, KVCacheT, RopeT, RmsNorm>;
+ auto nextTokenFunc = LayerLLaMAImpl<int8_t, KVCacheT, RopeT, RmsNorm>;
+ if (step == 0) {
+ firstTokenFunc(DataType::fp16, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+
+ } else {
+ nextTokenFunc(DataType::int8, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ }
+ } else if (nt == NormType::LN) {
+ auto firstTokenFunc = LayerLLaMAImpl<bfloat16_t, KVCacheT, RopeT, LayerNorm>;
+ auto nextTokenFunc = LayerLLaMAImpl<int8_t, KVCacheT, RopeT, LayerNorm>;
+ if (step == 0)
+ firstTokenFunc(DataType::fp16, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
+ else
+ nextTokenFunc(DataType::int8, at, nt, batchSize, inputSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize, output,
+ outputStride, input, inputStride, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
+ attnOutWeight, ln2Gamma, ln2Beta, gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias,
+ attnOutBias, mmHelper, ctx, kvCacheMgr,myqkvWeight);
} else {
printf(">> unsupported norm type\n");
}
@@ -206,4 +310,40 @@ void invokeLayerLLaMA(DataType dt, ActivationType at, NormType nt, int batchSize
}
}
+void invokeLayerLLaMA(DataType dt, DataType kvcdt, RopeType rt, ActivationType at, NormType nt, int batchSize, int inputSeqLen, int attHeadDim,
+ int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed, int pastSeqLen, int currentSeqLen, int step,
+ int hiddenSize, int intermediateSize, void *output, int outputStride, const void *input, int inputStride,
+ const float *ln1Gamma, const float *ln1Beta, const void *queryWeight, const void *keyWeight,
+ const void *valueWeight, const void *attnOutWeight, const float *ln2Gamma, const float *ln2Beta,
+ const void *gateWeight, const void *upWeight, const void *downWeight, const float *queryBias,
+ const float *keyBias, const float *valueBias, const float *attnOutBias, const void *myqkvWeight ,
+ const float *gateBias , const float *upBias , const float *downBias, const float *myqkvBias) {
+
+ if (kvcdt == DataType::fp16) {
+ if (rt == RopeType::LLAMA_ROPE)
+ return LayerLLaMAWrapper<float16_t, LlamaRotaryEmbedding>(dt, at, nt, batchSize, inputSeqLen, attHeadDim,
+ attHeadNum, kvHeadNum, maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step,
+ hiddenSize, intermediateSize, output, outputStride, input, inputStride,
+ ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight, attnOutWeight, ln2Gamma, ln2Beta,
+ gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias, attnOutBias,myqkvWeight) ;
+ else {
+ printf(">> unsupported Rope type: %d\n", rt);
+ }
+ } else if (kvcdt == DataType::int8) {
+ if (rt == RopeType::LLAMA_ROPE)
+ return LayerLLaMAWrapper<int8_t, LlamaRotaryEmbedding>(dt, at, nt, batchSize, inputSeqLen, attHeadDim,
+ attHeadNum, kvHeadNum, maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step,
+ hiddenSize, intermediateSize, output, outputStride, input, inputStride,
+ ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight, attnOutWeight, ln2Gamma, ln2Beta,
+ gateWeight, upWeight, downWeight, queryBias, keyBias, valueBias, attnOutBias,myqkvWeight) ;
+ else {
+ printf(">> unsupported Rope type: %d\n", rt);
+ }
+ } else {
+ printf(">> unsupported KVcache data type: %d\n", kvcdt);
+ return;
+ }
+
+}
+
} // namespace xft
diff --git a/src/layers/decoder_layer.h b/src/layers/decoder_layer.h
index 3cb5873..570b267 100644
--- a/src/layers/decoder_layer.h
+++ b/src/layers/decoder_layer.h
@@ -83,10 +83,10 @@ public:
const float *fc1Scales, const float *fc1Zeros, const float *fc1Bias, const OriWeiT *fc2Weight,
const float *fc2Scales, const float *fc2Zeros, const float *fc2Bias, const float *ln2Gamma,
const float *ln2Beta, const OriWeiT *fc3Weight, const float *fc3Scales, const float *fc3Zeros,
- bool trans = true) {
+ bool trans = true,const OriWeiT *myqkvWeight = nullptr) {
attn.setWeights(ctx, queryWeight, queryScale, queryZero, queryBias, keyWeight, keyScale, keyZero, keyBias,
valueWeight, valueScale, valueZero, valueBias, attnOutWeight, attnOutScale, attnOutZero, attnOutBias,
- true, ln1Gamma, ln1Beta, trans);
+ true, ln1Gamma, ln1Beta, trans,myqkvWeight);
mlp.setWeights(ctx, fc1Weight, fc1Scales, fc1Zeros, fc1Bias, fc2Weight, fc2Scales, fc2Zeros, fc2Bias, ln2Gamma,
ln2Beta, fc3Weight, fc3Scales, fc3Zeros, trans);
diff --git a/tests/ut/layers_decoder_test.cpp b/tests/ut/layers_decoder_test.cpp
index be75d94..0e56b10 100644
--- a/tests/ut/layers_decoder_test.cpp
+++ b/tests/ut/layers_decoder_test.cpp
@@ -21,8 +21,8 @@
#include "layers_decoder.h"
#include "gtest/gtest.h"
-template <typename T>
-static void compareLayerLLaMA(int step, int batchSize, int inputSeqLen, int pastSeqLen, int currentSeqLen,
+static void compareLayerLLaMA(xft::DataType dt, xft::DataType kvcdt, int step,
+ int batchSize, int inputSeqLen, int pastSeqLen, int currentSeqLen,
int attHeadDim, int attHeadNum, int kvHeadNum, int maxPositions, int maxPosEmbed, int hiddenSize,
int intermediateSize, const float *ln1Gamma, const float *ln1Beta, const void *queryWeight,
const void *keyWeight, const void *valueWeight, const void *attnOutWeight, const float *ln2Gamma,
@@ -36,19 +36,8 @@ static void compareLayerLLaMA(int step, int batchSize, int inputSeqLen, int past
input[i] = static_cast<float>(1.0f * rand() / RAND_MAX);
}
- xft::DataType dt = xft::DataType::unknown;
- if constexpr (std::is_same<T, bfloat16_t>::value) {
- dt = xft::DataType::bf16;
- } else if constexpr (std::is_same<T, float16_t>::value) {
- dt = xft::DataType::fp16;
- } else {
- printf("Unsupported data type\n");
- GTEST_FAIL();
- return;
- }
-
auto start = std::chrono::high_resolution_clock::now();
- invokeLayerLLaMA(dt, xft::ActivationType::SILU, xft::NormType::RMS, batchSize, inputSeqLen, attHeadDim, attHeadNum,
+ invokeLayerLLaMA(dt, kvcdt, xft::RopeType::LLAMA_ROPE, xft::ActivationType::SILU, xft::NormType::RMS, batchSize, inputSeqLen, attHeadDim, attHeadNum,
kvHeadNum, maxPositions, maxPosEmbed, pastSeqLen, currentSeqLen, step, hiddenSize, intermediateSize,
(void *)ourOutput, hiddenSize, input, hiddenSize, ln1Gamma, ln1Beta, queryWeight, keyWeight, valueWeight,
attnOutWeight, ln2Gamma, ln2Beta, gateW, upW, downW);
@@ -60,8 +49,7 @@ static void compareLayerLLaMA(int step, int batchSize, int inputSeqLen, int past
free(ourOutput);
}
-template <typename T>
-void test_LayerLLaMA(void) {
+void test_LayerLLaMA(xft::DataType dt, xft::DataType kvcdt) {
int maxPosEmbed = 4096;
int maxPositions = maxPosEmbed;
int hiddenSize = 4096;
@@ -111,16 +99,16 @@ void test_LayerLLaMA(void) {
int currentSeqLen = inputSeqLen;
int nextTokenNum = 1;
- compareLayerLLaMA<T>(step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ compareLayerLLaMA(dt, kvcdt, step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, hiddenSize, intermediateSize, ln1Gamma, ln1Beta, qkvProj, qkvProj + qSize,
qkvProj + kvSize, oProj, ln2Gamma, ln2Beta, gateW, upW, downW);
pastSeqLen += inputSeqLen;
currentSeqLen = nextTokenNum;
- compareLayerLLaMA<T>(step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ compareLayerLLaMA(dt, kvcdt, step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, hiddenSize, intermediateSize, ln1Gamma, ln1Beta, qkvProj, qkvProj + qSize,
qkvProj + kvSize, oProj, ln2Gamma, ln2Beta, gateW, upW, downW);
pastSeqLen += nextTokenNum;
- compareLayerLLaMA<T>(step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
+ compareLayerLLaMA(dt, kvcdt, step++, batchSize, inputSeqLen, pastSeqLen, currentSeqLen, attHeadDim, attHeadNum, kvHeadNum,
maxPositions, maxPosEmbed, hiddenSize, intermediateSize, ln1Gamma, ln1Beta, qkvProj, qkvProj + qSize,
qkvProj + kvSize, oProj, ln2Gamma, ln2Beta, gateW, upW, downW);
@@ -135,15 +123,31 @@ void test_LayerLLaMA(void) {
free(downW);
}
-TEST(LayerLLaMA, bfloat16_t) {
- test_LayerLLaMA<bfloat16_t>();
+TEST(LayerLLaMA, w_bf16_kv_fp16) {
+ test_LayerLLaMA(xft::DataType::bf16, xft::DataType::fp16);
+}
+
+TEST(LayerLLaMA, w_bf16_kv_int8) {
+ test_LayerLLaMA(xft::DataType::bf16, xft::DataType::int8);
+}
+
+TEST(LayerLLaMA, w_fp16_kv_fp16) {
+ test_LayerLLaMA(xft::DataType::fp16, xft::DataType::fp16);
}
-TEST(LayerLLaMA, float16_t) {
- test_LayerLLaMA<float16_t>();
+TEST(LayerLLaMA, w_fp16_kv_int8) {
+ test_LayerLLaMA(xft::DataType::fp16, xft::DataType::int8);
+}
+
+TEST(LayerLLaMA, w_bf16_int8_kv_fp16) {
+ test_LayerLLaMA(xft::DataType::bf16_int8, xft::DataType::fp16);
+}
+
+TEST(LayerLLaMA, w_bf16_int8_kv_int8) {
+ test_LayerLLaMA(xft::DataType::bf16_int8, xft::DataType::int8);
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
-}
\ No newline at end of file
+}
--
2.25.1

17
csrc/cpu/README.md Normal file
View File

@@ -0,0 +1,17 @@
# cpu-custom-ops
## 快速开始
### 1.环境准备
```shell
# 查询机器是否支持 avx512指令
lscpu | grep avx512*
```
### 2.安装 cpu 自定义算子和第三方库
```shell
#建议在 gcc 9.4.0 下安装第三方库
bash setup.sh
```
**Note:**
包含 avx 指令 CPU 机器大模型推理教程 [X86 CPU](../../llm/docs/cpu_install.md)

68
csrc/cpu/setup.sh Normal file
View File

@@ -0,0 +1,68 @@
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#0.环境准备:安装numactl
# apt-get update
# apt-get install numactl
# 1. download XFT
if [ ! -d xFasterTransformer ]; then
git clone https://github.com/intel/xFasterTransformer.git
fi
#2.cp patch
cd xFasterTransformer
git reset --hard 420a493f5c3c74f5fdd786f5399aacd04e021df7
cd ..
if lscpu | grep -q "avx512_bf16"; then
echo "apply bf16 and fp16."
if [ ! -f 0001-fp16_bf16.patch ]; then
echo "Error: 0001-fp16_bf16.patch not exist."
exit 1
fi
# apply patch
cp ./0001-fp16_bf16.patch ./xFasterTransformer/paddle.patch
else
echo "apply fp32 "
if [ ! -f 0001-fp32.patch ]; then
echo "Error: does 0001-fp32.patch not exist."
exit 1
fi
cp ./0001-fp32.patch ./xFasterTransformer/paddle.patch
fi
#3. apply patch
cd xFasterTransformer
git apply paddle.patch
#4. build xFasterTransformer
cd 3rdparty
bash prepare_oneccl.sh
source ./oneccl/build/_install/env/setvars.sh
cd ..
rm -rf build
mkdir build && cd build
cmake ..
make -j
cd ..
#xft
export XFT_HEADER_DIR=$PWD
export XFT_LIB_DIR=$XFT_HEADER_DIR/build
export LD_LIBRARY_PATH=$XFT_LIB_DIR:$LD_LIBRARY_PATH
#setup cpu paddle_nlp ops
cd ..
python ./src/setup_cpu.py install --user

View File

@@ -0,0 +1,160 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "dtype.h"
#include "matmul_helper.h"
#include "my_types.h"
#include "paddle/extension.h"
template <typename T>
void AvxCompute(const paddle::Tensor &x,
const paddle::Tensor &weight,
bool trans,
const std::string alog,
paddle::Tensor &out,
xft::Matrix<T> &quantizedWeight,
xft::Vector<float> &WeightScale,
xft::Vector<float> &WeightZero,
xft::Vector<float> &WeightSum,
MMHelper *mmHelper) {
auto out_data = out.data<float>();
const float *x_data = reinterpret_cast<const float *>(x.data<float>());
const float *bias_data = nullptr;
int m = 1;
for (int i = 0; i < x.shape().size() - 1; i++) {
m = m * x.shape()[i];
}
int k = x.shape()[x.shape().size() - 1];
int l = weight.shape()[1];
int n = weight.shape()[1];
mmHelper->compute(false,
m,
n,
k,
1.0f,
x_data,
k,
quantizedWeight.Data(),
WeightScale.Data(),
WeightZero.Data(),
WeightSum.Data(),
0.0,
out_data,
l);
};
template <typename T>
void AvxWeightOnly(const paddle::Tensor &x,
const paddle::Tensor &weight,
bool trans,
const std::string alog,
paddle::Tensor &out) {
static std::unordered_map<std::string,
std::tuple<xft::Matrix<T> *,
xft::Vector<float> *,
xft::Vector<float> *,
xft::Vector<float> *>>
weight_only_hub;
std::stringstream weights_addr;
weights_addr << weight.data<float>() << alog;
std::string weight_only_key = weights_addr.str();
auto it_created = weight_only_hub.find(weight_only_key);
static MMHelper *mmHelper;
int rows = weight.shape()[0], cols = weight.shape()[1];
xft::Vector<float> *WeightScale =
new xft::Vector<float>(); // if weight is int8
xft::Vector<float> *WeightZero =
new xft::Vector<float>(); // if weight is int8
xft::Vector<float> *WeightSum =
new xft::Vector<float>(); // if weight is int8
xft::Matrix<T> *quantizedWeight = new xft::Matrix<T>();
if (it_created == weight_only_hub.end()) {
auto weight_ptr = reinterpret_cast<const float *>(weight.data<float>());
xft::Matrix<T> convertedWeight;
mmHelper = new MMHelper(xft::DeviceKind::iCPU, 0);
mmHelper->convertWeight(trans,
rows,
cols,
weight_ptr,
nullptr,
nullptr,
convertedWeight,
*WeightScale,
*WeightZero,
*WeightSum);
quantizedWeight->Resize(rows, cols);
mmHelper->packWeight(trans, convertedWeight, *quantizedWeight);
weight_only_hub[weight_only_key] =
std::make_tuple(quantizedWeight, WeightScale, WeightZero, WeightSum);
AvxCompute<T>(x,
weight,
trans,
alog,
out,
*quantizedWeight,
*WeightScale,
*WeightZero,
*WeightSum,
mmHelper);
} else {
AvxCompute<T>(x,
weight,
trans,
alog,
out,
*(std::get<0>(it_created->second)),
*(std::get<1>(it_created->second)),
*(std::get<2>(it_created->second)),
*(std::get<3>(it_created->second)),
mmHelper);
}
}
std::vector<paddle::Tensor> InvokeAvxWeightOnly(const paddle::Tensor &x,
const paddle::Tensor &weight,
const std::string &alog,
bool trans) {
auto out_shape = x.shape();
out_shape[out_shape.size() - 1] = weight.shape()[1];
auto out = paddle::empty(out_shape, x.dtype(), paddle::CPUPlace());
if (alog == "int8") {
AvxWeightOnly<int8_t>(x, weight, trans, alog, out);
} else if (alog == "fp16") {
AvxWeightOnly<float16_t>(x, weight, trans, alog, out);
} else {
AvxWeightOnly<float16_t>(x, weight, trans, alog, out);
}
return {out};
}
std::vector<std::vector<int64_t>> AvxWeightOnlyInferShape(
std::vector<int64_t> x_shape,
std::vector<int64_t> weight_shape) {
int m = 1;
for (int i = 0; i < x_shape.size() - 1; i++) {
m = m * x_shape[i];
}
return {std::vector<int64_t>{m, weight_shape[1]}};
}
std::vector<paddle::DataType> AvxWeightOnlyInferDtype(
paddle::DataType x_dtype,
paddle::DataType weight_dtype) {
return {x_dtype};
}
PD_BUILD_OP(avx_weight_only)
.Inputs({"x", "weight"})
.Outputs({"out"})
.Attrs({"alog: std::string", "trans:bool"})
.SetKernelFn(PD_KERNEL(InvokeAvxWeightOnly))
.SetInferShapeFn(PD_INFER_SHAPE(AvxWeightOnlyInferShape))
.SetInferDtypeFn(PD_INFER_DTYPE(AvxWeightOnlyInferDtype));

View File

@@ -0,0 +1,56 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/extension.h"
void set_value_by_flag_and_id(const bool *stop_flags, int64_t *pre_ids_all, const int64_t *pre_ids, const int64_t *step_idx, int bs, int length) {
for (int bi=0;bi<bs;bi++){
if(!stop_flags[bi]){
int64_t *pre_ids_all_now = pre_ids_all + bi * length;
if (step_idx[bi] >= 0) {
pre_ids_all_now[step_idx[bi]] = pre_ids[bi];
}
}
}
}
std::vector<paddle::Tensor> SetValueByFlagsAndIdx(const paddle::Tensor& pre_ids_all, const paddle::Tensor& pre_ids_now, const paddle::Tensor& step_idx, const paddle::Tensor& stop_flags) {
std::vector<int64_t> pre_ids_all_shape = pre_ids_all.shape();
auto stop_flags_out = stop_flags.copy_to(stop_flags.place(), false);
int bs = stop_flags.shape()[0];
int length = pre_ids_all_shape[1];
set_value_by_flag_and_id(stop_flags.data<bool>(), const_cast<int64_t*>(pre_ids_all.data<int64_t>()), pre_ids_now.data<int64_t>(), step_idx.data<int64_t>(), bs, length);
return {stop_flags_out};
}
std::vector<std::vector<int64_t>> SetValueByFlagsAndIdxInferShape(const std::vector<int64_t>& pre_ids_all_shape, const std::vector<int64_t>& pre_ids_now_shape,
const std::vector<int64_t>& step_idx_shape, const std::vector<int64_t>& stop_flags_shape) {
return {stop_flags_shape};
}
std::vector<paddle::DataType> SetValueByFlagsAndIdxInferDtype(const paddle::DataType& pre_ids_all_dtype,
const paddle::DataType& pre_ids_now_dtype,
const paddle::DataType& step_idx_dtype,
const paddle::DataType& stop_flags_dtype) {
return {stop_flags_dtype};
}
PD_BUILD_OP(set_value_by_flags_and_idx)
.Inputs({"pre_ids_all", "pre_ids_now", "step_idx", "stop_flags"})
.Outputs({"stop_flags_out"})
.SetKernelFn(PD_KERNEL(SetValueByFlagsAndIdx))
.SetInferShapeFn(PD_INFER_SHAPE(SetValueByFlagsAndIdxInferShape))
.SetInferDtypeFn(PD_INFER_DTYPE(SetValueByFlagsAndIdxInferDtype));

134
csrc/cpu/src/setup_cpu.py Normal file
View File

@@ -0,0 +1,134 @@
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import site
import subprocess
from paddle.utils.cpp_extension import CppExtension, setup
# from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext
# refer: https://note.qidong.name/2018/03/setup-warning-strict-prototypes
# Avoid a gcc warning below:
# cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid
# for C/ObjC but not for C++
class BuildExt(build_ext):
def build_extensions(self):
if "-Wstrict-prototypes" in self.compiler.compiler_so:
self.compiler.compiler_so.remove("-Wstrict-prototypes")
super().build_extensions()
def check_avx512_bf16__support():
try:
result = subprocess.run(
["lscpu", "|", "grep", '"avx512_bf16"'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
shell=True,
)
if "avx512_bf16" in result.stdout.lower():
return True
else:
return False
except Exception as e:
print(f"Error checking AVX512 support: {e}")
return False
paddle_extra_compile_args = [
"-std=c++17",
"-shared",
"-fPIC",
"-Wno-parentheses",
"-DPADDLE_WITH_CUSTOM_KERNEL",
"-mavx512f",
"-mavx512vl",
"-fopenmp",
"-mavx512bw",
"-mno-mmx",
"-Wall",
"-march=skylake-avx512",
"-O3",
"-g",
]
if check_avx512_bf16__support():
paddle_extra_compile_args += [
"-DAVX512_BF16_WEIGHT_ONLY_BF16=true",
"-DAVX512_FP16_WEIGHT_ONLY_INT8=true",
"-DAVX512_FP16_WEIGHT_ONLY_FP16=true",
]
else:
paddle_extra_compile_args += [
"-DAVX512_FP32_WEIGHT_ONLY_FP16=true",
"-DAVX512_FP32_WEIGHT_ONLY_INT8=true",
]
# include path
site_packages_path = site.getsitepackages()
paddle_custom_kernel_include = [os.path.join(path, "paddle", "include") for path in site_packages_path]
XFT_INCLUDE_DIR = os.environ["XFT_HEADER_DIR"]
XFT_LIBRARY_DIR = os.environ["XFT_LIB_DIR"]
# include path third_party
paddle_custom_kernel_include += [
os.path.join(XFT_INCLUDE_DIR, "include"),
os.path.join(XFT_INCLUDE_DIR, "src/common"),
os.path.join(XFT_INCLUDE_DIR, "src/kernel"),
os.path.join(XFT_INCLUDE_DIR, "src/layers"),
os.path.join(XFT_INCLUDE_DIR, "src/models"),
os.path.join(XFT_INCLUDE_DIR, "src/utils"),
os.path.join(XFT_INCLUDE_DIR, "3rdparty/onednn/include"),
os.path.join(XFT_INCLUDE_DIR, "3rdparty/onednn/build/include"),
os.path.join(XFT_INCLUDE_DIR, "3rdparty/xdnn"),
os.path.join(XFT_INCLUDE_DIR, "3rdparty"),
os.path.join(XFT_INCLUDE_DIR, "3rdparty/mkl/include"),
]
# libs path
paddle_custom_kernel_library_dir = [os.path.join(path, "paddle", "base") for path in site_packages_path]
paddle_custom_kernel_library_dir += [XFT_LIBRARY_DIR]
libs = [":libxfastertransformer.so", ":libxft_comm_helper.so"]
custom_kernel_dot_module = CppExtension(
sources=[
"../gpu/save_with_output.cc",
"./src/token_penalty_multi_scores.cc",
"./src/stop_generation_multi_ends.cc",
"./src/set_value_by_flags.cc",
"./src/xft_transformer.cc",
"./src/avx_weight_only.cc",
"./src/xft_greedy_search.cc",
],
include_dirs=paddle_custom_kernel_include,
library_dirs=paddle_custom_kernel_library_dir,
libraries=libs,
extra_compile_args=paddle_extra_compile_args,
)
setup(
name="paddlenlp_ops",
version="1.0",
description="custom kernel for compiling",
ext_modules=[custom_kernel_dot_module],
)

View File

@@ -0,0 +1,87 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <vector>
#include "paddle/extension.h"
bool is_in_end(const int64_t id, const int64_t *end_ids, int length) {
bool flag = false;
for (int i = 0; i < length; i++) {
if (id == end_ids[i]) {
return true;
}
}
return flag;
}
void set_value_by_flags(const bool* stop_flags,
const int64_t* end_ids,
int64_t* topk_ids,
bool* stop_flags_out,
const int bs,
int end_length) {
for (int bi = 0; bi < bs; bi++) {
topk_ids[bi] = stop_flags[bi] ? end_ids[0] : topk_ids[bi];
if (is_in_end(topk_ids[bi], end_ids, end_length)) {
stop_flags_out[bi] = true;
}
}
}
std::vector<paddle::Tensor> GetStopFlagsMulti(const paddle::Tensor& topk_ids,
const paddle::Tensor& stop_flags,
const paddle::Tensor& end_ids) {
PD_CHECK(topk_ids.dtype() == paddle::DataType::INT64);
PD_CHECK(stop_flags.dtype() == paddle::DataType::BOOL);
std::vector<int64_t> shape = topk_ids.shape();
int64_t bs_now = shape[0];
int64_t end_length = end_ids.shape()[0];
auto topk_ids_out = topk_ids.copy_to(topk_ids.place(), false);
auto stop_flags_out = stop_flags.copy_to(stop_flags.place(), false);
set_value_by_flags(stop_flags.data<bool>(),
end_ids.data<int64_t>(),
topk_ids_out.data<int64_t>(),
stop_flags_out.data<bool>(),
bs_now,
end_length);
return {topk_ids_out, stop_flags_out};
}
std::vector<std::vector<int64_t>> GetStopFlagsMultiInferShape(
const std::vector<int64_t>& topk_ids_shape,
const std::vector<int64_t>& stop_flags_shape,
const std::vector<int64_t>& end_ids_shape) {
return {topk_ids_shape, stop_flags_shape};
}
std::vector<paddle::DataType> GetStopFlagsMultiInferDtype(
const paddle::DataType& topk_ids_dtype,
const paddle::DataType& stop_flags_dtype,
const paddle::DataType& end_ids_dtype) {
return {topk_ids_dtype, stop_flags_dtype};
}
PD_BUILD_OP(set_stop_value_multi_ends)
.Inputs({"topk_ids", "stop_flags", "end_ids"})
.Outputs({"topk_ids_out", "stop_flags_out"})
.SetKernelFn(PD_KERNEL(GetStopFlagsMulti))
.SetInferShapeFn(PD_INFER_SHAPE(GetStopFlagsMultiInferShape))
.SetInferDtypeFn(PD_INFER_DTYPE(GetStopFlagsMultiInferDtype));

View File

@@ -0,0 +1,192 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <paddle/extension.h>
#include <vector>
template <typename T>
void min_length_logits_process(T* logits,
const int64_t* cur_len,
const int64_t* min_len,
const int64_t* eos_token_id,
const int64_t bs,
const int64_t length,
const int64_t end_length) {
for (int bi = 0; bi < bs; ++bi) {
if (cur_len[bi] < 0) {
continue;
}
if (cur_len[bi] < min_len[bi]) {
for (int i = 0; i < end_length; ++i) {
logits[bi * length + eos_token_id[i]] = -1e10;
}
}
}
}
void update_repeat_times(const int64_t* pre_ids,
const int64_t* cur_len,
int* repeat_times,
const int64_t bs,
const int64_t length,
const int64_t length_id) {
for (int bi = 0; bi < bs; ++bi) {
if (cur_len[bi] < 0) {
continue;
}
const int64_t* pre_ids_now = pre_ids + bi * length_id;
int* repeat_times_now = repeat_times + bi * length;
for (int i = 0; i < length_id; i++) {
int64_t id = pre_ids_now[i];
if (id < 0) {
break;
}
repeat_times_now[id] += 1;
}
}
}
template <typename T>
void update_value_by_repeat_times(const int* repeat_times,
const T* penalty_scores,
const T* frequency_score,
const T* presence_score,
T* logits,
const int64_t bs,
const int64_t length) {
for (int bi = 0; bi < bs; ++bi) {
T* logits_now = logits + bi * length;
const int* repeat_times_now = repeat_times + bi * length;
float alpha = static_cast<float>(penalty_scores[bi]);
float beta = static_cast<float>(frequency_score[bi]);
float gamma = static_cast<float>(presence_score[bi]);
for (int i = 0; i < length; ++i) {
int times = repeat_times_now[i];
if (times == 0) continue;
float logit_now = static_cast<float>(logits_now[i]);
logit_now = logit_now < 0 ? logit_now * alpha : logit_now / alpha;
logits_now[i] = static_cast<T>(logit_now - times * beta - gamma);
}
}
}
template <paddle::DataType D>
std::vector<paddle::Tensor> token_penalty_multi_scores_kernel(
const paddle::Tensor& pre_ids,
const paddle::Tensor& logits,
const paddle::Tensor& penalty_scores,
const paddle::Tensor& frequency_score,
const paddle::Tensor& presence_score,
const paddle::Tensor& cur_len,
const paddle::Tensor& min_len,
const paddle::Tensor& eos_token_id) {
std::vector<int64_t> shape = logits.shape();
auto repeat_times =
paddle::full(shape, 0, paddle::DataType::INT32, pre_ids.place());
int64_t bs = shape[0];
int64_t length = shape[1];
int64_t length_id = pre_ids.shape()[1];
auto logits_out = logits.copy_to(logits.place(), false);
int64_t end_length = eos_token_id.shape()[0];
min_length_logits_process(const_cast<float*>(logits_out.data<float>()),
cur_len.data<int64_t>(),
min_len.data<int64_t>(),
eos_token_id.data<int64_t>(),
bs,
length,
end_length);
update_repeat_times(pre_ids.data<int64_t>(),
cur_len.data<int64_t>(),
repeat_times.data<int>(),
bs,
length,
length_id);
update_value_by_repeat_times(
repeat_times.data<int>(),
const_cast<float*>(penalty_scores.data<float>()),
const_cast<float*>(frequency_score.data<float>()),
const_cast<float*>(presence_score.data<float>()),
const_cast<float*>(logits_out.data<float>()),
bs,
length);
return {logits_out};
}
std::vector<paddle::Tensor> TokenPenaltyMultiScores(
const paddle::Tensor& pre_ids,
const paddle::Tensor& logits,
const paddle::Tensor& penalty_scores,
const paddle::Tensor& frequency_scores,
const paddle::Tensor& presence_scores,
const paddle::Tensor& cur_len,
const paddle::Tensor& min_len,
const paddle::Tensor& eos_token_id) {
switch (logits.type()) {
case paddle::DataType::FLOAT32: {
return token_penalty_multi_scores_kernel<paddle::DataType::FLOAT32>(
pre_ids,
logits,
penalty_scores,
frequency_scores,
presence_scores,
cur_len,
min_len,
eos_token_id);
}
default: {
PD_THROW(
"NOT supported data type. "
"Only float32 are supported. ");
break;
}
}
}
std::vector<std::vector<int64_t>> TokenPenaltyMultiScoresInferShape(
const std::vector<int64_t>& pre_ids_shape,
const std::vector<int64_t>& logits_shape,
const std::vector<int64_t>& penalty_scores_shape,
const std::vector<int64_t>& frequency_scores_shape,
const std::vector<int64_t>& presence_scores_shape,
const std::vector<int64_t>& cur_len_shape,
const std::vector<int64_t>& min_len_shape,
const std::vector<int64_t>& eos_token_id_shape) {
return {logits_shape};
}
std::vector<paddle::DataType> TokenPenaltyMultiScoresInferDtype(
const paddle::DataType& pre_ids_dtype,
const paddle::DataType& logits_dtype,
const paddle::DataType& penalty_scores_dtype,
const paddle::DataType& frequency_scores_dtype,
const paddle::DataType& presence_scores_dtype,
const paddle::DataType& cur_len_dtype,
const paddle::DataType& min_len_dtype,
const paddle::DataType& eos_token_id_dtype) {
return {logits_dtype};
}
PD_BUILD_OP(get_token_penalty_multi_scores)
.Inputs({"pre_ids",
"logits",
"penalty_scores",
"frequency_scores",
"presence_scores",
"cur_len",
"min_len",
"eos_token_id"})
.Outputs({"logits_out"})
.SetKernelFn(PD_KERNEL(TokenPenaltyMultiScores))
.SetInferShapeFn(PD_INFER_SHAPE(TokenPenaltyMultiScoresInferShape))
.SetInferDtypeFn(PD_INFER_DTYPE(TokenPenaltyMultiScoresInferDtype));

View File

@@ -0,0 +1,131 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <omp.h>
#include <cstdio>
#include <iostream>
#include "paddle/extension.h"
void GreedySearch(const float *probs,
int64_t *next_token_ids,
int bsz,
int vocab_size) {
int numThreads = 0;
#pragma omp parallel
{
int tid = omp_get_thread_num();
if (tid == 0) {
numThreads = omp_get_num_threads();
}
}
// Max ID and value for each sample
// std::vector<int> maxIds(batchSize);
float maxVals[bsz];
// Small batch size (each sample can have at least 2 threads)
if (numThreads / bsz >= 2) {
int thrPerSample = numThreads / bsz;
int sizePerThr = (vocab_size + thrPerSample - 1) / thrPerSample;
int maxIndices[bsz * thrPerSample];
float maxValues[bsz * thrPerSample];
// TODO: if size is small, possible to cause out of boundary
#pragma omp parallel for collapse(2)
for (int b = 0; b < bsz; ++b) {
for (int t = 0; t < thrPerSample;
++t) { // thread index inside the sample
int start = t * sizePerThr;
int end = (start + sizePerThr) > vocab_size ? vocab_size
: (start + sizePerThr);
const float *p = probs + b * vocab_size;
int maxIdx = start;
float maxVal = p[start];
for (int off = start + 1; off < end; ++off) {
if (p[off] > maxVal) {
maxVal = p[off];
maxIdx = off;
}
}
// False sharing happens, but since only one time, not avoided
maxIndices[b * thrPerSample + t] = maxIdx;
maxValues[b * thrPerSample + t] = maxVal;
}
}
// Local reduction
for (int i = 0; i < bsz; ++i) {
int *pIndices = maxIndices + i * thrPerSample;
float *pValues = maxValues + i * thrPerSample;
int maxIdx = pIndices[0];
float maxVal = pValues[0];
for (int j = 1; j < thrPerSample; ++j) {
if (pValues[j] > maxVal) {
maxVal = pValues[j];
maxIdx = pIndices[j];
}
}
next_token_ids[i] = maxIdx;
maxVals[i] = maxVal;
}
}
// Each thread handle one sample (one row)
else {
#pragma omp parallel for
for (int i = 0; i < bsz; ++i) {
int maxId = 0;
const float *p = probs + i * vocab_size;
float maxVal = p[0];
for (int j = 1; j < vocab_size; ++j) {
if (p[j] > maxVal) {
maxVal = p[j];
maxId = j;
}
}
next_token_ids[i] = maxId;
maxVals[i] = maxVal;
}
}
return;
}
std::vector<paddle::Tensor> XftGreedySearch(const paddle::Tensor &probs) {
const int bsz = probs.shape()[0];
const int vocab_size = probs.shape()[1];
auto next_tokens =
paddle::empty({bsz, 1}, paddle::DataType::INT64, probs.place());
GreedySearch(probs.data<float>(),
const_cast<int64_t *>(next_tokens.data<int64_t>()),
bsz,
vocab_size);
return {next_tokens};
}
std::vector<std::vector<int64_t>> XftGreedySearchInferShape(
const std::vector<int64_t> &probs_shape) {
int64_t bsz = probs_shape[0];
return {{bsz, 1}};
}
std::vector<paddle::DataType> XftGreedySearchInferDtype(
const paddle::DataType &probs_dtype) {
return {paddle::DataType::INT64};
}
PD_BUILD_OP(xft_greedy_search)
.Inputs({"probs"})
.Outputs({"next_tokens_ids"})
.SetInferShapeFn(PD_INFER_SHAPE(XftGreedySearchInferShape))
.SetInferDtypeFn(PD_INFER_DTYPE(XftGreedySearchInferDtype))
.SetKernelFn(PD_KERNEL(XftGreedySearch));

View File

@@ -0,0 +1,190 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "layers_decoder.h"
#include "paddle/extension.h"
std::vector<paddle::Tensor> InvokeXftTransformer(
const paddle::Tensor &input,
const std::vector<paddle::Tensor> &ln1Gamma,
const std::vector<paddle::Tensor> &qkvWeight,
const std::vector<paddle::Tensor> &attnOutWeight,
const std::vector<paddle::Tensor> &ln2Gamma,
const std::vector<paddle::Tensor> &gateWeight,
const std::vector<paddle::Tensor> &upWeight,
const std::vector<paddle::Tensor> &downWeight,
const paddle::Tensor &pastSeqLen,
const paddle::Tensor &currentSeqLen,
const paddle::Tensor &step,
int hiddensize,
int totalLayer,
const std::string &computeType,
const std::string &cacheType,
const std::string &activation,
const std::string &normType,
int attHeadDim,
int attHeadNum,
int kvHeadNum,
int maxPositions,
int maxPosEmbed,
int intermediateSize) {
auto out = paddle::empty_like(input);
auto batchSize = input.shape()[0];
auto inputSeqLen = input.shape()[1];
auto past_seq_len = pastSeqLen.data<int64_t>()[0];
auto cur_seq_len = currentSeqLen.data<int64_t>()[0];
auto step_id = step.data<int64_t>()[0];
auto output_ptr = reinterpret_cast<void *>(out.data<float>());
auto xft_data_type = xft::DataType::fp16;
if (computeType == "bf16") {
xft_data_type = xft::DataType::bf16;
} else if (computeType == "bf16_int8") {
xft_data_type = xft::DataType::bf16_int8;
} else if (computeType == "fp16_int8") {
xft_data_type = xft::DataType::fp16_int8;
}
auto kvc_type = xft::DataType::fp16;
if (cacheType == "int8") {
kvc_type = xft::DataType::int8;
}
auto rope_type = xft::RopeType::LLAMA_ROPE;
auto act_type = xft::ActivationType::SILU;
if (activation == "relu") {
act_type = xft::ActivationType::RELU;
} else if (activation == "gelu") {
act_type = xft::ActivationType::GELU;
} else if (activation == "swiglu") {
act_type = xft::ActivationType::SWIGLU;
}
auto norm_type = xft::NormType::RMS;
if (normType == "layernorm") {
norm_type = xft::NormType::LN;
}
auto input_ptr = reinterpret_cast<const void *>(input.data<float>());
auto gate_bias_ptr = nullptr;
auto up_bias_ptr = nullptr;
auto down_bias_ptr = nullptr;
auto ln2Beta_ptr = nullptr;
auto qkvBiasWeight_ptr = nullptr;
auto attnOutBias_ptr = nullptr;
auto ln1Beta_ptr = nullptr;
for (int i = 0; i < totalLayer; ++i) {
auto ln1Gamma_ptr =
reinterpret_cast<const float *>(ln1Gamma[i].data<float>());
auto qkvWeight_ptr =
reinterpret_cast<const void *>(qkvWeight[i].data<float>());
auto attnOutWeight_ptr =
reinterpret_cast<const void *>(attnOutWeight[i].data<float>());
auto ln2Gamma_ptr =
reinterpret_cast<const float *>(ln2Gamma[i].data<float>());
auto gate_weight_ptr =
reinterpret_cast<const void *>(gateWeight[i].data<float>());
auto up_weight_ptr =
reinterpret_cast<const void *>(upWeight[i].data<float>());
auto down_weight_ptr =
reinterpret_cast<const void *>(downWeight[i].data<float>());
invokeLayerLLaMA(
xft_data_type, // dt
kvc_type, // kvcdt
rope_type, // rope
act_type, // at
norm_type, // nt
batchSize, // batchSize
inputSeqLen, // inputSeqLen
attHeadDim, // attHeadDim
attHeadNum, // attHeadNum
kvHeadNum, // kvHeadNum
maxPositions, // maxPositions
maxPosEmbed, // maxPosEmbed
past_seq_len, // pastSeqLen
cur_seq_len, // currentSeqLen
step_id, // step
hiddensize, // hiddenSize
intermediateSize, // intermediateSize
(void *)output_ptr, // output
hiddensize, // outputStride
input_ptr, // input
hiddensize, // inputStride
ln1Gamma_ptr, // ln1Gamma
ln1Beta_ptr, // ln1Beta
qkvWeight_ptr, // queryWeight
qkvWeight_ptr + hiddensize, // keyWeight
qkvWeight_ptr + hiddensize + kvHeadNum * attHeadDim, // valueWeight
attnOutWeight_ptr, // attnOutWeight
ln2Gamma_ptr, // ln2Gamma
ln2Beta_ptr, // ln2Beta
gate_weight_ptr,
up_weight_ptr,
down_weight_ptr,
nullptr, // queryBias
nullptr, // keyBias
nullptr, // valueBias
attnOutBias_ptr, // attnOutBias
qkvWeight_ptr, // myqkvWeight
gate_bias_ptr,
up_bias_ptr,
down_bias_ptr,
qkvBiasWeight_ptr);
if (i < totalLayer - 1) {
memcpy(const_cast<void *>(input_ptr),
output_ptr,
batchSize * inputSeqLen * hiddensize * sizeof(float));
}
}
return {out};
}
std::vector<std::vector<int64_t>> XftTransformerInferShape(
std::vector<int64_t> x_shape) {
return {x_shape};
}
std::vector<paddle::DataType> XftTransformerInferDtype(
paddle::DataType x_dtype) {
return {x_dtype};
}
PD_BUILD_OP(xft_transformer)
.Inputs({
"x",
paddle::Vec("ln1Gamma"),
paddle::Vec("qkvWeight"),
paddle::Vec("attnOutWeight"),
paddle::Vec("ln2Gamma"),
paddle::Vec("gateWeight"),
paddle::Vec("upWeight"),
paddle::Vec("downWeight"),
"pastSeqLen",
"currentSeqLen",
"step",
})
.Outputs({"out"})
.Attrs({"hiddensize :int",
"totalLayer :int",
"computeType : std::string",
"cacheType :std::string",
"activation :std::string",
"normType :std::string",
"attHeadDim: int",
"attHeadNum: int",
"kvHeadNum: int",
"maxPositions: int",
"maxPosEmbed: int",
"intermediateSize: int"})
.SetKernelFn(PD_KERNEL(InvokeXftTransformer))
.SetInferShapeFn(PD_INFER_SHAPE(XftTransformerInferShape))
.SetInferDtypeFn(PD_INFER_DTYPE(XftTransformerInferDtype));

125
csrc/gpu/all_reduce.cu Normal file
View File

@@ -0,0 +1,125 @@
// Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "helper.h"
#include "all_reduce.cuh"
// Fake pointer type, must match fptr_t type in ops.h.
// We use this type alias to indicate when pointers are passed in as int64_t.
using fptr_t = int64_t;
static_assert(sizeof(void*) == sizeof(fptr_t));
fptr_t init_custom_all_reduce(const std::vector<fptr_t>& fake_ipc_ptrs,
paddle::Tensor& rank_data, int64_t rank,
bool full_nvlink) {
int world_size = fake_ipc_ptrs.size();
if (world_size > 8)
throw std::invalid_argument("world size > 8 is not supported");
if (world_size % 2 != 0)
throw std::invalid_argument("Odd num gpus is not supported for now");
if (rank < 0 || rank >= world_size)
throw std::invalid_argument("invalid rank passed in");
paddle::Signal* ipc_ptrs[8];
for (int i = 0; i < world_size; i++) {
ipc_ptrs[i] = reinterpret_cast<paddle::Signal*>(fake_ipc_ptrs[i]);
}
return (fptr_t) new paddle::CustomAllreduce(ipc_ptrs, rank_data.data(),
rank_data.numel(), rank, world_size,
full_nvlink);
}
/**
* Performs an out-of-place allreduce and stores result in out.
*
* If _reg_buffer is null, assumes inp.data() is already IPC-registered.
* Otherwise, _reg_buffer is assumed to be IPC-registered and inp is first
* copied into _reg_buffer.
*/
void all_reduce(fptr_t _fa, paddle::Tensor& inp, paddle::Tensor& out,
fptr_t _reg_buffer, int64_t reg_buffer_sz_bytes) {
auto fa = reinterpret_cast<paddle::CustomAllreduce*>(_fa);
auto stream = inp.stream();
auto input_size = inp.numel() * 2;
auto reg_buffer = reinterpret_cast<void*>(_reg_buffer);
if (reg_buffer) {
cudaMemcpyAsync(reg_buffer, inp.data(), input_size,
cudaMemcpyDeviceToDevice, stream);
} else {
reg_buffer = inp.data();
}
switch (out.dtype()) {
case phi::DataType::FLOAT32: {
fa->allreduce<float>(stream, reinterpret_cast<float*>(reg_buffer),
reinterpret_cast<float*>(out.data()),
out.numel());
break;
}
case phi::DataType::FLOAT16: {
fa->allreduce<half>(stream, reinterpret_cast<half*>(reg_buffer),
reinterpret_cast<half*>(out.data()), out.numel());
break;
}
#if (!defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800)
case phi::DataType::BFLOAT16: {
fa->allreduce<nv_bfloat16>(
stream, reinterpret_cast<nv_bfloat16*>(reg_buffer),
reinterpret_cast<nv_bfloat16*>(out.data()), out.numel());
break;
}
#endif
default:
throw std::runtime_error(
"custom allreduce only supports float32, float16 and bfloat16");
}
}
void dispose(fptr_t _fa) {
delete reinterpret_cast<paddle::CustomAllreduce*>(_fa);
}
int64_t meta_size() { return sizeof(paddle::Signal); }
void register_buffer(fptr_t _fa, const std::vector<fptr_t>& fake_ipc_ptrs) {
auto fa = reinterpret_cast<paddle::CustomAllreduce*>(_fa);
void* ipc_ptrs[8];
for (int i = 0; i < fake_ipc_ptrs.size(); i++) {
ipc_ptrs[i] = reinterpret_cast<void*>(fake_ipc_ptrs[i]);
}
fa->register_buffer(ipc_ptrs);
}
// Use vector<int64_t> to represent byte data for python binding compatibility.
std::tuple<std::vector<int64_t>, std::vector<int64_t>>
get_graph_buffer_ipc_meta(fptr_t _fa) {
auto fa = reinterpret_cast<paddle::CustomAllreduce*>(_fa);
auto [handle, offsets] = fa->get_graph_buffer_ipc_meta();
std::vector<int64_t> bytes(handle.begin(), handle.end());
return std::make_tuple(bytes, offsets);
}
// Use vector<int64_t> to represent byte data for python binding compatibility.
void register_graph_buffers(fptr_t _fa,
const std::vector<std::vector<int64_t>>& handles,
const std::vector<std::vector<int64_t>>& offsets) {
auto fa = reinterpret_cast<paddle::CustomAllreduce*>(_fa);
std::vector<std::string> bytes;
bytes.reserve(handles.size());
for (int i = 0; i < handles.size(); i++) {
bytes.emplace_back(handles[i].begin(), handles[i].end());
}
bytes.reserve(handles.size());
fa->register_graph_buffers(bytes, offsets);
}

528
csrc/gpu/all_reduce.cuh Normal file
View File

@@ -0,0 +1,528 @@
// Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <cuda.h>
#include <cuda_bf16.h>
#include <cuda_fp16.h>
#include <cuda_runtime.h>
#include <iostream>
#include <array>
#include <limits>
#include <map>
#include <unordered_map>
#include <vector>
#define CUDACHECK(cmd) \
do { \
cudaError_t e = cmd; \
if (e != cudaSuccess) { \
printf("Failed: Cuda error %s:%d '%s'\n", __FILE__, __LINE__, \
cudaGetErrorString(e)); \
exit(EXIT_FAILURE); \
} \
} while (0)
namespace paddle {
constexpr int kMaxBlocks = 36;
// Counter may overflow, but it's fine since unsigned int overflow is
// well-defined behavior.
using FlagType = uint32_t;
struct Signal {
alignas(128) FlagType self_counter[kMaxBlocks][8];
// Two sets of peer counters are needed for two syncs. The reason is that
// it's possible for peer GPU block to arrive at the second sync point while
// the current GPU block haven't passed the first sync point. Thus, peer GPU
// may write counter+1 while current GPU is busy waiting for counter. We use
// alternating counter array to avoid this possibility.
alignas(128) FlagType peer_counter[2][kMaxBlocks][8];
};
struct __align__(16) RankData {
const void* __restrict__ ptrs[8];
};
struct __align__(16) RankSignals {
Signal* signals[8];
};
// like std::array, but aligned
template <typename T, int sz>
struct __align__(alignof(T) * sz) array_t {
T data[sz];
using type = T;
static constexpr int size = sz;
};
// use packed type to maximize memory efficiency
// goal: generate ld.128 and st.128 instructions
template <typename T>
struct packed_t {
// the (P)acked type for load/store
using P = array_t<T, 16 / sizeof(T)>;
// the (A)ccumulator type for reduction
using A = array_t<float, 16 / sizeof(T)>;
};
#define DINLINE __device__ __forceinline__
// scalar cast functions
DINLINE float upcast_s(half val) { return __half2float(val); }
template <typename T>
DINLINE T downcast_s(float val);
template <>
DINLINE half downcast_s(float val) {
return __float2half(val);
}
// scalar add functions
// for some reason when compiling with Paddle, the + operator for half and
// bfloat is disabled so we call the intrinsics directly
DINLINE half& assign_add(half& a, half b) {
a = __hadd(a, b);
return a;
}
DINLINE float& assign_add(float& a, float b) { return a += b; }
#if (!defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800)
DINLINE float upcast_s(nv_bfloat16 val) { return __bfloat162float(val); }
template <>
DINLINE nv_bfloat16 downcast_s(float val) {
return __float2bfloat16(val);
}
DINLINE nv_bfloat16& assign_add(nv_bfloat16& a, nv_bfloat16 b) {
a = __hadd(a, b);
return a;
}
#endif
template <typename T, int N>
DINLINE array_t<T, N>& packed_assign_add(array_t<T, N>& a, array_t<T, N> b) {
#pragma unroll
for (int i = 0; i < N; i++) {
assign_add(a.data[i], b.data[i]);
}
return a;
}
template <typename T, int N>
DINLINE array_t<float, N> upcast(array_t<T, N> val) {
if constexpr (std::is_same<T, float>::value) {
return val;
} else {
array_t<float, N> out;
#pragma unroll
for (int i = 0; i < N; i++) {
out.data[i] = upcast_s(val.data[i]);
}
return out;
}
}
template <typename O>
DINLINE O downcast(array_t<float, O::size> val) {
if constexpr (std::is_same<typename O::type, float>::value) {
return val;
} else {
O out;
#pragma unroll
for (int i = 0; i < O::size; i++) {
out.data[i] = downcast_s<typename O::type>(val.data[i]);
}
return out;
}
}
static DINLINE void st_flag_release(FlagType* flag_addr, FlagType flag) {
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 700
asm volatile("st.release.sys.global.u32 [%1], %0;" ::"r"(flag),
"l"(flag_addr));
#else
asm volatile("membar.sys; st.volatile.global.u32 [%1], %0;" ::"r"(flag),
"l"(flag_addr));
#endif
}
static DINLINE FlagType ld_flag_acquire(FlagType* flag_addr) {
FlagType flag;
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 700
asm volatile("ld.acquire.sys.global.u32 %0, [%1];"
: "=r"(flag)
: "l"(flag_addr));
#else
asm volatile("ld.volatile.global.u32 %0, [%1]; membar.gl;"
: "=r"(flag)
: "l"(flag_addr));
#endif
return flag;
}
static DINLINE void st_flag_volatile(FlagType* flag_addr, FlagType flag) {
asm volatile("st.volatile.global.u32 [%1], %0;" ::"r"(flag), "l"(flag_addr));
}
static DINLINE FlagType ld_flag_volatile(FlagType* flag_addr) {
FlagType flag;
asm volatile("ld.volatile.global.u32 %0, [%1];"
: "=r"(flag)
: "l"(flag_addr));
return flag;
}
// is_start: whether this is the very first synchronization barrier.
// need_fence: whether a memory fence is needed. If true, a release-acquire
// semantic is used to enforce memory access order before and after this
// barrier.
template <int ngpus, bool is_start, bool need_fence = false>
DINLINE void multi_gpu_barrier(const RankSignals& sg, Signal* self_sg,
int rank) {
if constexpr (!is_start) __syncthreads();
static_assert(
!(is_start && need_fence)); // Start barrier shouldn't need fence.
if (threadIdx.x < ngpus) {
// Increment the counter. Technically we only need one counter, but we use
// multiple per block to eliminate the need to share the counter via smem.
auto val = self_sg->self_counter[blockIdx.x][threadIdx.x] += 1;
// Write the expected counter value to peer and wait for correct value from
// peer.
auto peer_counter_ptr =
&sg.signals[threadIdx.x]->peer_counter[val % 2][blockIdx.x][rank];
auto self_counter_ptr =
&self_sg->peer_counter[val % 2][blockIdx.x][threadIdx.x];
if constexpr (need_fence) {
st_flag_release(peer_counter_ptr, val);
while (ld_flag_acquire(self_counter_ptr) != val);
} else {
st_flag_volatile(peer_counter_ptr, val);
while (ld_flag_volatile(self_counter_ptr) != val);
}
}
if constexpr (is_start || need_fence) __syncthreads();
}
template <typename P, int ngpus, typename A>
DINLINE P packed_reduce(const P* ptrs[], int idx) {
A tmp = upcast(ptrs[0][idx]);
#pragma unroll
for (int i = 1; i < ngpus; i++) {
packed_assign_add(tmp, upcast(ptrs[i][idx]));
}
return downcast<P>(tmp);
}
template <typename T, int ngpus>
__global__ void __launch_bounds__(512, 1)
cross_device_reduce_1stage(RankData* _dp, RankSignals sg, Signal* self_sg,
T* __restrict__ result, int rank, int size) {
using P = typename packed_t<T>::P;
using A = typename packed_t<T>::A;
// note: we don't reorder the address so the accumulation order is the same
// for all ranks, ensuring bitwise identical results
auto dp = *_dp;
multi_gpu_barrier<ngpus, true>(sg, self_sg, rank);
// do the actual reduction
for (int idx = blockIdx.x * blockDim.x + threadIdx.x; idx < size;
idx += gridDim.x * blockDim.x) {
((P*)result)[idx] = packed_reduce<P, ngpus, A>((const P**)&dp.ptrs[0], idx);
}
multi_gpu_barrier<ngpus, false>(sg, self_sg, rank);
}
template <typename P>
DINLINE P* get_tmp_buf(Signal* sg) {
return (P*)(((Signal*)sg) + 1);
}
template <typename T, int ngpus>
__global__ void __launch_bounds__(512, 1)
cross_device_reduce_2stage(RankData* _dp, RankSignals sg, Signal* self_sg,
T* __restrict__ result, int rank, int size) {
int tid = blockIdx.x * blockDim.x + threadIdx.x;
int stride = gridDim.x * blockDim.x;
using P = typename packed_t<T>::P;
using A = typename packed_t<T>::A;
int part = size / ngpus;
int start = rank * part;
int end = rank == ngpus - 1 ? size : start + part;
int largest_part = part + size % ngpus;
const P* ptrs[ngpus];
P* tmps[ngpus];
#pragma unroll
for (int i = 0; i < ngpus; i++) {
int target = (rank + i) % ngpus;
ptrs[i] = (const P*)_dp->ptrs[target];
tmps[i] = get_tmp_buf<P>(sg.signals[target]);
}
auto tmp_out = tmps[0];
multi_gpu_barrier<ngpus, true>(sg, self_sg, rank);
// stage 1: reduce scatter
for (int idx = start + tid; idx < end; idx += stride) {
tmp_out[idx - start] = packed_reduce<P, ngpus, A>(ptrs, idx);
}
multi_gpu_barrier<ngpus, false, true>(sg, self_sg, rank);
// stage 2: allgather. Note: it's important to match the tid between
// the two stages, because visibility across devices is only guaranteed
// between threads that have the same tid. If thread i computes the sum of
// start + i in the first stage, then thread i also gathers start + i from all
// ranks.
for (int idx = tid; idx < largest_part; idx += stride) {
#pragma unroll
for (int i = 0; i < ngpus; i++) {
int gather_from_rank = ((rank + i) % ngpus);
if (gather_from_rank == ngpus - 1 || idx < part) {
int dst_idx = gather_from_rank * part + idx;
((P*)result)[dst_idx] = tmps[i][idx];
}
}
}
}
using IPC_KEY = std::array<uint8_t, sizeof(cudaIpcMemHandle_t)>;
static_assert(sizeof(IPC_KEY) == sizeof(cudaIpcMemHandle_t));
static_assert(alignof(IPC_KEY) == alignof(cudaIpcMemHandle_t));
class CustomAllreduce {
public:
int rank_;
int world_size_;
bool full_nvlink_;
RankSignals sg_;
// Stores an map from a pointer to its peer pointters from all ranks.
std::unordered_map<void*, RankData*> buffers_;
Signal* self_sg_;
// Stores rank data from all ranks. This is mainly for cuda graph purposes.
// For cuda graph to work, all kernel arguments must be fixed during graph
// capture time. However, the peer pointers are not known during graph capture
// time. Therefore, during capture, we increment the rank data pointer and use
// that as the argument to the kernel. The kernel arguments are stored in
// graph_unreg_buffers_. The actual peer pointers will be filled in at the
// memory pointed to by the pointers in graph_unreg_buffers_ when
// the IPC handles are exchanged between ranks.
//
// The overall process looks like this:
// 1. Graph capture.
// 2. Each rank obtains the IPC handles for each addresses used during cuda
// graph capture using get_graph_buffer_ipc_meta.
// 3. (In Python) all gather the IPC handles.
// 4. Obtain the peer pointers by opening the IPC handles, and store them in
// the rank data array at corresponding positions.
RankData *d_rank_data_base_, *d_rank_data_end_;
std::vector<void*> graph_unreg_buffers_;
// a map from IPC handles to opened IPC pointers
std::map<IPC_KEY, char*> ipc_handles_;
/**
* Signals are an array of ipc-enabled buffers from all ranks.
* For each of the buffer, the layout is as follows:
* | -- sizeof(Signal) -- | ------ a few MB ----- |
* The first section is for allreduce synchronization, and the second section
* is for storing the intermediate results required by some allreduce algos.
*
* Note: this class does not own any device memory. Any required buffers
* are passed in from the constructor.
*/
CustomAllreduce(Signal** signals, void* rank_data, size_t rank_data_sz,
int rank, int world_size, bool full_nvlink = true)
: rank_(rank),
world_size_(world_size),
full_nvlink_(full_nvlink),
self_sg_(signals[rank]),
d_rank_data_base_(reinterpret_cast<RankData*>(rank_data)),
d_rank_data_end_(d_rank_data_base_ + rank_data_sz / sizeof(RankData)) {
for (int i = 0; i < world_size_; i++) {
sg_.signals[i] = signals[i];
}
}
char* open_ipc_handle(const void* ipc_handle) {
auto [it, new_handle] =
ipc_handles_.insert({*((IPC_KEY*)ipc_handle), nullptr});
if (new_handle) {
char* ipc_ptr;
CUDACHECK(cudaIpcOpenMemHandle((void**)&ipc_ptr,
*((const cudaIpcMemHandle_t*)ipc_handle),
cudaIpcMemLazyEnablePeerAccess));
it->second = ipc_ptr;
}
return it->second;
}
std::pair<std::string, std::vector<int64_t>> get_graph_buffer_ipc_meta() {
auto num_buffers = graph_unreg_buffers_.size();
auto handle_sz = sizeof(cudaIpcMemHandle_t);
std::string handles(handle_sz * num_buffers, static_cast<char>(0));
std::vector<int64_t> offsets(num_buffers);
for (int i = 0; i < num_buffers; i++) {
auto ptr = graph_unreg_buffers_[i];
void* base_ptr;
// note: must share the base address of each allocation, or we get wrong
// address
if (cuPointerGetAttribute(&base_ptr,
CU_POINTER_ATTRIBUTE_RANGE_START_ADDR,
(CUdeviceptr)ptr) != CUDA_SUCCESS)
throw std::runtime_error("failed to get pointer attr");
CUDACHECK(cudaIpcGetMemHandle(
(cudaIpcMemHandle_t*)&handles[i * handle_sz], base_ptr));
offsets[i] = ((char*)ptr) - ((char*)base_ptr);
}
return std::make_pair(handles, offsets);
}
void check_rank_data_capacity(size_t num = 1) {
if (d_rank_data_base_ + num > d_rank_data_end_)
throw std::runtime_error(
"Rank data buffer is overflowed by " +
std::to_string(d_rank_data_base_ + num - d_rank_data_end_));
}
/**
* Register already-shared IPC pointers.
*/
void register_buffer(void** ptrs) {
check_rank_data_capacity();
RankData data;
for (int i = 0; i < world_size_; i++) {
data.ptrs[i] = ptrs[i];
}
auto d_data = d_rank_data_base_++;
CUDACHECK(
cudaMemcpy(d_data, &data, sizeof(RankData), cudaMemcpyHostToDevice));
buffers_[ptrs[rank_]] = d_data;
}
// Note: when registering graph buffers, we intentionally choose to not
// deduplicate the addresses. That means if the allocator reuses some
// addresses, they will be registered again. This is to account for the remote
// possibility of different allocation patterns between ranks. For example,
// rank 1 may get the same input address for the second allreduce, but rank 2
// got a different address. IPC handles have internal reference counting
// mechanism so overhead should be small.
void register_graph_buffers(
const std::vector<std::string>& handles,
const std::vector<std::vector<int64_t>>& offsets) {
auto num_buffers = graph_unreg_buffers_.size();
check_rank_data_capacity(num_buffers);
std::vector<RankData> rank_data(num_buffers);
for (int i = 0; i < num_buffers; i++) {
auto self_ptr = graph_unreg_buffers_[i];
auto& rd = rank_data[i];
for (int j = 0; j < world_size_; j++) {
if (j != rank_) {
char* handle =
open_ipc_handle(&handles[j][i * sizeof(cudaIpcMemHandle_t)]);
handle += offsets[j][i];
rd.ptrs[j] = handle;
} else {
rd.ptrs[j] = self_ptr;
}
}
}
CUDACHECK(cudaMemcpy(d_rank_data_base_, rank_data.data(),
sizeof(RankData) * num_buffers,
cudaMemcpyHostToDevice));
d_rank_data_base_ += num_buffers;
graph_unreg_buffers_.clear();
}
/**
* Performs allreduce, assuming input has already been registered.
*
* Block and grid default configs are results after careful grid search. Using
* 36 blocks give the best or close to the best runtime on the devices I
* tried: A100, A10, A30, T4, V100. You'll notice that NCCL kernels also only
* take a small amount of SMs. Not quite sure the underlying reason, but my
* guess is that too many SMs will cause contention on NVLink bus.
*/
template <typename T>
void allreduce(cudaStream_t stream, T* input, T* output, int size,
int threads = 512, int block_limit = 36) {
// std::cout<<"input "<< input <<" output "<< output<<std::endl;
auto d = packed_t<T>::P::size;
if (size % d != 0)
throw std::runtime_error(
"custom allreduce currently requires input length to be multiple "
"of " +
std::to_string(d));
if (block_limit > kMaxBlocks)
throw std::runtime_error("max supported block limit is " +
std::to_string(kMaxBlocks) + ". Got " +
std::to_string(block_limit));
RankData* ptrs;
cudaStreamCaptureStatus status;
CUDACHECK(cudaStreamIsCapturing(stream, &status));
if (status == cudaStreamCaptureStatusActive) {
ptrs = d_rank_data_base_ + graph_unreg_buffers_.size();
graph_unreg_buffers_.push_back(input);
} else {
auto it = buffers_.find(input);
if (it == buffers_.end())
throw std::runtime_error(
"buffer address " +
std::to_string(reinterpret_cast<uint64_t>(input)) +
" is not registered!");
ptrs = it->second;
}
size /= d;
auto bytes = size * sizeof(typename packed_t<T>::P);
int blocks = std::min(block_limit, (size + threads - 1) / threads);
#define KL(ngpus, name) \
name<T, ngpus><<<blocks, threads, 0, stream>>>(ptrs, sg_, self_sg_, output, \
rank_, size);
// TODO(hanzhi713): Threshold is different for A100 and H100.
// Add per device threshold.
#define REDUCE_CASE(ngpus) \
case ngpus: { \
if (world_size_ == 2) { \
KL(ngpus, cross_device_reduce_1stage); \
} else if (full_nvlink_) { \
if ((world_size_ <= 4 && bytes < 512 * 1024) || \
(world_size_ <= 8 && bytes < 256 * 1024)) { \
KL(ngpus, cross_device_reduce_1stage); \
} else { \
KL(ngpus, cross_device_reduce_2stage); \
} \
} \
break; \
}
switch (world_size_) {
REDUCE_CASE(2)
REDUCE_CASE(4)
REDUCE_CASE(6)
REDUCE_CASE(8)
default:
throw std::runtime_error(
"custom allreduce only supports num gpus in (2,4,6,8). Actual num "
"gpus = " +
std::to_string(world_size_));
}
#undef REDUCE_CASE
#undef KL
}
~CustomAllreduce() {
for (auto [_, ptr] : ipc_handles_) {
CUDACHECK(cudaIpcCloseMemHandle(ptr));
}
}
};
} // namespace paddle

30
csrc/gpu/all_reduce.h Normal file
View File

@@ -0,0 +1,30 @@
// Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "helper.h"
using fptr_t = int64_t;
fptr_t init_custom_all_reduce(const std::vector<int64_t>& fake_ipc_ptrs,
paddle::Tensor& rank_data, int64_t rank, bool full_nvlink);
void all_reduce(fptr_t _fa, paddle::Tensor& inp, paddle::Tensor& out,
fptr_t reg_buffer, int64_t reg_buffer_sz_bytes);
void dispose(fptr_t _fa);
int64_t meta_size();
void register_buffer(fptr_t _fa, const std::vector<int64_t>& fake_ipc_ptrs);
std::tuple<std::vector<int64_t>, std::vector<int64_t>>
get_graph_buffer_ipc_meta(fptr_t _fa);
void register_graph_buffers(fptr_t _fa,
const std::vector<std::vector<int64_t>>& handles,
const std::vector<std::vector<int64_t>>& offsets);

View File

@@ -0,0 +1,980 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "append_attn/append_attention_kernel.h"
#include "append_attn/decoder_write_cache_with_rope_kernel.h"
#include "append_attn/speculate_write_cache_with_rope_kernel.h"
#include "append_attn/encoder_write_cache_with_rope_kernel.h"
template <paddle::DataType D>
std::vector<paddle::Tensor> AppendAttentionKernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv,
const paddle::Tensor& key_cache,
const paddle::Tensor& value_cache,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::Tensor& encoder_batch_ids,
const paddle::Tensor& encoder_tile_ids_per_batch,
const paddle::Tensor& encoder_num_blocks,
const paddle::Tensor& kv_batch_ids,
const paddle::Tensor& kv_tile_ids_per_batch,
const paddle::Tensor& kv_num_blocks,
const paddle::Tensor& decoder_batch_ids,
const paddle::Tensor& decoder_tile_ids_per_batch,
const paddle::Tensor& decoder_num_blocks,
const paddle::Tensor& max_enc_len_this_time,
const paddle::Tensor& max_dec_len_this_time,
const paddle::Tensor& max_len_kv,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>& qkv_bias,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& cache_k_quant_scales,
const paddle::optional<paddle::Tensor>& cache_v_quant_scales,
const paddle::optional<paddle::Tensor>& cache_k_dequant_scales,
const paddle::optional<paddle::Tensor>& cache_v_dequant_scales,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const paddle::optional<paddle::Tensor>& out_linear_shifts,
const paddle::optional<paddle::Tensor>& out_linear_smooths,
const paddle::optional<paddle::Tensor>& excess_blocks,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_input_length,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float out_linear_in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool speculate_decoder) {
typedef PDTraits<D> traits_;
typedef typename traits_::DataType DataType_;
typedef typename traits_::data_t data_t;
int encoder_num_blocks_data = encoder_num_blocks.data<int>()[0];
int kv_num_blocks_data = kv_num_blocks.data<int>()[0];
int decoder_num_blocks_data = decoder_num_blocks.data<int>()[0];
int max_enc_len_this_time_data = max_enc_len_this_time.data<int>()[0];
int max_dec_len_this_time_data = max_dec_len_this_time.data<int>()[0];
int max_len_kv_data = max_len_kv.data<int>()[0];
const int encoder_block_shape_q = get_encoder_block_shape_q();
const int decoder_block_shape_q = get_decoder_block_shape_q();
auto main_stream = qkv.stream();
static cudaEvent_t main_event;
static cudaEvent_t decoder_event;
static cudaStream_t decoder_stream;
static bool init_flag = false;
if (max_enc_len_this_time_data > 0 && max_dec_len_this_time_data > 0 &&
!init_flag) {
cudaEventCreateWithFlags(&main_event, cudaEventDisableTiming);
cudaEventCreateWithFlags(&decoder_event, cudaEventDisableTiming);
cudaStreamCreateWithFlags(&decoder_stream, cudaStreamNonBlocking);
init_flag = true;
}
paddle::Tensor qkv_out;
if (qkv_out_scales) {
qkv_out = GetEmptyTensor(qkv.dims(), D, qkv.place());
} else {
qkv_out = qkv;
}
paddle::Tensor fmha_out;
if (out_linear_in_scale > 0.0) {
if (fabs(quant_max_bound - 127.0f) < 0.000001) {
fmha_out = GetEmptyTensor(
{meta_data.token_nums, meta_data.q_num_heads * meta_data.head_dims_v},
paddle::DataType::INT8,
qkv.place());
}
else if (fabs(quant_max_bound - 448.0f) < 0.000001) {
fmha_out = GetEmptyTensor(
{meta_data.token_nums, meta_data.q_num_heads * meta_data.head_dims_v},
paddle::DataType::FLOAT8_E4M3FN,
qkv.place());
}else{
PD_THROW("Only supported attr of quant_max_bound in ['127.0', '448.0'].");
}
} else {
fmha_out = GetEmptyTensor(
{meta_data.token_nums, meta_data.q_num_heads * meta_data.head_dims_v},
D,
qkv.place());
}
if (max_enc_len_this_time_data > 0) {
if (max_dec_len_this_time_data > 0) {
cudaEventRecord(main_event, main_stream);
}
if (qkv_out_scales) {
EncoderWriteCacheWithRopeKernel<data_t, int>(
meta_data,
qkv,
seq_lens_this_time,
seq_lens_encoder,
seq_lens_decoder,
padding_offsets,
cum_offsets,
block_tables,
kv_batch_ids,
kv_tile_ids_per_batch,
rotary_embs,
qkv_out_scales,
qkv_bias,
cache_k_quant_scales,
cache_v_quant_scales,
cache_k_zp,
cache_v_zp,
excess_blocks,
cache_quant_type_str,
kv_num_blocks_data,
max_input_length,
use_neox_rotary_style,
main_stream,
&qkv_out,
const_cast<paddle::Tensor*>(&key_cache),
const_cast<paddle::Tensor*>(&value_cache));
} else {
EncoderWriteCacheWithRopeKernel<data_t, data_t>(
meta_data,
qkv_out,
seq_lens_this_time,
seq_lens_encoder,
seq_lens_decoder,
padding_offsets,
cum_offsets,
block_tables,
kv_batch_ids,
kv_tile_ids_per_batch,
rotary_embs,
qkv_out_scales,
qkv_bias,
cache_k_quant_scales,
cache_v_quant_scales,
cache_k_zp,
cache_v_zp,
excess_blocks,
cache_quant_type_str,
kv_num_blocks_data,
max_input_length,
use_neox_rotary_style,
main_stream,
&qkv_out,
const_cast<paddle::Tensor*>(&key_cache),
const_cast<paddle::Tensor*>(&value_cache));
}
if (out_linear_in_scale > 0.0) {
switch (fmha_out.dtype()) {
case paddle::DataType::INT8:{
CascadeAppendAttentionKernel<data_t, int8_t>(
meta_data,
qkv_out,
key_cache,
value_cache,
attn_mask,
cache_k_dequant_scales,
cache_v_dequant_scales,
cache_k_zp,
cache_v_zp,
out_linear_shifts,
out_linear_smooths,
seq_lens_this_time,
seq_lens_decoder,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
encoder_batch_ids,
encoder_tile_ids_per_batch,
cache_quant_type_str,
encoder_num_blocks_data,
encoder_block_shape_q,
max_input_length,
max_enc_len_this_time_data,
softmax_scale,
quant_max_bound,
quant_min_bound,
out_linear_in_scale,
speculate_max_draft_token_num,
causal,
false,
true,
main_stream,
&fmha_out);
break;
}
case paddle::DataType::FLOAT8_E4M3FN:{
CascadeAppendAttentionKernel<data_t, phi::dtype::float8_e4m3fn>(
meta_data,
qkv_out,
key_cache,
value_cache,
attn_mask,
cache_k_dequant_scales,
cache_v_dequant_scales,
cache_k_zp,
cache_v_zp,
out_linear_shifts,
out_linear_smooths,
seq_lens_this_time,
seq_lens_decoder,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
encoder_batch_ids,
encoder_tile_ids_per_batch,
cache_quant_type_str,
encoder_num_blocks_data,
encoder_block_shape_q,
max_input_length,
max_enc_len_this_time_data,
softmax_scale,
quant_max_bound,
quant_min_bound,
out_linear_in_scale,
speculate_max_draft_token_num,
causal,
false,
true,
main_stream,
&fmha_out);
break;
}
default:{
PD_THROW("Only supported output fmha_out of quant dtype in ['int8', 'fp8_e4m3'].");
break;
}
}
} else {
CascadeAppendAttentionKernel<data_t, data_t>(
meta_data,
qkv_out,
key_cache,
value_cache,
attn_mask,
cache_k_dequant_scales,
cache_v_dequant_scales,
cache_k_zp,
cache_v_zp,
out_linear_shifts,
out_linear_smooths,
seq_lens_this_time,
seq_lens_decoder,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
encoder_batch_ids,
encoder_tile_ids_per_batch,
cache_quant_type_str,
encoder_num_blocks_data,
encoder_block_shape_q,
max_input_length,
max_enc_len_this_time_data,
softmax_scale,
quant_max_bound,
quant_min_bound,
out_linear_in_scale,
speculate_max_draft_token_num,
causal,
false,
true,
main_stream,
&fmha_out);
}
}
if (max_dec_len_this_time_data > 0) {
cudaStream_t exec_stream;
if (max_enc_len_this_time_data > 0) {
cudaStreamWaitEvent(decoder_stream, main_event);
exec_stream = decoder_stream;
} else {
exec_stream = main_stream;
}
if (speculate_decoder) {
if (qkv_out_scales) {
SpeculateWriteCacheWithRoPEKernel<data_t, int>(
meta_data,
qkv, // [token_num, num_heads, head_dim]
seq_lens_decoder,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
rotary_embs,
qkv_out_scales,
qkv_bias,
cache_k_quant_scales,
cache_v_quant_scales,
cache_k_zp,
cache_v_zp,
cache_quant_type_str,
use_neox_rotary_style,
max_input_length,
exec_stream,
&qkv_out,
const_cast<paddle::Tensor*>(&key_cache),
const_cast<paddle::Tensor*>(&value_cache));
} else {
SpeculateWriteCacheWithRoPEKernel<data_t, data_t>(
meta_data,
qkv_out, // [token_num, num_heads, head_dim]
seq_lens_decoder,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
rotary_embs,
qkv_out_scales,
qkv_bias,
cache_k_quant_scales,
cache_v_quant_scales,
cache_k_zp,
cache_v_zp,
cache_quant_type_str,
use_neox_rotary_style,
max_input_length,
exec_stream,
&qkv_out,
const_cast<paddle::Tensor*>(&key_cache),
const_cast<paddle::Tensor*>(&value_cache));
}
} else {
if (qkv_out_scales) {
DecoderWriteCacheWithRoPEKernel<data_t, int>(
meta_data,
qkv, // [token_num, num_heads, head_dim]
seq_lens_decoder,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
rotary_embs,
qkv_out_scales,
qkv_bias,
cache_k_quant_scales,
cache_v_quant_scales,
cache_k_zp,
cache_v_zp,
cache_quant_type_str,
use_neox_rotary_style,
max_input_length,
exec_stream,
&qkv_out,
const_cast<paddle::Tensor*>(&key_cache),
const_cast<paddle::Tensor*>(&value_cache));
} else {
DecoderWriteCacheWithRoPEKernel<data_t, data_t>(
meta_data,
qkv_out, // [token_num, num_heads, head_dim]
seq_lens_decoder,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
rotary_embs,
qkv_out_scales,
qkv_bias,
cache_k_quant_scales,
cache_v_quant_scales,
cache_k_zp,
cache_v_zp,
cache_quant_type_str,
use_neox_rotary_style,
max_input_length,
exec_stream,
&qkv_out,
const_cast<paddle::Tensor*>(&key_cache),
const_cast<paddle::Tensor*>(&value_cache));
}
}
if (out_linear_in_scale > 0.0) {
switch (fmha_out.dtype()) {
case paddle::DataType::INT8:{
CascadeAppendAttentionKernel<data_t, int8_t>(
meta_data,
qkv_out,
key_cache,
value_cache,
attn_mask,
cache_k_dequant_scales,
cache_v_dequant_scales,
cache_k_zp,
cache_v_zp,
out_linear_shifts,
out_linear_smooths,
seq_lens_this_time,
seq_lens_decoder,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
decoder_batch_ids,
decoder_tile_ids_per_batch,
cache_quant_type_str,
decoder_num_blocks_data,
decoder_block_shape_q,
max_input_length,
max_len_kv_data,
softmax_scale,
quant_max_bound,
quant_min_bound,
out_linear_in_scale,
speculate_max_draft_token_num,
causal,
!speculate_decoder,
!speculate_decoder,
exec_stream,
&fmha_out);
break;
}
case paddle::DataType::FLOAT8_E4M3FN:{
CascadeAppendAttentionKernel<data_t, phi::dtype::float8_e4m3fn>(
meta_data,
qkv_out,
key_cache,
value_cache,
attn_mask,
cache_k_dequant_scales,
cache_v_dequant_scales,
cache_k_zp,
cache_v_zp,
out_linear_shifts,
out_linear_smooths,
seq_lens_this_time,
seq_lens_decoder,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
decoder_batch_ids,
decoder_tile_ids_per_batch,
cache_quant_type_str,
decoder_num_blocks_data,
decoder_block_shape_q,
max_input_length,
max_len_kv_data,
softmax_scale,
quant_max_bound,
quant_min_bound,
out_linear_in_scale,
speculate_max_draft_token_num,
causal,
!speculate_decoder,
!speculate_decoder,
exec_stream,
&fmha_out);
break;
}
default:{
PD_THROW("Only supported output fmha_out of quant dtype in ['int8', 'fp8_e4m3'].");
break;
}
}
} else {
CascadeAppendAttentionKernel<data_t, data_t>(
meta_data,
qkv_out,
key_cache,
value_cache,
attn_mask,
cache_k_dequant_scales,
cache_v_dequant_scales,
cache_k_zp,
cache_v_zp,
out_linear_shifts,
out_linear_smooths,
seq_lens_this_time,
seq_lens_decoder,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
decoder_batch_ids,
decoder_tile_ids_per_batch,
cache_quant_type_str,
decoder_num_blocks_data,
decoder_block_shape_q,
max_input_length,
max_len_kv_data,
softmax_scale,
quant_max_bound,
quant_min_bound,
out_linear_in_scale,
speculate_max_draft_token_num,
causal,
!speculate_decoder,
!speculate_decoder,
exec_stream,
&fmha_out);
}
if (max_enc_len_this_time_data > 0) {
cudaEventRecord(decoder_event, exec_stream);
cudaStreamWaitEvent(main_stream, decoder_event);
}
}
return {fmha_out, qkv_out};
}
std::vector<paddle::Tensor> AppendAttention(
const paddle::Tensor& qkv,
const paddle::Tensor& key_cache,
const paddle::Tensor& value_cache,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::Tensor& encoder_batch_ids,
const paddle::Tensor& encoder_tile_ids_per_batch,
const paddle::Tensor& encoder_num_blocks,
const paddle::Tensor& kv_batch_ids,
const paddle::Tensor& kv_tile_ids_per_batch,
const paddle::Tensor& kv_num_blocks,
const paddle::Tensor& decoder_batch_ids,
const paddle::Tensor& decoder_tile_ids_per_batch,
const paddle::Tensor& decoder_num_blocks,
const paddle::Tensor& max_enc_len_this_time,
const paddle::Tensor& max_dec_len_this_time,
const paddle::Tensor& max_len_kv,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>& qkv_bias,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& cache_k_quant_scales,
const paddle::optional<paddle::Tensor>& cache_v_quant_scales,
const paddle::optional<paddle::Tensor>& cache_k_dequant_scales,
const paddle::optional<paddle::Tensor>& cache_v_dequant_scales,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const paddle::optional<paddle::Tensor>& out_linear_shifts,
const paddle::optional<paddle::Tensor>& out_linear_smooths,
const paddle::optional<paddle::Tensor>& excess_blocks,
const std::string& compute_dtype,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_input_length,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float out_linear_in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool speculate_decoder) {
AppendAttnMetaData meta_data;
const auto& qkv_dims = qkv.dims();
const auto& key_cache_dims = key_cache.dims();
meta_data.token_nums = qkv_dims[0];
meta_data.kv_num_heads = key_cache_dims[1];
meta_data.head_dims = key_cache_dims[3];
meta_data.head_dims_v = value_cache.dims()[3];
const int q_hidden_size =
qkv_dims[qkv_dims.size() - 1] - meta_data.kv_num_heads * (meta_data.head_dims + meta_data.head_dims_v);
meta_data.q_num_heads = q_hidden_size / meta_data.head_dims;
meta_data.max_blocks_per_seq = block_tables.dims()[1];
meta_data.block_size = key_cache.dims()[2];
meta_data.batch_size = cum_offsets.dims()[0];
switch (qkv.dtype()) {
case paddle::DataType::FLOAT16: {
return AppendAttentionKernel<paddle::DataType::FLOAT16>(
meta_data,
qkv,
key_cache,
value_cache,
seq_lens_encoder,
seq_lens_decoder,
seq_lens_this_time,
padding_offsets,
cum_offsets,
block_tables,
encoder_batch_ids,
encoder_tile_ids_per_batch,
encoder_num_blocks,
kv_batch_ids,
kv_tile_ids_per_batch,
kv_num_blocks,
decoder_batch_ids,
decoder_tile_ids_per_batch,
decoder_num_blocks,
max_enc_len_this_time,
max_dec_len_this_time,
max_len_kv,
rotary_embs,
attn_mask,
qkv_bias,
qkv_out_scales,
cache_k_quant_scales,
cache_v_quant_scales,
cache_k_dequant_scales,
cache_v_dequant_scales,
cache_k_zp,
cache_v_zp,
out_linear_shifts,
out_linear_smooths,
excess_blocks,
cache_quant_type_str,
use_neox_rotary_style,
max_input_length,
softmax_scale,
quant_max_bound,
quant_min_bound,
out_linear_in_scale,
speculate_max_draft_token_num,
causal,
speculate_decoder);
}
case paddle::DataType::BFLOAT16: {
return AppendAttentionKernel<paddle::DataType::BFLOAT16>(
meta_data,
qkv,
key_cache,
value_cache,
seq_lens_encoder,
seq_lens_decoder,
seq_lens_this_time,
padding_offsets,
cum_offsets,
block_tables,
encoder_batch_ids,
encoder_tile_ids_per_batch,
encoder_num_blocks,
kv_batch_ids,
kv_tile_ids_per_batch,
kv_num_blocks,
decoder_batch_ids,
decoder_tile_ids_per_batch,
decoder_num_blocks,
max_enc_len_this_time,
max_dec_len_this_time,
max_len_kv,
rotary_embs,
attn_mask,
qkv_bias,
qkv_out_scales,
cache_k_quant_scales,
cache_v_quant_scales,
cache_k_dequant_scales,
cache_v_dequant_scales,
cache_k_zp,
cache_v_zp,
out_linear_shifts,
out_linear_smooths,
excess_blocks,
cache_quant_type_str,
use_neox_rotary_style,
max_input_length,
softmax_scale,
quant_max_bound,
quant_min_bound,
out_linear_in_scale,
speculate_max_draft_token_num,
causal,
speculate_decoder);
}
case paddle::DataType::INT32: {
if (compute_dtype == "bf16") {
return AppendAttentionKernel<paddle::DataType::BFLOAT16>(
meta_data,
qkv,
key_cache,
value_cache,
seq_lens_encoder,
seq_lens_decoder,
seq_lens_this_time,
padding_offsets,
cum_offsets,
block_tables,
encoder_batch_ids,
encoder_tile_ids_per_batch,
encoder_num_blocks,
kv_batch_ids,
kv_tile_ids_per_batch,
kv_num_blocks,
decoder_batch_ids,
decoder_tile_ids_per_batch,
decoder_num_blocks,
max_enc_len_this_time,
max_dec_len_this_time,
max_len_kv,
rotary_embs,
attn_mask,
qkv_bias,
qkv_out_scales,
cache_k_quant_scales,
cache_v_quant_scales,
cache_k_dequant_scales,
cache_v_dequant_scales,
cache_k_zp,
cache_v_zp,
out_linear_shifts,
out_linear_smooths,
excess_blocks,
cache_quant_type_str,
use_neox_rotary_style,
max_input_length,
softmax_scale,
quant_max_bound,
quant_min_bound,
out_linear_in_scale,
speculate_max_draft_token_num,
causal,
speculate_decoder);
} else if (compute_dtype == "fp16") {
return AppendAttentionKernel<paddle::DataType::FLOAT16>(
meta_data,
qkv,
key_cache,
value_cache,
seq_lens_encoder,
seq_lens_decoder,
seq_lens_this_time,
padding_offsets,
cum_offsets,
block_tables,
encoder_batch_ids,
encoder_tile_ids_per_batch,
encoder_num_blocks,
kv_batch_ids,
kv_tile_ids_per_batch,
kv_num_blocks,
decoder_batch_ids,
decoder_tile_ids_per_batch,
decoder_num_blocks,
max_enc_len_this_time,
max_dec_len_this_time,
max_len_kv,
rotary_embs,
attn_mask,
qkv_bias,
qkv_out_scales,
cache_k_quant_scales,
cache_v_quant_scales,
cache_k_dequant_scales,
cache_v_dequant_scales,
cache_k_zp,
cache_v_zp,
out_linear_shifts,
out_linear_smooths,
excess_blocks,
cache_quant_type_str,
use_neox_rotary_style,
max_input_length,
softmax_scale,
quant_max_bound,
quant_min_bound,
out_linear_in_scale,
speculate_max_draft_token_num,
causal,
speculate_decoder);
} else {
PD_THROW("Only supported attr of compute_dtype in ['fp16', 'bf16'].");
break;
}
}
default: {
PD_THROW(
"NOT supported data type. "
"Only float16 and bfloat16 are supported. ");
break;
}
}
return {paddle::Tensor{}};
}
std::vector<std::vector<int64_t>> AppendAttentionInferShape(
const std::vector<int64_t>& qkv_shape,
const std::vector<int64_t>& key_cache_shape,
const std::vector<int64_t>& value_cache_shape,
const std::vector<int64_t>& seq_lens_encoder_shape,
const std::vector<int64_t>& seq_lens_decoder_shape,
const std::vector<int64_t>& seq_lens_this_time_shape,
const std::vector<int64_t>& padding_offsets_shape,
const std::vector<int64_t>& cum_offsets_shape,
const std::vector<int64_t>& block_tables_shape,
const std::vector<int64_t>& encoder_batch_ids_shape,
const std::vector<int64_t>& encoder_tile_ids_per_batch_shape,
const std::vector<int64_t>& encoder_num_blocks_shape,
const std::vector<int64_t>& kv_batch_ids_shape,
const std::vector<int64_t>& kv_tile_ids_per_batch_shape,
const std::vector<int64_t>& kv_num_blocks_shape,
const std::vector<int64_t>& decoder_batch_ids_shape,
const std::vector<int64_t>& decoder_tile_ids_per_batch_shape,
const std::vector<int64_t>& decoder_num_blocks_shape,
const std::vector<int64_t>& max_enc_len_this_time_shape,
const std::vector<int64_t>& max_dec_len_this_time_shape,
const std::vector<int64_t>& max_len_kv_shape,
const paddle::optional<std::vector<int64_t>>& rotary_embs_shape,
const paddle::optional<std::vector<int64_t>>& attn_mask_shape,
const paddle::optional<std::vector<int64_t>>& qkv_bias_shape,
const paddle::optional<std::vector<int64_t>>& qkv_out_scales_shape,
const paddle::optional<std::vector<int64_t>>& cache_k_quant_scales_shape,
const paddle::optional<std::vector<int64_t>>& cache_v_quant_scales_shape,
const paddle::optional<std::vector<int64_t>>& cache_k_dequant_scales_shape,
const paddle::optional<std::vector<int64_t>>& cache_v_dequant_scales_shape,
const paddle::optional<std::vector<int64_t>>& cache_k_zp_shape,
const paddle::optional<std::vector<int64_t>>& cache_v_zp_shape,
const paddle::optional<std::vector<int64_t>>& out_linear_shifts_shape,
const paddle::optional<std::vector<int64_t>>& out_linear_smooths_shape,
const paddle::optional<std::vector<int64_t>>& excess_blocks_shape) {
const int token_num = qkv_shape[0];
const int kv_num_heads = key_cache_shape[1];
const int head_dim_qk = key_cache_shape[3];
const int head_dim_v = value_cache_shape[3];
const int q_hidden_size =
qkv_shape[qkv_shape.size() - 1] - kv_num_heads * (head_dim_qk + head_dim_v);
const int num_heads = q_hidden_size / head_dim_qk;
return {{token_num, num_heads * head_dim_v}, qkv_shape};
}
std::vector<paddle::DataType> AppendAttentionInferDtype(
const paddle::DataType& qkv_dtype,
const paddle::DataType& key_cache_dtype,
const paddle::DataType& value_cache_dtype,
const paddle::DataType& seq_lens_encoder_dtype,
const paddle::DataType& seq_lens_decoder_dtype,
const paddle::DataType& seq_lens_this_time_dtype,
const paddle::DataType& padding_offsets_dtype,
const paddle::DataType& cum_offsets_dtype,
const paddle::DataType& block_tables_dtype,
const paddle::DataType& encoder_batch_ids_dtype,
const paddle::DataType& encoder_tile_ids_per_batch_dtype,
const paddle::DataType& encoder_num_blocks_dtype,
const paddle::DataType& kv_batch_ids_dtype,
const paddle::DataType& kv_tile_ids_per_batch_dtype,
const paddle::DataType& kv_num_blocks_dtype,
const paddle::DataType& decoder_batch_ids_dtype,
const paddle::DataType& decoder_tile_ids_per_batch_dtype,
const paddle::DataType& decoder_num_blocks_dtype,
const paddle::DataType& max_enc_len_this_time_dtype,
const paddle::DataType& max_dec_len_this_time_dtype,
const paddle::DataType& max_len_kv_dtype,
const paddle::optional<paddle::DataType>& rotary_embs_dtype,
const paddle::optional<paddle::DataType>& attn_mask_dtype,
const paddle::optional<paddle::DataType>& qkv_bias_dtype,
const paddle::optional<paddle::DataType>& qkv_out_scales_dtype,
const paddle::optional<paddle::DataType>& cache_k_quant_scales_dtype,
const paddle::optional<paddle::DataType>& cache_v_quant_scales_dtype,
const paddle::optional<paddle::DataType>& cache_k_dequant_scales_dtype,
const paddle::optional<paddle::DataType>& cache_v_dequant_scales_dtype,
const paddle::optional<paddle::DataType>& cache_k_zp_dtype,
const paddle::optional<paddle::DataType>& cache_v_zp_dtype,
const paddle::optional<paddle::DataType>& out_linear_shifts_dtype,
const paddle::optional<paddle::DataType>& out_linear_smooths_dtype,
const paddle::optional<paddle::DataType>& excess_blocks_dtype,
const std::string& compute_dtype,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_input_length,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float out_linear_in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool speculate_decoder) {
if (compute_dtype == "bf16") {
if (out_linear_in_scale > 0.0) {
if (fabs(quant_max_bound - 127.0f) < 0.000001) {
return {paddle::DataType::INT8, paddle::DataType::BFLOAT16};
} else if (fabs(quant_max_bound - 448.0f) < 0.000001) {
return {paddle::DataType::FLOAT8_E4M3FN, paddle::DataType::BFLOAT16};
}else{
PD_THROW("Only supported attr of quant_max_bound in ['127.0', '448.0'].");
}
} else {
return {paddle::DataType::BFLOAT16, paddle::DataType::BFLOAT16};
}
} else if (compute_dtype == "fp16") {
if (out_linear_in_scale > 0.0) {
if (fabs(quant_max_bound - 127.0f) < 0.000001) {
return {paddle::DataType::INT8, paddle::DataType::FLOAT16};
} else if (fabs(quant_max_bound - 448.0f) < 0.000001) {
return {paddle::DataType::FLOAT8_E4M3FN, paddle::DataType::FLOAT16};
}else{
PD_THROW("Only supported attr of quant_max_bound in ['127.0', '448.0'].");
}
} else {
return {paddle::DataType::FLOAT16, paddle::DataType::FLOAT16};
}
} else {
PD_THROW("Only supported attr of compute_dtype in ['fp16', 'bf16'].");
}
}
PD_BUILD_OP(append_attention)
.Inputs({"qkv",
"key_cache",
"value_cache",
"seq_lens_encoder",
"seq_lens_decoder",
"seq_lens_this_time",
"padding_offsets",
"cum_offsets",
"block_tables",
"encoder_batch_ids",
"encoder_tile_ids_per_batch",
"encoder_num_blocks",
"kv_batch_ids",
"kv_tile_ids_per_batch",
"kv_num_blocks",
"decoder_batch_ids",
"decoder_tile_ids_per_batch",
"decoder_num_blocks",
"max_enc_len_this_time",
"max_dec_len_this_time",
"max_len_kv",
paddle::Optional("rotary_embs"),
paddle::Optional("attn_mask"),
paddle::Optional("qkv_bias"),
paddle::Optional("qkv_out_scales"),
paddle::Optional("cache_k_quant_scales"),
paddle::Optional("cache_v_quant_scales"),
paddle::Optional("cache_k_dequant_scales"),
paddle::Optional("cache_v_dequant_scales"),
paddle::Optional("cache_k_zp"),
paddle::Optional("cache_v_zp"),
paddle::Optional("out_linear_shifts"),
paddle::Optional("out_linear_smooths"),
paddle::Optional("excess_blocks")})
.Outputs({"fmha_out", "qkv_out", "key_cache_out", "value_cache_out"})
.SetInplaceMap({{"key_cache", "key_cache_out"},
{"value_cache", "value_cache_out"}})
.Attrs({"compute_type: std::string",
"cache_quant_type: std::string",
"use_neox_rotary_style: bool",
"max_input_length: int",
"softmax_scale: float",
"quant_max_bound: float",
"quant_min_bound: float",
"out_linear_in_scale: float",
"speculate_max_draft_token_num: int",
"causal: bool",
"speculate_decoder: bool"})
.SetKernelFn(PD_KERNEL(AppendAttention))
.SetInferShapeFn(PD_INFER_SHAPE(AppendAttentionInferShape))
.SetInferDtypeFn(PD_INFER_DTYPE(AppendAttentionInferDtype));

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,302 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "helper.h"
#include "utils.cuh"
template <typename T, typename OutT>
void CascadeAppendAttentionC16Kernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);
template <typename T, typename OutT>
void CascadeAppendAttentionC8Kernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);
template <typename T, typename OutT>
void CascadeAppendAttentionC4Kernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);
template <typename T, typename OutT>
void CascadeAppendAttentionKernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const std::string& cache_quant_type_str,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out) {
if (cache_quant_type_str == "none") {
CascadeAppendAttentionC16Kernel<T, OutT>(meta_data,
qkv,
cache_k,
cache_v,
attn_mask,
cache_k_scale,
cache_v_scale,
cache_k_zp,
cache_v_zp,
shift_bias,
smooth_weight,
seq_lens_q,
seq_lens_kv,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_table,
batch_ids,
tile_ids_per_batch,
num_blocks,
block_shape_q,
max_seq_len,
max_dec_len,
softmax_scale,
quant_max_bound,
quant_min_bound,
in_scale,
speculate_max_draft_token_num,
causal,
is_decoder,
enable_prefill,
stream,
out);
} else if (cache_quant_type_str == "cache_int8") {
CascadeAppendAttentionC8Kernel<T, OutT>(meta_data,
qkv,
cache_k,
cache_v,
attn_mask,
cache_k_scale,
cache_v_scale,
cache_k_zp,
cache_v_zp,
shift_bias,
smooth_weight,
seq_lens_q,
seq_lens_kv,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_table,
batch_ids,
tile_ids_per_batch,
num_blocks,
block_shape_q,
max_seq_len,
max_dec_len,
softmax_scale,
quant_max_bound,
quant_min_bound,
in_scale,
speculate_max_draft_token_num,
causal,
is_decoder,
enable_prefill,
stream,
out);
} else if (cache_quant_type_str == "cache_int4_zp") {
CascadeAppendAttentionC4Kernel<T, OutT>(meta_data,
qkv,
cache_k,
cache_v,
attn_mask,
cache_k_scale,
cache_v_scale,
cache_k_zp,
cache_v_zp,
shift_bias,
smooth_weight,
seq_lens_q,
seq_lens_kv,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_table,
batch_ids,
tile_ids_per_batch,
num_blocks,
block_shape_q,
max_seq_len,
max_dec_len,
softmax_scale,
quant_max_bound,
quant_min_bound,
in_scale,
speculate_max_draft_token_num,
causal,
is_decoder,
enable_prefill,
stream,
out);
} else {
PD_THROW(
"cache_quant_type_str should be one of [none, cache_int8, "
"cache_int4_zp]");
}
}

View File

@@ -0,0 +1,237 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "multi_head_latent_attention_kernel.h"
template <size_t vec_size, typename T>
struct softmax_state_t {
AlignedVector<T, vec_size> o;
T m;
T d;
__device__ __forceinline__ void init() {
if constexpr (std::is_same<T, half>::value) {
#pragma unroll
for (int i = 0; i < vec_size / 2; ++i) {
*((half2*)(&o) + i) = make_half2(0, 0);
}
} else if constexpr (std::is_same<T, __nv_bfloat16>::value) {
#pragma unroll
for (int i = 0; i < vec_size / 2; ++i) {
*((nv_bfloat162*)(&o) + i) = make_bfloat162(0, 0);
}
}
d = 1.f;
if constexpr (std::is_same<T, half>::value) {
m = __float2half(-5e4f);
} else if constexpr (std::is_same<T, nv_bfloat16>::value) {
m = __float2bfloat16(-3.38953e38f);
}
}
__device__ __forceinline__ softmax_state_t() {
init();
}
__device__ __forceinline__ void merge(const AlignedVector<T, vec_size>& other_o,
T other_m,
T other_d) {
// using kType = typename cascade_attn_nv_type2_traits<T>::type;
T m_prev = m, d_prev = d;
m = m_prev > other_m ? m_prev : other_m;
T scale1 = hexp(m_prev - m), scale2 = hexp(other_m - m);
d = d_prev * scale1 + other_d * scale2;
#pragma unroll
for (size_t i = 0; i < vec_size; ++i) {
o[i] = o[i] * scale1 + other_o[i] * scale2;
}
}
__device__ __forceinline__ void normalize() {
#pragma unroll
for (size_t i = 0; i < vec_size; ++i) {
o[i] /= d;
}
}
};
template <size_t vec_size, typename T, uint32_t num_tiles = 0>
struct softmax_state_ts {
uint32_t num_tiles_ = num_tiles;
AlignedVector<T, vec_size> o[num_tiles];
float m;
float d;
__device__ __forceinline__ void init() {
#pragma unroll
for (uint32_t tile_id = 0; tile_id < num_tiles_; ++tile_id) {
if constexpr (std::is_same<T, half>::value) {
#pragma unroll
for (int i = 0; i < vec_size / 2; ++i) {
*((half2*)(&o[tile_id]) + i) = make_half2(0, 0);
}
} else if constexpr (std::is_same<T, __nv_bfloat16>::value) {
#pragma unroll
for (int i = 0; i < vec_size / 2; ++i) {
*((nv_bfloat162*)(&o[tile_id]) + i) = make_bfloat162(0, 0);
}
}
}
d = 1.f;
if constexpr (std::is_same<T, half>::value) {
m = -5e4f;
} else if constexpr (std::is_same<T, nv_bfloat16>::value) {
m = -3.38953e38f;
}
}
__device__ __forceinline__ softmax_state_ts() {
init();
}
__device__ __forceinline__ void normalize(const uint32_t tile_id) {
#pragma unroll
for (size_t i = 0; i < vec_size; i++) {
o[tile_id][i] /= d;
}
}
};
template <SharedMemFillMode fill_mode, uint32_t HEAD_DIM_QK, uint32_t vec_size, uint32_t NUM_VEC_PER_HEAD, uint32_t bdx, uint32_t BLOCK_SIZE, uint32_t CACHE_VEC_SIZE, typename CacheT>
__device__ __forceinline__ void produce_kv(CacheT *smem,
CacheT *kv_base_gptr,
const int * block_table_smem,
const uint32_t seq_offset_gmem,
const uint32_t seq_offset_smem,
const uint32_t kv_head_idx,
const uint32_t kv_num_heads,
const uint32_t tidx,
const uint32_t chunk_start,
const uint32_t chunk_end) {
int block_id = __ldg(&block_table_smem[seq_offset_gmem / BLOCK_SIZE]);
if (block_id < 0) {
block_id = 0;
}
const uint32_t block_offset = seq_offset_gmem % BLOCK_SIZE;
// 8/16 T/int8 each time
const uint32_t k_offset_base = ((block_id * kv_num_heads + kv_head_idx) * BLOCK_SIZE + block_offset) * HEAD_DIM_QK;
const uint32_t smem_offset_base = seq_offset_smem * HEAD_DIM_QK;
for(uint32_t vid = tidx; vid < NUM_VEC_PER_HEAD; vid += bdx) {
pred_load<128, PrefetchMode::kPrefetch, fill_mode, CacheT>(
smem + smem_offset_base + vid * CACHE_VEC_SIZE,
kv_base_gptr + k_offset_base + vid * CACHE_VEC_SIZE,
seq_offset_gmem < chunk_end
);
}
}
template <uint32_t vec_size, uint32_t NUM_VEC_PER_HEAD, uint32_t bdx, uint32_t bdy, uint32_t HEAD_DIM, uint32_t DEAL_EACH_TIME, uint32_t num_tile_v, typename T, typename CacheT>
__device__ __forceinline__ void compute_qk(const T* cu_q_smem,
const CacheT* k_smem,
const uint32_t kv_idx_base,
const uint32_t stage_idx,
const uint32_t iter_base,
const uint32_t iter_bound,
const uint32_t tidx,
const uint32_t gid,
const float scale,
float *s,
softmax_state_ts<vec_size, T, num_tile_v>& st) {
const CacheT* smem;
AlignedVector<T, vec_size> q_vec;
AlignedVector<T, vec_size> k_vec;
float m_prev = st.m;
// smem = base_smem + (stage_idx * DEAL_EACH_TIME + zid * tile_size) * HEAD_DIM;
smem = k_smem + stage_idx * DEAL_EACH_TIME * HEAD_DIM;
#pragma unroll
for (uint32_t j = 0; j < DEAL_EACH_TIME; ++j) {
if (iter_base + j < iter_bound) {
if constexpr (std::is_same<T, half>::value) {
s[j] = 0.f;
} else if constexpr (std::is_same<T, __nv_bfloat16>::value) {
s[j] = 0.f;
}
#pragma unroll
for(uint32_t vid = tidx; vid < NUM_VEC_PER_HEAD; vid += bdx) {
Load<T, vec_size>(cu_q_smem + vid * vec_size, &q_vec);
Load<CacheT, vec_size>(smem + j * HEAD_DIM + vid * vec_size, &k_vec);
for (uint32_t i = 0; i < vec_size; ++i) {
s[j] += static_cast<float>(q_vec[i] * k_vec[i]);
}
}
#pragma unroll
for (uint32_t offset = bdx / 2; offset > 0; offset /= 2) {
s[j] += __shfl_xor_sync(-1, s[j], offset, 32);
}
__syncthreads();
} else {
if constexpr (std::is_same<T, half>::value) {
s[j] = -5e4f;
} else if constexpr (std::is_same<T, __nv_bfloat16>::value) {
s[j] = -3.38953e38f;
}
}
st.m = st.m > s[j] ? st.m : s[j];
}
// T o_scale = hexp(m_prev - st.m);
float o_scale = __expf(m_prev - st.m);
st.d *= o_scale;
#pragma unroll
for (uint32_t j = 0; j < DEAL_EACH_TIME; ++j) {
// s[j] = hexp(s[j] - st.m);
s[j] = __expf(s[j] - st.m);
st.d += s[j];
}
#pragma unroll
for (uint32_t tile_id = 0; tile_id < num_tile_v; ++tile_id) {
for (uint32_t i = 0; i < vec_size; ++i) {
st.o[tile_id][i] *= o_scale;
}
}
}
template<uint32_t vec_size, uint32_t NUM_VEC_PER_HEAD, uint32_t bdx, uint32_t DEAL_EACH_TIME, uint32_t HEAD_DIM_QK, uint32_t num_tile, typename T, typename CacheT>
__device__ __forceinline__ void compute_sv(const float *s,
const CacheT *base_v_smem,
const uint32_t stage_idx,
const uint32_t iter_base,
const uint32_t iter_bound,
const uint32_t tidx,
softmax_state_ts<vec_size, T, num_tile>& st) {
const CacheT* v_smem;
AlignedVector<T, vec_size> v_vec;
#pragma unroll
for (int j = 0; (j < DEAL_EACH_TIME) && (iter_base + j < iter_bound); ++j) {
v_smem = base_v_smem + stage_idx * DEAL_EACH_TIME * HEAD_DIM_QK + j * HEAD_DIM_QK;
for(uint32_t vid = tidx; vid < NUM_VEC_PER_HEAD; vid += bdx) {
Load<T, vec_size>(v_smem + vid * vec_size, &v_vec);
uint32_t tile_id = vid / bdx;
#pragma unroll
for (int reg_id = 0; reg_id < vec_size; ++reg_id) {
st.o[tile_id][reg_id] += static_cast<T>(s[j]) * v_vec[reg_id];
}
}
}
}

View File

@@ -0,0 +1,562 @@
// Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "decode_attention_func.cuh"
#define CHECK(call) \
do \
{ \
const cudaError_t error_code = call; \
if (error_code != cudaSuccess) \
{ \
printf("CUDA Error:\n"); \
printf(" File: %s\n", __FILE__); \
printf(" Line %d:\n", __LINE__); \
printf(" Error code:%d\n", error_code); \
printf(" Error text:%s\n", cudaGetErrorString(error_code)); \
exit(1); \
} \
}while(0)
template <typename T, typename OutT, int vec_size, uint32_t bdy, uint32_t HEAD_DIM>
__global__ void merge_varlen_multi_chunks_v2_kernel(const T * __restrict__ multi_out, // [bsz, num_chunks, num_heads, head_dim]
const T * __restrict__ multi_m, // [bsz, num_chunks, num_heads]
const T * __restrict__ multi_d, // [bsz, num_chunks, num_heads]
const int * __restrict__ seq_lens_q,
const int * __restrict__ seq_lens_kv,
const int * __restrict__ cum_offsets,
const T * __restrict__ shift_bias, // [q_num_heads * HEAD_DIM]
const T * __restrict__ smooth_weight, // [q_num_heads * HEAD_DIM]
OutT * __restrict__ out, // [token_num, num_heads, head_dim]
const float in_scale,
const int num_chunks,
const int chunk_size,
const int max_seq_len,
const int num_heads,
const int head_dim) {
const int vid = threadIdx.x, ty = threadIdx.y;
const int qid = blockIdx.x, hid = blockIdx.y;
const int seq_len_q = seq_lens_q[qid];
if (seq_len_q == 0) return;
int seq_len_kv = seq_lens_kv[qid];
if (seq_len_kv == 0) return;
seq_len_kv += seq_len_q;
const int num_chunks_this_seq = div_up(seq_len_kv, chunk_size);
if (num_chunks_this_seq == 1 || ty >= num_chunks_this_seq) {
return;
}
__shared__ T smem[bdy * HEAD_DIM];
__shared__ T md_smem[bdy * 2];
const int start_token_ids = qid * max_seq_len - __ldg(&cum_offsets[qid]);
using LoadT = AlignedVector<T, vec_size>;
LoadT load_vec;
LoadT res_vec;
if constexpr (std::is_same<T, half>::value) {
#pragma unroll
for (int i = 0; i < vec_size / 2; ++i) {
*((half2*)(&res_vec) + i) = make_half2(0, 0);
}
} else if constexpr (std::is_same<T, nv_bfloat16>::value) {
#pragma unroll
for (int i = 0; i < vec_size / 2; ++i) {
*((nv_bfloat162*)(&res_vec) + i) = make_bfloat162(0, 0);
}
}
T m;
T d = 1.f;
if constexpr (std::is_same<T, half>::value) {
m = __float2half(-5e4f);
} else if constexpr (std::is_same<T, nv_bfloat16>::value) {
m = __float2bfloat16(-3.38953e38f);
}
// merge per ty
#pragma unroll 2
for (int i = ty; i < num_chunks_this_seq; i += bdy) {
uint32_t offset = (qid * num_chunks + i) * num_heads + hid;
T m_prev = m;
T d_prev = d;
const T m_now = multi_m[offset];
const T d_now = multi_d[offset];
m = m_prev > m_now ? m_prev : m_now;
offset = (qid * num_chunks * num_heads + i * num_heads + hid) * head_dim + vid * vec_size;
Load<T, vec_size>(&multi_out[offset], &load_vec);
const T scale1 = hexp(m_prev - m), scale2 = hexp(m_now - m);
d = d * scale1 + d_now * scale2;
#pragma once
for (int j = 0; j < vec_size; j++) {
res_vec[j] = res_vec[j] * scale1 + load_vec[j] * scale2;
}
}
// store ty res
Store<T, vec_size>(res_vec, &smem[ty * head_dim + vid * vec_size]);
md_smem[2 * ty] = m;
md_smem[2 * ty + 1] = d;
__syncthreads();
// merge bdy
softmax_state_t<vec_size, T> st{};
const uint32_t iter_num = min(num_chunks_this_seq, bdy);
#pragma once
for (int i = 0; i < iter_num; i++) {
Load<T, vec_size>(&smem[i * head_dim + vid * vec_size], &load_vec);
const T m_tmp = md_smem[2 * i], d_tmp = md_smem[2 * i + 1];
st.merge(load_vec, m_tmp, d_tmp);
}
st.normalize();
AlignedVector<OutT, vec_size> out_vec;
#pragma unroll
for (int i = 0; i < vec_size; ++i) {
out_vec[i] = static_cast<OutT>(st.o[i]);
}
Store<OutT, vec_size>(out_vec, &out[(start_token_ids * num_heads + hid) * head_dim + vid * vec_size]);
}
template <bool partition_kv, typename T, typename OutT, typename CacheT, uint32_t NUM_STAGES, uint32_t DEAL_EACH_TIME, uint32_t GROUP_SIZE, uint32_t HEAD_DIM_QK, uint32_t HEAD_DIM_V,
uint32_t BLOCK_SIZE, uint32_t VEC_SIZE, uint32_t CACHE_VEC_SIZE, uint32_t bdx, uint32_t bdy>
__global__ void multi_query_decode_attention_kernel(T * __restrict__ q, // [token_num, num_heads, head_dim]
CacheT * __restrict__ cache_k, // [max_block_num, num_heads, block_size, head_dim]
CacheT * __restrict__ cache_v,
const T * __restrict__ shift_bias, // [q_num_heads * HEAD_DIM]
const T * __restrict__ smooth_weight, // [q_num_heads * HEAD_DIM]
const int * __restrict__ seq_lens_q,
const int * __restrict__ seq_lens_kv,
const int * __restrict__ cum_offsets,
const int * __restrict__ block_table, // [bsz, block_num_per_seq]
const int max_seq_len,
const int max_dec_len,
const int max_block_num_per_seq,
const float scale,
const float in_scale,
const uint32_t chunk_size,
T * __restrict__ tmp_workspace, // [batch_size, num_chunks, num_heads, head_dim]
T * __restrict__ tmp_m, // [batch_size, num_chunks, num_heads]
T * __restrict__ tmp_d, // [batch_size, num_chunks, num_heads]
OutT * __restrict__ out) {
constexpr uint32_t q_block_num = GROUP_SIZE / bdy;
const uint32_t bidx = blockIdx.x, kv_head_idx = blockIdx.z;
const uint32_t bid = bidx / q_block_num, q_block_idx = bidx % q_block_num;
const uint32_t bidy = threadIdx.y;
const uint32_t gid = q_block_idx * bdy + threadIdx.y;
const uint32_t tidx = threadIdx.x;
constexpr uint32_t num_vec_per_head_qk = HEAD_DIM_QK / VEC_SIZE;
constexpr uint32_t num_vec_per_head_v = HEAD_DIM_V / VEC_SIZE;
constexpr uint32_t num_tile_v = (num_vec_per_head_v + bdx - 1) / bdx;
const uint32_t q_head_idx = kv_head_idx * GROUP_SIZE + gid;
const uint32_t kv_num_heads = gridDim.z;
const uint32_t q_num_heads = kv_num_heads * GROUP_SIZE;
const int *block_table_now = block_table + bid * max_block_num_per_seq;
const uint32_t num_chunks = gridDim.y;
const uint32_t chunk_id = blockIdx.y;
const uint32_t q_len = seq_lens_q[bid];
if (q_len <= 0) {
return;
}
uint32_t kv_len = seq_lens_kv[bid]; // !!!!!!!!
if (kv_len <= 0) {
return;
}
kv_len += q_len;
const uint32_t num_chunk_this_seq = div_up(kv_len, chunk_size);
const uint32_t q_start_idx = bid * max_seq_len - __ldg(&cum_offsets[bid]);
const uint32_t q_write_idx = bid * max_seq_len - __ldg(&cum_offsets[bid]);
if (chunk_id >= num_chunk_this_seq) {
return;
}
const uint32_t chunk_start = partition_kv ? chunk_id * chunk_size : 0;
const uint32_t chunk_end = partition_kv ? min(kv_len, chunk_start + chunk_size) : kv_len;
const uint32_t chunk_len = chunk_end - chunk_start;
extern __shared__ uint8_t smem[];
const T *q_now = q + (q_start_idx * q_num_heads + q_head_idx) * HEAD_DIM_QK;
T *q_smem = reinterpret_cast<T*>(smem); // [HEAD_DIM_QK * sizeof(T)]
T *cu_q_smem = q_smem + bidy * HEAD_DIM_QK;
#pragma unroll
for(uint32_t vid = tidx; vid < num_vec_per_head_qk; vid += bdx) {
((float4*)(&cu_q_smem[vid * VEC_SIZE]))[0] = ((float4*)(&q_now[vid * VEC_SIZE]))[0];
}
__syncthreads();
using VecT = AlignedVector<T, VEC_SIZE>;
VecT q_vec;
#pragma unroll
for(uint32_t vid = tidx; vid < num_vec_per_head_qk; vid += bdx) {
Load<T, VEC_SIZE>(cu_q_smem + vid * VEC_SIZE, &q_vec);
for (uint32_t i = 0; i < VEC_SIZE; ++i) {
q_vec[i] *= scale;
}
Store<T, VEC_SIZE>(q_vec, cu_q_smem + vid * VEC_SIZE);
}
CacheT *kv_smem = reinterpret_cast<CacheT*>(smem + bdy * HEAD_DIM_QK * sizeof(CacheT));
uint32_t stage_idx = 0;
constexpr int loop_times = DEAL_EACH_TIME / bdy;
#pragma unroll
for (int i = 0; i < NUM_STAGES; ++i) {
#pragma unroll
for (int j = 0; j < loop_times; ++j) {
const uint32_t k_seq_offset = i * DEAL_EACH_TIME + j * bdy + bidy;
const uint32_t k_seq_id = chunk_start + k_seq_offset;
produce_kv<SharedMemFillMode::kNoFill, HEAD_DIM_QK, VEC_SIZE, num_vec_per_head_qk, bdx, BLOCK_SIZE, CACHE_VEC_SIZE>(
kv_smem,
cache_k,
block_table_now,
k_seq_id,
k_seq_offset,
kv_head_idx,
kv_num_heads,
tidx,
chunk_start,
chunk_end
);
}
commit_group();
stage_idx = (stage_idx + 1) % NUM_STAGES;
}
softmax_state_ts<VEC_SIZE, T, num_tile_v> st;
float s[DEAL_EACH_TIME];
const uint32_t num_iters = div_up(chunk_len, DEAL_EACH_TIME);
for (int iter = 0; iter < num_iters; ++iter) {
wait_group<NUM_STAGES - 1>();
__syncthreads();
// compute qk
compute_qk<VEC_SIZE, num_vec_per_head_qk, bdx, bdy, HEAD_DIM_QK, DEAL_EACH_TIME, num_tile_v>(
cu_q_smem,
kv_smem,
chunk_start + iter * DEAL_EACH_TIME,
stage_idx,
iter * DEAL_EACH_TIME,
chunk_len,
tidx,
gid,
scale,
s,
st
);
__syncthreads();
// compute sv
compute_sv<VEC_SIZE, num_vec_per_head_v, bdx, DEAL_EACH_TIME, HEAD_DIM_QK, num_tile_v>(
s,
kv_smem,
stage_idx,
iter * DEAL_EACH_TIME,
chunk_len,
tidx,
st
);
__syncthreads();
#pragma unroll
for (int j = 0; j < loop_times; ++j) {
const uint32_t k_seq_offset = j * bdy + bidy;
produce_kv<SharedMemFillMode::kNoFill, HEAD_DIM_QK, VEC_SIZE, num_vec_per_head_qk, bdx, BLOCK_SIZE, CACHE_VEC_SIZE>(
kv_smem,
cache_k,
block_table_now,
chunk_start + k_seq_offset + (iter + NUM_STAGES) * DEAL_EACH_TIME,
stage_idx * DEAL_EACH_TIME + k_seq_offset,
kv_head_idx,
kv_num_heads,
tidx,
chunk_start,
chunk_end
);
}
commit_group();
stage_idx = (stage_idx + 1) % NUM_STAGES;
}
wait_group<0>();
__syncthreads();
// normize if not partition_kv
for(uint32_t vid = tidx; vid < num_vec_per_head_v; vid += bdx) {
const uint32_t tile_id = vid / bdx;
if (!partition_kv || num_chunk_this_seq == 1) {
st.normalize(tile_id);
}
if (partition_kv && num_chunk_this_seq > 1) {
const uint32_t head_idx = (bid * num_chunks + chunk_id) * q_num_heads + q_head_idx;
Store<T, VEC_SIZE>(st.o[tile_id], tmp_workspace + head_idx * HEAD_DIM_V + vid * VEC_SIZE);
tmp_m[head_idx] = st.m;
tmp_d[head_idx] = st.d;
} else {
Store<OutT, VEC_SIZE>(st.o[tile_id], out + (q_write_idx * q_num_heads + q_head_idx) * HEAD_DIM_V + vid * VEC_SIZE);
}
}
}
template <typename T, uint32_t GROUP_SIZE, uint32_t HEAD_DIM_QK, uint32_t HEAD_DIM_V, uint32_t BLOCK_SIZE, bool CAUSAL, uint32_t NUM_STAGE, uint32_t cache_bytes, uint32_t DEAL_EACH_TIME>
void MultiQueryDecoderAttention(
const AppendAttnMetaData& meta_data,
cudaStream_t &stream,
const paddle::Tensor &q,
const paddle::Tensor &cache_k, // [max_block_num, num_kv_heads, block_size, head_dim]
const paddle::Tensor &cache_v, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>& shift_bias,
const paddle::optional<paddle::Tensor>& smooth_weight,
const paddle::Tensor &seq_lens_q,
const paddle::Tensor &seq_lens_kv,
const paddle::Tensor &padding_offsets,
const paddle::Tensor &cum_offsets,
const paddle::Tensor &block_table,
const int max_seq_len,
const int max_dec_len,
const float rope_scale,
const float rope_theta,
const float softmax_scale,
const float in_scale,
paddle::Tensor *out) {
using NV_TYPE = typename cascade_attn_type_traits<T>::type;
auto num_heads = meta_data.q_num_heads;
auto kv_num_heads = meta_data.kv_num_heads;
auto token_num = meta_data.token_nums;
auto bsz = meta_data.batch_size;
auto max_block_num_per_seq = meta_data.max_blocks_per_seq;
constexpr int num_stages = NUM_STAGE;
constexpr int vec_size = 16 / sizeof(T); // 8 16 32
constexpr int cache_vec_size = 128 / cache_bytes; // 8 16 32
constexpr int blockxc = HEAD_DIM_QK / cache_vec_size;
constexpr int num_vec_per_head = HEAD_DIM_QK / vec_size;
constexpr int blockx = num_vec_per_head < 32 ? num_vec_per_head : 32;
constexpr int blocky = GROUP_SIZE > 16 ? 16 : GROUP_SIZE;
const int gridx = bsz * (GROUP_SIZE / blocky);
constexpr int num_threads = blockx * blocky;
auto splitkv_kernel = multi_query_decode_attention_kernel<true, NV_TYPE, NV_TYPE, NV_TYPE, num_stages, DEAL_EACH_TIME, GROUP_SIZE, HEAD_DIM_QK, HEAD_DIM_V,
BLOCK_SIZE, vec_size, cache_vec_size, blockx, blocky>;
uint32_t cache_smem_bytes = 0;
const T *shift_bias_ptr = shift_bias ? shift_bias.get().data<T>() : nullptr;
const T *smooth_weight_ptr = smooth_weight ? smooth_weight.get().data<T>() : nullptr;
cache_smem_bytes = num_stages * DEAL_EACH_TIME * HEAD_DIM_QK * sizeof(T);
const uint32_t chunk_size = get_max_partition_size(bsz);
const int num_chunks = div_up(max_dec_len, chunk_size);
size_t smem_size = cache_smem_bytes + blocky * HEAD_DIM_QK * sizeof(T);
if (smem_size >= 48 * 1024) {
cudaFuncSetAttribute(
splitkv_kernel, cudaFuncAttributeMaxDynamicSharedMemorySize, smem_size);
}
const int dev_id = 0;
int sm_count;
int act_blocks_per_sm;
cudaDeviceGetAttribute(&sm_count, cudaDevAttrMultiProcessorCount, dev_id);
cudaOccupancyMaxActiveBlocksPerMultiprocessor(
&act_blocks_per_sm, splitkv_kernel, num_threads, smem_size);
assert(act_blocks_per_sm > 1);
const int num_blocks_per_wave = sm_count * act_blocks_per_sm;
const int num_blocks_need = gridx * num_chunks * kv_num_heads;
const int max_num_chunks = div_up(num_blocks_per_wave, num_blocks_need);
const float ratio = static_cast<float>(num_blocks_need) / static_cast<float>(num_blocks_per_wave);
dim3 grids(gridx, num_chunks, kv_num_heads);
dim3 blocks(blockx, blocky);
if (num_chunks <= 1) {
auto no_splitkv_kernel = multi_query_decode_attention_kernel<false, NV_TYPE, NV_TYPE, NV_TYPE, num_stages, DEAL_EACH_TIME, GROUP_SIZE, HEAD_DIM_QK, HEAD_DIM_V, BLOCK_SIZE, vec_size,
cache_vec_size, blockx, blocky>;
if (smem_size >= 48 * 1024) {
cudaFuncSetAttribute(
no_splitkv_kernel, cudaFuncAttributeMaxDynamicSharedMemorySize, smem_size);
}
no_splitkv_kernel<<<grids, blocks, smem_size, stream>>>(
reinterpret_cast<NV_TYPE*>(const_cast<T*>(q.data<T>())),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(cache_k.data<T>())),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(cache_v.data<T>())),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(shift_bias_ptr)),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(smooth_weight_ptr)),
seq_lens_q.data<int>(),
seq_lens_kv.data<int>(),
cum_offsets.data<int>(),
block_table.data<int>(),
max_seq_len,
max_dec_len,
max_block_num_per_seq,
softmax_scale,
in_scale,
chunk_size,
nullptr,
nullptr,
nullptr,
reinterpret_cast<NV_TYPE*>(const_cast<T*>(out->data<T>()))
);
// CHECK(cudaGetLastError());
// CHECK(cudaDeviceSynchronize());
} else {
auto *allocator = paddle::GetAllocator(q.place());
phi::Allocator::AllocationPtr tmp_workspace, tmp_m, tmp_d;
tmp_workspace = allocator->Allocate(
phi::SizeOf(q.dtype()) *
static_cast<size_t>(bsz * num_chunks * num_heads * HEAD_DIM_V));
tmp_m = allocator->Allocate(
phi::SizeOf(q.dtype()) *
static_cast<size_t>(bsz * num_chunks * num_heads));
tmp_d = allocator->Allocate(
phi::SizeOf(q.dtype()) *
static_cast<size_t>(bsz * num_chunks * num_heads));
splitkv_kernel<<<grids, blocks, smem_size, stream>>>(
reinterpret_cast<NV_TYPE*>(const_cast<T*>(q.data<T>())),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(cache_k.data<T>())),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(cache_v.data<T>())),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(shift_bias_ptr)),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(smooth_weight_ptr)),
seq_lens_q.data<int>(),
seq_lens_kv.data<int>(),
cum_offsets.data<int>(),
block_table.data<int>(),
max_seq_len,
max_dec_len,
max_block_num_per_seq,
softmax_scale,
in_scale,
chunk_size,
reinterpret_cast<NV_TYPE*>(tmp_workspace->ptr()),
reinterpret_cast<NV_TYPE*>(tmp_m->ptr()),
reinterpret_cast<NV_TYPE*>(tmp_d->ptr()),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(out->data<T>()))
);
// CHECK(cudaGetLastError());
// CHECK(cudaDeviceSynchronize());
constexpr int mblockx = HEAD_DIM_V / vec_size;
constexpr int bdy = 256 / mblockx;
dim3 grids_merge(bsz, num_heads);
dim3 blocks_merge(mblockx, bdy);
merge_varlen_multi_chunks_v2_kernel<NV_TYPE, NV_TYPE, vec_size, bdy, HEAD_DIM_V><<<grids_merge, blocks_merge, 0, stream>>>(
reinterpret_cast<NV_TYPE*>(tmp_workspace->ptr()),
reinterpret_cast<NV_TYPE*>(tmp_m->ptr()),
reinterpret_cast<NV_TYPE*>(tmp_d->ptr()),
seq_lens_q.data<int>(),
seq_lens_kv.data<int>(),
cum_offsets.data<int>(),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(shift_bias_ptr)),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(smooth_weight_ptr)),
reinterpret_cast<NV_TYPE*>(const_cast<T*>(out->data<T>())),
in_scale,
num_chunks,
chunk_size,
max_seq_len,
num_heads,
HEAD_DIM_V
);
}
// CHECK(cudaGetLastError());
// CHECK(cudaDeviceSynchronize());
}
template <typename T>
void DecodeMLAAttentionKernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor &q, // [token_num, num_heads, head_dim]
const paddle::Tensor &cache_k,
const paddle::Tensor &cache_v,
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>& shift_bias,
const paddle::optional<paddle::Tensor>& smooth_weight,
const paddle::Tensor &seq_lens_q, // q_seq_len is 1
const paddle::Tensor &seq_lens_kv,
const paddle::Tensor &padding_offsets,
const paddle::Tensor &cum_offsets,
const paddle::Tensor &block_table,
int max_seq_len,
int max_dec_len,
float softmax_scale,
float in_scale,
bool causal,
cudaStream_t &stream,
paddle::Tensor *out) {
const auto token_num = meta_data.token_nums;
const auto block_size = meta_data.block_size;
const auto bsz = meta_data.batch_size;
const auto num_heads = meta_data.q_num_heads;
const auto group_size = meta_data.q_num_heads / meta_data.kv_num_heads;
const auto head_dim_qk = meta_data.head_dims;
const auto head_dim_v = meta_data.head_dims_v;
const float rope_scale = 0.0;
const float rope_theta = 0.0;
const uint32_t deal_each_time = get_cascade_attention_deal_each_time();
const uint32_t num_stage = get_cascade_attention_num_stages();
const uint32_t num_threads = get_cascade_attention_num_threads();
DISPATCH_CAUSAL(causal, CAUSAL,
{DISPATCH_MLA_GROUP_SIZE(group_size, GROUP_SIZE,
{DISPATCH_MLA_HEAD_DIM(head_dim_qk, HEAD_DIM_QK,
{DISPATCH_MLA_HEAD_DIM(head_dim_v, HEAD_DIM_V,
{DISPATCH_BLOCK_SIZE(block_size, BLOCK_SIZE,
{DISPATCH_DEAL_EACH_TIME(deal_each_time, DEAL_EACH_TIME,
{MultiQueryDecoderAttention<T, GROUP_SIZE, HEAD_DIM_QK, HEAD_DIM_V, BLOCK_SIZE, CAUSAL, 2, 16, DEAL_EACH_TIME>(
meta_data, stream, q, cache_k, cache_v, attn_mask, shift_bias, smooth_weight, seq_lens_q, seq_lens_kv, padding_offsets, cum_offsets,
block_table, max_seq_len, max_dec_len, rope_scale, rope_theta, softmax_scale, in_scale, out);})})})})})});
}
template void DecodeMLAAttentionKernel<paddle::bfloat16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor &q, // [token_num, num_heads, head_dim]
const paddle::Tensor &cache_k,
const paddle::Tensor &cache_v,
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>& shift_bias,
const paddle::optional<paddle::Tensor>& smooth_weight,
const paddle::Tensor &seq_lens_q, // q_seq_len is 1
const paddle::Tensor &seq_lens_kv,
const paddle::Tensor &padding_offsets,
const paddle::Tensor &cum_offsets,
const paddle::Tensor &block_table,
int max_seq_len,
int max_dec_len,
float softmax_scale,
float in_scale,
bool causal,
cudaStream_t &stream,
paddle::Tensor *out);
template void DecodeMLAAttentionKernel<paddle::float16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor &q, // [token_num, num_heads, head_dim]
const paddle::Tensor &cache_k,
const paddle::Tensor &cache_v,
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>& shift_bias,
const paddle::optional<paddle::Tensor>& smooth_weight,
const paddle::Tensor &seq_lens_q, // q_seq_len is 1
const paddle::Tensor &seq_lens_kv,
const paddle::Tensor &padding_offsets,
const paddle::Tensor &cum_offsets,
const paddle::Tensor &block_table,
int max_seq_len,
int max_dec_len,
float softmax_scale,
float in_scale,
bool causal,
cudaStream_t &stream,
paddle::Tensor *out);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,722 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "decoder_write_cache_with_rope_kernel.h"
#include "utils.cuh"
template <typename T>
void DecoderWriteCacheKV(const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv,
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out) {
auto max_blocks_per_seq = meta_data.max_blocks_per_seq;
auto bsz = meta_data.batch_size;
auto block_size = meta_data.block_size;
auto head_dim_qk = meta_data.head_dims;
auto head_dim_v = meta_data.head_dims_v;
auto num_heads = meta_data.q_num_heads;
auto kv_num_heads = meta_data.kv_num_heads;
const uint32_t elem_nums = bsz * kv_num_heads * (head_dim_qk + head_dim_v);
constexpr int PackSize = 16 / sizeof(T);
const int pack_num = elem_nums / PackSize;
const int blocksize = 128;
int grid_size = 1;
GetNumBlocks<128>(pack_num, &grid_size);
append_decode_cache_T_kernel<T, PackSize>
<<<grid_size, blocksize, 0, stream>>>(
reinterpret_cast<T*>(const_cast<T*>(qkv.data<T>())),
reinterpret_cast<T*>(key_cache_out->data<T>()),
reinterpret_cast<T*>(value_cache_out->data<T>()),
block_tables.data<int>(),
padding_offsets.data<int>(),
cum_offsets.data<int>(),
seq_lens.data<int>(),
seq_lens_encoder.data<int>(),
max_seq_len,
max_blocks_per_seq,
num_heads,
head_dim_qk,
head_dim_v,
block_size,
elem_nums,
kv_num_heads);
}
template <typename T, typename QKV_TYPE>
void append_decode_cache_rope(const QKV_TYPE* qkv,
T* key_cache,
T* value_cache,
T* qkv_out,
const int* block_tables,
const int* padding_offsets,
const int* cum_offsets,
const int* seq_lens,
const int* seq_lens_encoder,
const float* cos_emb,
const float* sin_emb,
const float* qkv_out_scales,
const T* qkv_biases,
const int max_seq_len,
const int max_blocks_per_seq,
const int num_heads,
const int kv_num_heads,
const int dim_head,
const int block_size,
const int bsz,
const cudaStream_t& stream,
const bool use_neox_style) {
const uint32_t elem_nums =
use_neox_style ? bsz * (num_heads + 2 * kv_num_heads) * dim_head / 2
: bsz * (num_heads + 2 * kv_num_heads) * dim_head;
constexpr int PackSize = 16 / sizeof(T);
const int pack_num = elem_nums / PackSize;
const int blocksize = 128;
int grid_size = 1;
GetNumBlocks<128>(pack_num, &grid_size);
if (use_neox_style) {
if (qkv_out_scales) {
append_decode_cache_T_neox_rope_kernel<T, PackSize>
<<<grid_size, blocksize, 0, stream>>>(
reinterpret_cast<const int*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases,
max_seq_len,
max_blocks_per_seq,
num_heads,
dim_head,
block_size,
elem_nums,
kv_num_heads);
} else {
append_decode_cache_T_neox_rope_kernel<T, PackSize>
<<<grid_size, blocksize, 0, stream>>>(reinterpret_cast<const T*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
max_seq_len,
max_blocks_per_seq,
num_heads,
dim_head,
block_size,
elem_nums,
kv_num_heads);
}
} else {
if (qkv_out_scales) {
append_decode_cache_T_rope_kernel<T, PackSize>
<<<grid_size, blocksize, 0, stream>>>(
reinterpret_cast<const int*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases,
max_seq_len,
max_blocks_per_seq,
num_heads,
dim_head,
block_size,
elem_nums,
kv_num_heads);
} else {
append_decode_cache_T_rope_kernel<T, PackSize>
<<<grid_size, blocksize, 0, stream>>>(reinterpret_cast<const T*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
max_seq_len,
max_blocks_per_seq,
num_heads,
dim_head,
block_size,
elem_nums,
kv_num_heads);
}
}
}
template <typename T, typename QKV_TYPE>
void append_decode_cache_int8_rope(const QKV_TYPE* qkv,
uint8_t* key_cache,
uint8_t* value_cache,
T* qkv_out,
const int* block_tables,
const int* padding_offsets,
const int* cum_offsets,
const int* seq_lens,
const int* seq_lens_encoder,
const float* cos_emb,
const float* sin_emb,
const float* qkv_out_scales,
const T* qkv_biases,
const T* cache_k_scale,
const T* cache_v_scale,
const int max_seq_len,
const int max_blocks_per_seq,
const int num_heads,
const int kv_num_heads,
const int dim_head,
const int block_size,
const int bsz,
const cudaStream_t& stream,
const bool use_neox_style) {
constexpr int num_warps = 4;
const int all_warps =
((num_heads + 2 * kv_num_heads) + num_warps - 1) / num_warps * num_warps;
dim3 grids(bsz, all_warps / num_warps);
if (use_neox_style) {
if (qkv_out_scales) {
append_decode_cache_int8_neox_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(
reinterpret_cast<const int*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases,
cache_k_scale,
cache_v_scale,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
127.0f,
-127.0f,
kv_num_heads);
} else {
append_decode_cache_int8_neox_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(
reinterpret_cast<const T*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
cache_k_scale,
cache_v_scale,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
127.0f,
-127.0f,
kv_num_heads);
}
} else {
if (qkv_out_scales) {
append_decode_cache_int8_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(
reinterpret_cast<const int*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases,
cache_k_scale,
cache_v_scale,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
127.0f,
-127.0f,
kv_num_heads);
} else {
append_decode_cache_int8_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(
reinterpret_cast<const T*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
cache_k_scale,
cache_v_scale,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
127.0f,
-127.0f,
kv_num_heads);
}
}
}
template <typename T, typename QKV_TYPE>
void append_decode_cache_int4_rope(const QKV_TYPE* qkv,
uint8_t* key_cache,
uint8_t* value_cache,
T* qkv_out,
const int* block_tables,
const int* padding_offsets,
const int* cum_offsets,
const int* seq_lens,
const int* seq_lens_encoder,
const float* cos_emb,
const float* sin_emb,
const float* qkv_out_scales,
const T* qkv_biases,
const T* cache_k_scale,
const T* cache_v_scale,
const T* cache_k_zp,
const T* cache_v_zp,
const int max_seq_len,
const int max_blocks_per_seq,
const int num_heads,
const int kv_num_heads,
const int dim_head,
const int block_size,
const int bsz,
const cudaStream_t& stream,
const bool use_neox_style) {
constexpr int num_warps = 4;
const int all_warps =
((num_heads + 2 * kv_num_heads) + num_warps - 1) / num_warps * num_warps;
dim3 grids(bsz, all_warps / num_warps);
if (use_neox_style) {
if (qkv_out_scales) {
append_decode_cache_int4_neox_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(
reinterpret_cast<const int*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases,
cache_k_scale,
cache_v_scale,
cache_k_zp,
cache_v_zp,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
7.0f,
-8.0f,
kv_num_heads);
} else {
append_decode_cache_int4_neox_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(
reinterpret_cast<const T*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
cache_k_scale,
cache_v_scale,
cache_k_zp,
cache_v_zp,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
7.0f,
-8.0f,
kv_num_heads);
}
} else {
if (qkv_out_scales) {
append_decode_cache_int4_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(
reinterpret_cast<const int*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases,
cache_k_scale,
cache_v_scale,
cache_k_zp,
cache_v_zp,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
7.0f,
-8.0f,
kv_num_heads);
} else {
append_decode_cache_int4_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(
reinterpret_cast<const T*>(qkv),
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
cache_k_scale,
cache_v_scale,
cache_k_zp,
cache_v_zp,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
7.0f,
-8.0f,
kv_num_heads);
}
}
}
template <typename T, typename QKV_TYPE>
void DecoderWriteCacheWithRoPEKernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv,
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out) {
typedef cascade_attn_type_traits<T> traits_;
typedef cascade_attn_type_traits<QKV_TYPE> qkt_nv_type_;
typedef typename traits_::type DataType_;
typedef typename qkt_nv_type_::type QKV_Data_TYPE;
const QKV_TYPE* qkv_ptr = qkv.data<QKV_TYPE>();
auto max_blocks_per_seq = meta_data.max_blocks_per_seq;
auto bsz = meta_data.batch_size;
auto block_size = meta_data.block_size;
auto dim_head = meta_data.head_dims;
auto num_heads = meta_data.q_num_heads;
auto kv_num_heads = meta_data.kv_num_heads;
if (rotary_embs) {
const float* cos_emb = rotary_embs.get().data<float>();
const float* sin_emb =
use_neox_rotary_style
? rotary_embs.get().data<float>() + max_seq_len * dim_head
: rotary_embs.get().data<float>() + max_seq_len * dim_head / 2;
if (cache_quant_type_str == "none") {
append_decode_cache_rope(
reinterpret_cast<const QKV_TYPE*>(qkv_ptr),
reinterpret_cast<DataType_*>(key_cache_out->data<T>()),
reinterpret_cast<DataType_*>(value_cache_out->data<T>()),
reinterpret_cast<DataType_*>(qkv_out->data<T>()),
block_tables.data<int>(),
padding_offsets.data<int>(),
cum_offsets.data<int>(),
seq_lens.data<int>(),
seq_lens_encoder.data<int>(),
cos_emb,
sin_emb,
qkv_out_scales ? qkv_out_scales.get().data<float>() : nullptr,
qkv_biases ? reinterpret_cast<DataType_*>(
const_cast<T*>(qkv_biases.get().data<T>()))
: nullptr,
max_seq_len,
max_blocks_per_seq,
num_heads,
kv_num_heads,
dim_head,
block_size,
bsz,
stream,
use_neox_rotary_style);
} else if (cache_quant_type_str == "cache_int8") {
append_decode_cache_int8_rope(
reinterpret_cast<const QKV_TYPE*>(qkv_ptr),
key_cache_out->data<uint8_t>(),
value_cache_out->data<uint8_t>(),
reinterpret_cast<DataType_*>(qkv_out->data<T>()),
block_tables.data<int>(),
padding_offsets.data<int>(),
cum_offsets.data<int>(),
seq_lens.data<int>(),
seq_lens_encoder.data<int>(),
cos_emb,
sin_emb,
qkv_out_scales ? qkv_out_scales.get().data<float>() : nullptr,
qkv_biases ? reinterpret_cast<DataType_*>(
const_cast<T*>(qkv_biases.get().data<T>()))
: nullptr,
cache_k_scale ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_k_scale.get().data<T>()))
: nullptr,
cache_v_scale ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_v_scale.get().data<T>()))
: nullptr,
max_seq_len,
max_blocks_per_seq,
num_heads,
kv_num_heads,
dim_head,
block_size,
bsz,
stream,
use_neox_rotary_style);
} else if (cache_quant_type_str == "cache_int4_zp") {
append_decode_cache_int4_rope(
reinterpret_cast<const QKV_TYPE*>(qkv_ptr),
key_cache_out->data<uint8_t>(),
value_cache_out->data<uint8_t>(),
reinterpret_cast<DataType_*>(const_cast<T*>(qkv_out->data<T>())),
block_tables.data<int>(),
padding_offsets.data<int>(),
cum_offsets.data<int>(),
seq_lens.data<int>(),
seq_lens_encoder.data<int>(),
cos_emb,
sin_emb,
qkv_out_scales ? qkv_out_scales.get().data<float>() : nullptr,
qkv_biases ? reinterpret_cast<DataType_*>(
const_cast<T*>(qkv_biases.get().data<T>()))
: nullptr,
cache_k_scale ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_k_scale.get().data<T>()))
: nullptr,
cache_v_scale ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_v_scale.get().data<T>()))
: nullptr,
cache_k_zp ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_k_zp.get().data<T>()))
: nullptr,
cache_v_zp ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_v_zp.get().data<T>()))
: nullptr,
max_seq_len,
max_blocks_per_seq,
num_heads,
kv_num_heads,
dim_head,
block_size,
bsz,
stream,
use_neox_rotary_style);
} else {
PD_THROW(
"cache_quant_type_str should be one of [none, cache_int8, "
"cache_int4_zp]");
}
} else {
DecoderWriteCacheKV<QKV_TYPE>(meta_data,
qkv,
seq_lens,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
max_seq_len,
stream,
key_cache_out,
value_cache_out);
}
}
template void DecoderWriteCacheWithRoPEKernel<paddle::bfloat16, int>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// kv_num_heads, head_dim] if GQA)
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);
template void
DecoderWriteCacheWithRoPEKernel<paddle::bfloat16, paddle::bfloat16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// kv_num_heads, head_dim] if GQA)
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);
template void DecoderWriteCacheWithRoPEKernel<paddle::float16, int>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// kv_num_heads, head_dim] if GQA)
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);
template void DecoderWriteCacheWithRoPEKernel<paddle::float16, paddle::float16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// kv_num_heads, head_dim] if GQA)
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);

View File

@@ -0,0 +1,42 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "decoder_write_cache_with_rope_impl.cuh"
template <typename T, typename QKV_TYPE = int>
void DecoderWriteCacheWithRoPEKernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// kv_num_heads, head_dim] if GQA)
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,160 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "encoder_write_cache_with_rope_impl.cuh"
template <typename T, typename QKV_TYPE>
void EncoderWriteCacheWithRopeKernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// kv_num_heads, head_dim] if GQA)
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const paddle::optional<paddle::Tensor>& excess_blocks,
const std::string& cache_quant_type_str,
const int num_blocks,
const int max_seq_len,
const bool use_neox_style,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out) {
auto token_num = meta_data.token_nums;
auto num_heads = meta_data.q_num_heads;
auto kv_num_heads = meta_data.kv_num_heads;
auto head_dim = meta_data.head_dims;
int bsz = cum_offsets.dims()[0];
if (rotary_embs) {
if (num_heads == kv_num_heads) {
rotary_qk_variable(
qkv_out->data<T>(),
qkv.data<QKV_TYPE>(),
qkv_out_scales ? qkv_out_scales.get().data<float>() : nullptr,
qkv_biases ? qkv_biases.get().data<T>() : nullptr,
rotary_embs.get().data<float>(),
padding_offsets.data<int>(),
seq_lens_encoder.data<int>(),
seq_lens_decoder.data<int>(),
token_num,
num_heads,
max_seq_len,
rotary_embs.get().dims()[2],
head_dim,
stream,
use_neox_style);
} else {
gqa_rotary_qk_variable(
qkv_out->data<T>(),
qkv.data<QKV_TYPE>(),
qkv_out_scales ? qkv_out_scales.get().data<float>() : nullptr,
qkv_biases ? qkv_biases.get().data<T>() : nullptr,
rotary_embs.get().data<float>(),
padding_offsets.data<int>(),
seq_lens_encoder.data<int>(),
seq_lens_decoder.data<int>(),
token_num,
num_heads,
kv_num_heads,
max_seq_len,
rotary_embs.get().dims()[2],
head_dim,
stream,
use_neox_style);
}
}
const uint32_t block_size = meta_data.block_size;
if (cache_quant_type_str == "none") {
CascadeAppendWriteCacheKVQKV<T>(meta_data,
*qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens_encoder,
seq_lens_decoder,
max_seq_len,
bsz,
excess_blocks,
stream,
key_cache_out,
value_cache_out);
} else if (cache_quant_type_str == "cache_int8") {
DISPATCH_GQA_HEAD_DIM(
head_dim, HEAD_DIM, {DISPATCH_BLOCK_SIZE(block_size, BLOCK_SIZE, {
CascadeAppendWriteCacheKVC8QKV<T, HEAD_DIM, BLOCK_SIZE>(
meta_data,
*key_cache_out,
*value_cache_out,
*qkv_out,
cache_k_scale.get(),
cache_v_scale.get(),
seq_lens_this_time,
seq_lens_decoder,
padding_offsets,
cum_offsets,
block_tables,
batch_ids,
tile_ids,
num_blocks,
max_seq_len,
stream,
key_cache_out,
value_cache_out);
})})
} else if (cache_quant_type_str == "cache_int4_zp") {
DISPATCH_GQA_HEAD_DIM(
head_dim, HEAD_DIM, {DISPATCH_BLOCK_SIZE(block_size, BLOCK_SIZE, {
CascadeAppendWriteCacheKVC4QKV<T, HEAD_DIM, BLOCK_SIZE>(
meta_data,
*key_cache_out,
*value_cache_out,
*qkv_out,
cache_k_scale.get(),
cache_v_scale.get(),
cache_k_zp.get(),
cache_v_zp.get(),
seq_lens_this_time,
seq_lens_decoder,
padding_offsets,
cum_offsets,
block_tables,
batch_ids,
tile_ids,
num_blocks,
max_seq_len,
stream,
key_cache_out,
value_cache_out);
})})
} else {
PD_THROW(
"cache_quant_type_str should be one of [none, cache_int8, "
"cache_int4_zp]");
}
}

View File

@@ -0,0 +1,457 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "helper.h"
#include "paddle/extension.h"
#include "utils.cuh"
#include "cute/tensor.hpp"
template <typename T>
inline __device__ __host__ T div_up(T m, T n) {
return (m + n - 1) / n;
}
__global__ void split_q_block(const int* __restrict__ seq_lens_q,
const int* __restrict__ seq_lens_encoder,
int* __restrict__ batch_ids,
int* __restrict__ tile_ids_per_batch,
int* __restrict__ num_blocks_x,
const int bsz,
const int num_rows_per_block,
const int group_size) {
if (threadIdx.x == 0) {
int gridx = 0;
int index = 0;
for (uint32_t bid = 0; bid < bsz; bid++) {
int seq_len = seq_lens_q[bid];
if (seq_lens_encoder && seq_lens_encoder[bid] > 0) {
seq_len = 0;
}
const int loop_times =
div_up(seq_len * group_size, num_rows_per_block);
for (uint32_t tile_id = 0; tile_id < loop_times; tile_id++) {
batch_ids[index] = bid;
tile_ids_per_batch[index++] = tile_id;
}
gridx += loop_times;
}
*num_blocks_x = gridx;
}
}
template <uint32_t config_size>
__global__ void search_chunk_size_for_mla(
const int * __restrict__ seq_lens_q,
const int * __restrict__ seq_lens_encoder,
const int * __restrict__ seq_lens_decoder,
int * __restrict__ num_blocks_x,
int * __restrict__ res_chunk_size,
const int bsz,
const int set_chunk_size,
const int block_size,
const int sm_cout) {
const uint32_t conf_id = threadIdx.x;
int gridx = 0;
if (set_chunk_size > 0 && conf_id == 0) {
for (uint32_t bid = 0; bid < bsz; bid++) {
int seq_len = seq_lens_q[bid];
int seq_len_encoder = seq_lens_encoder[bid];
int seq_len_decoder = seq_lens_decoder[bid] + seq_len;
if (seq_len == 0 || seq_len_encoder > 0) continue;
int loop_times;
loop_times = cute::ceil_div(seq_len_decoder, set_chunk_size);
gridx += loop_times;
}
*num_blocks_x = gridx;
*res_chunk_size = set_chunk_size;
} else if (conf_id < config_size) {
__shared__ int gridx_shared[config_size];
// chunk_size is a multiple of 64
const int chunk_size = block_size << conf_id;
for (uint32_t bid = 0; bid < bsz; bid++) {
int seq_len = seq_lens_q[bid];
int seq_len_encoder = seq_lens_encoder[bid];
int seq_len_decoder = seq_lens_decoder[bid] + seq_len;
if (seq_len == 0 || seq_len_encoder > 0) continue;
int loop_times;
loop_times = cute::ceil_div(seq_len_decoder, chunk_size);
gridx += loop_times;
}
gridx_shared[conf_id] = gridx;
__syncthreads();
if (threadIdx.x == 0) {
uint32_t res_id = 0;
uint32_t max_last_wave_block = 0;
for (uint32_t i = 1; i < config_size; i++) {
uint32_t last_wave_block = gridx_shared[i] % sm_cout;
if (last_wave_block >= max_last_wave_block) {
res_id = i;
max_last_wave_block = last_wave_block;
}
}
*num_blocks_x = gridx_shared[res_id];
*res_chunk_size = block_size << res_id;
}
}
}
__global__ void split_block_for_mla(
const int * __restrict__ seq_lens_q,
const int * __restrict__ seq_lens_encoder,
const int * __restrict__ seq_lens_decoder,
int * __restrict__ batch_ids,
int * __restrict__ tile_ids_per_batch,
const int bsz,
const int chunk_size) {
if (threadIdx.x == 0) {
int index = 0;
for (uint32_t bid = 0; bid < bsz; bid++) {
int seq_len = seq_lens_q[bid];
int seq_len_encoder = seq_lens_encoder[bid];
int seq_len_decoder = seq_lens_decoder[bid] + seq_len;
if (seq_len == 0) continue;
int loop_times;
loop_times = cute::ceil_div(seq_len_decoder, chunk_size);
if (seq_len_encoder > 0) {
loop_times = 0;
}
for (uint32_t tile_id = 0; tile_id < loop_times; tile_id++) {
batch_ids[index] = bid;
tile_ids_per_batch[index++] = tile_id;
}
}
}
}
__global__ void split_kv_block(const int* __restrict__ seq_lens_decoder,
const int* __restrict__ seq_lens_encoder,
int* __restrict__ batch_ids,
int* __restrict__ tile_ids_per_batch,
int* __restrict__ num_blocks_x,
const int bsz,
const int pad_len,
const int num_row_per_block) {
if (threadIdx.x == 0) {
int gridx = 0;
int index = 0;
for (uint32_t bid = 0; bid < bsz; bid++) {
const int start_len = seq_lens_decoder[bid];
int seq_len = seq_lens_encoder[bid] + start_len % pad_len;
if (seq_lens_encoder[bid] == 0) {
seq_len = 0;
}
const int loop_times = div_up(seq_len, num_row_per_block);
for (uint32_t tile_id = 0; tile_id < loop_times; tile_id++) {
batch_ids[index] = bid;
tile_ids_per_batch[index++] = tile_id;
}
gridx += loop_times;
}
*num_blocks_x = gridx;
}
}
template <int THREADBLOCK_SIZE>
__global__ void get_max_len_kv_ernel(int* max_seq_lens_out,
const int* seq_lens_this_time,
const int* seq_lens_decoder,
const int batch_size) {
const int tid = threadIdx.x;
typedef cub::BlockReduce<int, THREADBLOCK_SIZE> BlockReduce;
__shared__ typename BlockReduce::TempStorage temp_storage;
int max_len_this_thread = 0;
for (int i = tid; i < batch_size; i += blockDim.x) {
if (seq_lens_decoder[i] == 0) continue;
max_len_this_thread = max(seq_lens_this_time[i] + seq_lens_decoder[i], max_len_this_thread);
}
int total = BlockReduce(temp_storage).Reduce(max_len_this_thread, MaxOp<int>());
if (tid == 0) {
*max_seq_lens_out = total;
}
}
std::vector<paddle::Tensor> GetBlockShapeAndSplitKVBlock(
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& max_enc_len_this_time,
const paddle::Tensor& max_dec_len_this_time,
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& cum_offsets,
const int group_size,
const int block_size,
const int decoder_step_token_num) {
paddle::Tensor encoder_batch_ids, encoder_tile_ids_per_batch, encoder_num_blocks_x_cpu,
kv_batch_ids, kv_tile_ids_per_batch, kv_num_blocks_x_cpu, decoder_batch_ids,
decoder_tile_ids_per_batch, decoder_num_blocks_x, decoder_num_blocks_x_cpu, decoder_chunk_size_device, decoder_chunk_size_cpu;
auto stream = seq_lens_this_time.stream();
int bsz = cum_offsets.shape()[0];
const int encoder_block_shape_q = get_encoder_block_shape_q();
const int decoder_block_shape_q = get_decoder_block_shape_q();
// max_len
auto max_len_kv =
GetEmptyTensor({1}, paddle::DataType::INT32, seq_lens_decoder.place());
get_max_len_kv_ernel<128><<<1, 128, 0, stream>>>(
max_len_kv.data<int>(),
seq_lens_this_time.data<int>(),
seq_lens_decoder.data<int>(),
bsz
);
auto max_len_kv_cpu =
max_len_kv.copy_to(paddle::CPUPlace(), false);
// decoder
int max_dec_len_this_time_data = max_dec_len_this_time.data<int>()[0];
if (max_dec_len_this_time_data > 0) {
const bool mla_use_tensorcore = GetMlaUseTensorcore();
if (mla_use_tensorcore && group_size <=64) {
const int set_chunk_size = get_mla_dec_chunk_size(bsz);
decoder_chunk_size_device =
GetEmptyTensor({1}, paddle::DataType::INT32, seq_lens_encoder.place());
decoder_num_blocks_x =
GetEmptyTensor({1}, paddle::DataType::INT32, seq_lens_encoder.place());
int device;
cudaGetDevice(&device);
int sm_cout;
cudaDeviceGetAttribute(&sm_cout, cudaDevAttrMultiProcessorCount, device);
constexpr int config_size = 12; // search space for chunk size:[64, 128, 256, ... 131072]
search_chunk_size_for_mla<config_size><<<1, 32, 0, stream>>>(
seq_lens_this_time.data<int>(),
seq_lens_encoder.data<int>(),
seq_lens_decoder.data<int>(),
decoder_num_blocks_x.data<int>(),
decoder_chunk_size_device.data<int>(),
bsz,
set_chunk_size,
block_size,
sm_cout);
decoder_chunk_size_cpu =
decoder_chunk_size_device.copy_to(paddle::CPUPlace(), false);
decoder_num_blocks_x_cpu =
decoder_num_blocks_x.copy_to(paddle::CPUPlace(), false);
const int chunk_size = decoder_chunk_size_cpu.data<int>()[0];
const int num_blocks = decoder_num_blocks_x_cpu.data<int>()[0];
decoder_batch_ids =
GetEmptyTensor({num_blocks},
paddle::DataType::INT32,
seq_lens_encoder.place());
decoder_tile_ids_per_batch =
GetEmptyTensor({num_blocks},
paddle::DataType::INT32,
seq_lens_encoder.place());
split_block_for_mla<<<1, 32, 0, stream>>>(
seq_lens_this_time.data<int>(),
seq_lens_encoder.data<int>(),
seq_lens_decoder.data<int>(),
decoder_batch_ids.data<int>(),
decoder_tile_ids_per_batch.data<int>(),
bsz,
chunk_size
);
} else {
const uint32_t decoder_max_tile_size_per_bs_q =
div_up((decoder_step_token_num * group_size), decoder_block_shape_q);
decoder_batch_ids =
GetEmptyTensor({bsz * decoder_max_tile_size_per_bs_q},
paddle::DataType::INT32,
seq_lens_encoder.place());
decoder_tile_ids_per_batch =
GetEmptyTensor({bsz * decoder_max_tile_size_per_bs_q},
paddle::DataType::INT32,
seq_lens_encoder.place());
decoder_num_blocks_x =
GetEmptyTensor({1}, paddle::DataType::INT32, seq_lens_encoder.place());
split_q_block<<<1, 32, 0, stream>>>(seq_lens_this_time.data<int>(),
seq_lens_encoder.data<int>(),
decoder_batch_ids.data<int>(),
decoder_tile_ids_per_batch.data<int>(),
decoder_num_blocks_x.data<int>(),
bsz,
decoder_block_shape_q,
group_size);
decoder_num_blocks_x_cpu =
decoder_num_blocks_x.copy_to(paddle::CPUPlace(), false);
decoder_chunk_size_cpu =
paddle::full({1}, 131072, paddle::DataType::INT32, paddle::CPUPlace());
}
} else {
decoder_batch_ids =
paddle::full({1}, -1, paddle::DataType::INT32, paddle::GPUPlace());
decoder_tile_ids_per_batch =
paddle::full({1}, -1, paddle::DataType::INT32, paddle::GPUPlace());
decoder_chunk_size_cpu =
paddle::full({1}, 131072, paddle::DataType::INT32, paddle::CPUPlace());
decoder_num_blocks_x =
paddle::full({1}, -1, paddle::DataType::INT32, paddle::GPUPlace());
decoder_num_blocks_x_cpu =
paddle::full({1}, -1, paddle::DataType::INT32, paddle::CPUPlace());
}
// encoder
int max_enc_len_this_time_data = max_enc_len_this_time.data<int>()[0];
if (max_enc_len_this_time_data > 0) {
const uint32_t encoder_max_tile_size_per_bs_q = div_up(
(max_enc_len_this_time_data * group_size), encoder_block_shape_q);
encoder_batch_ids =
GetEmptyTensor({bsz * encoder_max_tile_size_per_bs_q},
paddle::DataType::INT32,
seq_lens_encoder.place());
encoder_tile_ids_per_batch =
GetEmptyTensor({bsz * encoder_max_tile_size_per_bs_q},
paddle::DataType::INT32,
seq_lens_encoder.place());
auto encoder_num_blocks_x =
GetEmptyTensor({1}, paddle::DataType::INT32, seq_lens_encoder.place());
split_q_block<<<1, 32, 0, stream>>>(seq_lens_encoder.data<int>(),
nullptr,
encoder_batch_ids.data<int>(),
encoder_tile_ids_per_batch.data<int>(),
encoder_num_blocks_x.data<int>(),
bsz,
encoder_block_shape_q,
group_size);
encoder_num_blocks_x_cpu =
encoder_num_blocks_x.copy_to(paddle::CPUPlace(), false);
// kv
const uint32_t max_tile_size_per_bs_kv =
div_up(max_enc_len_this_time_data, block_size);
kv_batch_ids = GetEmptyTensor({bsz * max_tile_size_per_bs_kv},
paddle::DataType::INT32,
seq_lens_encoder.place());
kv_tile_ids_per_batch = GetEmptyTensor({bsz * max_tile_size_per_bs_kv},
paddle::DataType::INT32,
seq_lens_encoder.place());
auto kv_num_blocks_x =
GetEmptyTensor({1}, paddle::DataType::INT32, seq_lens_encoder.place());
split_kv_block<<<1, 32, 0, stream>>>(seq_lens_decoder.data<int>(),
seq_lens_encoder.data<int>(),
kv_batch_ids.data<int>(),
kv_tile_ids_per_batch.data<int>(),
kv_num_blocks_x.data<int>(),
bsz,
block_size,
block_size);
kv_num_blocks_x_cpu = kv_num_blocks_x.copy_to(paddle::CPUPlace(), false);
} else {
encoder_batch_ids =
paddle::full({1}, -1, paddle::DataType::INT32, paddle::GPUPlace());
encoder_tile_ids_per_batch =
paddle::full({1}, -1, paddle::DataType::INT32, paddle::GPUPlace());
encoder_num_blocks_x_cpu =
paddle::full({1}, -1, paddle::DataType::INT32, paddle::CPUPlace());
kv_batch_ids =
paddle::full({1}, -1, paddle::DataType::INT32, paddle::GPUPlace());
kv_tile_ids_per_batch =
paddle::full({1}, -1, paddle::DataType::INT32, paddle::GPUPlace());
kv_num_blocks_x_cpu =
paddle::full({1}, -1, paddle::DataType::INT32, paddle::CPUPlace());
}
return {encoder_batch_ids,
encoder_tile_ids_per_batch,
encoder_num_blocks_x_cpu, /*cpu*/
kv_batch_ids,
kv_tile_ids_per_batch,
kv_num_blocks_x_cpu, /*cpu*/
decoder_batch_ids,
decoder_tile_ids_per_batch,
decoder_num_blocks_x,
decoder_num_blocks_x_cpu, /*cpu*/
decoder_chunk_size_cpu, /*cpu*/
max_len_kv_cpu /*cpu*/};
}
std::vector<paddle::DataType> GetBlockShapeAndSplitKVBlockInferDtype(
const paddle::DataType& seq_lens_encoder_dtype,
const paddle::DataType& seq_lens_decoder_dtype,
const paddle::DataType& max_enc_len_this_time_dtype,
const paddle::DataType& max_dec_len_this_time_dtype,
const paddle::DataType& seq_lens_this_time_dtype,
const paddle::DataType& cum_offsets_dtype) {
return {paddle::DataType::INT32,
paddle::DataType::INT32,
paddle::DataType::INT32,
paddle::DataType::INT32,
paddle::DataType::INT32,
paddle::DataType::INT32,
paddle::DataType::INT32,
paddle::DataType::INT32,
paddle::DataType::INT32,
paddle::DataType::INT32,
paddle::DataType::INT32,
paddle::DataType::INT32};
}
std::vector<std::vector<int64_t>> GetBlockShapeAndSplitKVBlockInferShape(
const std::vector<int64_t>& seq_lens_encoder_shape,
const std::vector<int64_t>& seq_lens_decoder_shape,
const std::vector<int64_t>& max_enc_len_this_time_shape,
const std::vector<int64_t>& max_dec_len_this_time_shape,
const std::vector<int64_t>& seq_lens_this_time_shape,
const std::vector<int64_t>& cum_offsets_shape) {
std::vector<int64_t> dynamic_shape = {-1};
return {dynamic_shape,
dynamic_shape,
{1},
dynamic_shape,
dynamic_shape,
{1},
dynamic_shape,
dynamic_shape,
{1},
{1},
{1},
{1}};
}
PD_BUILD_OP(get_block_shape_and_split_kv_block)
.Inputs({"seq_lens_encoder",
"seq_lens_decoder",
"max_enc_len_this_time",
"max_dec_len_this_time",
"seq_lens_this_time",
"cum_offsets"})
.Outputs({"encoder_batch_ids",
"encoder_tile_ids_per_batch",
"encoder_num_blocks",
"kv_batch_ids",
"kv_tile_ids_per_batch",
"kv_num_blocks",
"decoder_batch_ids",
"decoder_tile_ids_per_batch",
"decoder_num_blocks",
"decoder_num_blocks_cpu",
"decoder_chunk_size_cpu",
"max_len_kv"})
.Attrs({"group_size: int",
"block_size: int",
"decoder_step_token_num: int"})
.SetKernelFn(PD_KERNEL(GetBlockShapeAndSplitKVBlock))
.SetInferShapeFn(PD_INFER_SHAPE(GetBlockShapeAndSplitKVBlockInferShape))
.SetInferDtypeFn(PD_INFER_DTYPE(GetBlockShapeAndSplitKVBlockInferDtype));

View File

@@ -0,0 +1,318 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <cuda_runtime.h>
#include <stdint.h>
enum class SharedMemFillMode { kFillZero, kNoFill };
enum class PrefetchMode { kNoPrefetch, kPrefetch };
template <typename T>
__device__ __forceinline__ void ldmatrix_m8n8x4_impl(uint32_t* R, T* smem_ptr) {
uint32_t smem_int_ptr =
static_cast<uint32_t>(__cvta_generic_to_shared(smem_ptr));
asm volatile(
"ldmatrix.sync.aligned.m8n8.x4.shared.b16 {%0, %1, %2, %3}, [%4];\n"
: "=r"(R[0]), "=r"(R[1]), "=r"(R[2]), "=r"(R[3])
: "r"(smem_int_ptr));
}
template <typename T>
__device__ __forceinline__ void ldmatrix_m8n8x4_trans_impl(uint32_t* R,
T* smem_ptr) {
uint32_t smem_int_ptr =
static_cast<uint32_t>(__cvta_generic_to_shared(smem_ptr));
asm volatile(
"ldmatrix.sync.aligned.trans.m8n8.x4.shared.b16 {%0, %1, %2, %3}, [%4];\n"
: "=r"(R[0]), "=r"(R[1]), "=r"(R[2]), "=r"(R[3])
: "r"(smem_int_ptr));
}
__device__ __forceinline__ void commit_group() {
asm volatile("cp.async.commit_group;\n" ::);
}
template <size_t n>
__device__ __forceinline__ void wait_group() {
asm volatile("cp.async.wait_group %0;\n" ::"n"(n));
}
template <PrefetchMode prefetch_mode, typename T>
__device__ __forceinline__ void load_128b(T* smem_ptr, const T* gmem_ptr) {
uint32_t smem_int_ptr =
static_cast<uint32_t>(__cvta_generic_to_shared(smem_ptr));
if constexpr (prefetch_mode == PrefetchMode::kPrefetch) {
asm volatile(
"cp.async.cg.shared.global.L2::128B [%0], [%1], %2, %3;\n" ::"r"(
smem_int_ptr),
"l"(gmem_ptr),
"n"(16),
"r"(16));
} else {
asm volatile(
"cp.async.cg.shared.global [%0], [%1], %2, %3;\n" ::"r"(smem_int_ptr),
"l"(gmem_ptr),
"n"(16),
"r"(16));
}
}
template <PrefetchMode prefetch_mode, SharedMemFillMode fill_mode, typename T>
__device__ __forceinline__ void pred_load_128b(T* smem_ptr,
const T* gmem_ptr,
bool predicate) {
uint32_t smem_int_ptr =
static_cast<uint32_t>(__cvta_generic_to_shared(smem_ptr));
if constexpr (fill_mode == SharedMemFillMode::kFillZero) {
int src_in_bytes = predicate ? 16 : 0;
if constexpr (prefetch_mode == PrefetchMode::kPrefetch) {
asm volatile(
"cp.async.cg.shared.global.L2::128B [%0], [%1], %2, %3;\n" ::"r"(
smem_int_ptr),
"l"(gmem_ptr),
"n"(16),
"r"(src_in_bytes));
} else {
asm volatile(
"cp.async.cg.shared.global [%0], [%1], %2, %3;\n" ::"r"(smem_int_ptr),
"l"(gmem_ptr),
"n"(16),
"r"(src_in_bytes));
}
} else {
if constexpr (prefetch_mode == PrefetchMode::kPrefetch) {
asm volatile(
"{\n"
" .reg .pred p;\n"
" setp.ne.b32 p, %0, 0;\n"
" @p cp.async.cg.shared.global.L2::128B [%1], [%2], %3;\n"
"}\n" ::"r"((int)predicate),
"r"(smem_int_ptr),
"l"(gmem_ptr),
"n"(16));
} else {
asm volatile(
"{\n"
" .reg .pred p;\n"
" setp.ne.b32 p, %0, 0;\n"
" @p cp.async.cg.shared.global [%1], [%2], %3;\n"
"}\n" ::"r"((int)predicate),
"r"(smem_int_ptr),
"l"(gmem_ptr),
"n"(16));
}
}
}
template <PrefetchMode prefetch_mode, SharedMemFillMode fill_mode, typename T>
__device__ __forceinline__ void pred_load_64b(T* smem_ptr,
const T* gmem_ptr,
bool predicate) {
uint32_t smem_int_ptr =
static_cast<uint32_t>(__cvta_generic_to_shared(smem_ptr));
if constexpr (fill_mode == SharedMemFillMode::kFillZero) {
int src_in_bytes = predicate ? 8 : 0;
asm volatile(
"cp.async.ca.shared.global [%0], [%1], %2, %3;\n" ::"r"(smem_int_ptr),
"l"(gmem_ptr),
"n"(8),
"r"(src_in_bytes));
} else {
asm volatile(
"{\n"
" .reg .pred p;\n"
" setp.ne.b32 p, %0, 0;\n"
" @p cp.async.ca.shared.global [%1], [%2], %3;\n"
"}\n" ::"r"((int)predicate),
"r"(smem_int_ptr),
"l"(gmem_ptr),
"n"(8));
}
}
template <PrefetchMode prefetch_mode, SharedMemFillMode fill_mode, typename T>
__device__ __forceinline__ void pred_load_32b(T* smem_ptr,
const T* gmem_ptr,
bool predicate) {
uint32_t smem_int_ptr =
static_cast<uint32_t>(__cvta_generic_to_shared(smem_ptr));
if constexpr (fill_mode == SharedMemFillMode::kFillZero) {
int src_in_bytes = predicate ? 4 : 0;
asm volatile(
"cp.async.ca.shared.global [%0], [%1], %2, %3;\n" ::"r"(smem_int_ptr),
"l"(gmem_ptr),
"n"(4),
"r"(src_in_bytes));
} else {
asm volatile(
"{\n"
" .reg .pred p;\n"
" setp.ne.b32 p, %0, 0;\n"
" @p cp.async.ca.shared.global [%1], [%2], %3;\n"
"}\n" ::"r"((int)predicate),
"r"(smem_int_ptr),
"l"(gmem_ptr),
"n"(4));
}
}
template <size_t num_bits, PrefetchMode prefetch_mode, typename T>
__device__ __forceinline__ void load(T* smem_ptr, const T* gmem_ptr) {
static_assert(num_bits == 128, "num_bits must be 128");
load_128b<prefetch_mode>(smem_ptr, gmem_ptr);
}
template <size_t num_bits,
PrefetchMode prefetch_mode,
SharedMemFillMode fill_mode,
typename T>
__device__ __forceinline__ void pred_load(T* smem_ptr,
const T* gmem_ptr,
bool predicate) {
static_assert(num_bits == 128 || num_bits == 64 || num_bits == 32,
"num_bits must be 128, 64 or 32.");
if constexpr (num_bits == 128) {
pred_load_128b<prefetch_mode, fill_mode>(smem_ptr, gmem_ptr, predicate);
} else if constexpr (num_bits == 64) {
pred_load_64b<prefetch_mode, fill_mode>(smem_ptr, gmem_ptr, predicate);
} else if constexpr (num_bits == 32) {
pred_load_32b<prefetch_mode, fill_mode>(smem_ptr, gmem_ptr, predicate);
}
}
using b32_t = uint32_t;
using b64_t = uint2;
using b128_t = uint4;
template <typename T>
constexpr __host__ __device__ __forceinline__ uint32_t num_elems_per_128b() {
return sizeof(b128_t) / sizeof(T);
}
struct smem_t {
// The base pointer.
b128_t* base;
__device__ __forceinline__ smem_t() : base(nullptr) {}
template <typename T>
__device__ __forceinline__ smem_t(T* base) : base((b128_t*)base) {}
template <uint32_t stride, uint32_t inv_stride = 0>
static __device__ __forceinline__ uint32_t get_permuted_offset(uint32_t i,
uint32_t j) {
if constexpr (inv_stride <= 1) {
return i * stride + (j ^ (i % 8));
} else {
return i / inv_stride * 8 + ((j + (i % inv_stride) * stride)) ^
((i / inv_stride) % 8);
}
}
template <uint32_t step_size, uint32_t row_stride = 8>
static __device__ __forceinline__ uint32_t
advance_offset_by_column(uint32_t offset, uint32_t step_idx) {
if constexpr (row_stride == 2) {
static_assert(step_size == 2, "Unsupported step size");
return offset + step_size;
} else if constexpr (row_stride == 4) {
static_assert(step_size == 2 || step_size == 4, "Unsupported step size");
if constexpr (step_size == 2) {
return (offset ^ 0x2) + (step_idx % 2 == 1) * 4;
} else {
return offset + step_size;
}
} else {
static_assert(step_size == 2 || step_size == 4 || step_size % 8 == 0,
"Unsupported step size");
if constexpr (step_size == 2) {
return (offset ^ (0x2 + (0x4 * (step_idx % 2 == 1)))) +
(step_idx % 4 == 3) * 8;
} else if constexpr (step_size == 4) {
return (offset ^ 0x4) + (step_idx % 2 == 1) * 8;
} else {
// step_size % 8 == 0
return offset + step_size;
}
}
}
template <uint32_t step_size, uint32_t row_stride>
static __device__ __forceinline__ uint32_t
advance_offset_by_row(uint32_t offset) {
if constexpr (row_stride == 2) {
static_assert(step_size == 16 || step_size % 32 == 0,
"Unsupported step size");
if constexpr (step_size == 16) {
return (offset ^ 0x4) + step_size * row_stride;
} else {
// step_size % 32 == 0
return offset + step_size * row_stride;
}
} else if constexpr (row_stride == 4) {
static_assert(step_size == 8 || step_size % 16 == 0,
"Unsupported step size");
if constexpr (step_size == 8) {
return (offset ^ 0x4) + step_size * row_stride;
} else {
// step_size % 16 == 0
return offset + step_size * row_stride;
}
} else {
static_assert(step_size == 4 || step_size % 8 == 0,
"Unsupported step size");
if constexpr (step_size == 4) {
return (offset ^ 0x4) + step_size * row_stride;
} else {
// step_size % 8 == 0
return offset + step_size * row_stride;
}
}
}
__device__ __forceinline__ void ldmatrix_m8n8x4(uint32_t offset,
uint32_t* R) {
b128_t* smem_ptr = base + offset;
ldmatrix_m8n8x4_impl(R, smem_ptr);
}
__device__ __forceinline__ void ldmatrix_m8n8x4_trans(uint32_t offset,
uint32_t* R) {
b128_t* smem_ptr = base + offset;
ldmatrix_m8n8x4_trans_impl(R, smem_ptr);
}
template <SharedMemFillMode fill_mode, typename T>
__device__ __forceinline__ void load_128b_async(uint32_t offset,
const T* gptr,
bool predicate) {
b128_t* smem_ptr = base + offset;
pred_load_128b<PrefetchMode::kPrefetch, fill_mode>(
smem_ptr, reinterpret_cast<const b128_t*>(gptr), predicate);
}
template <typename T>
__device__ __forceinline__ void load_128b_async(uint32_t offset,
const T* gptr) {
b128_t* smem_ptr = base + offset;
load_128b<PrefetchMode::kPrefetch>(smem_ptr,
reinterpret_cast<const b128_t*>(gptr));
}
template <typename T>
__device__ __forceinline__ void store_128b(uint32_t offset, T* gptr) {
*reinterpret_cast<b128_t*>(gptr) = *(base + offset);
}
};

View File

@@ -0,0 +1,291 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "mla_cache_kernel.cuh"
template <paddle::DataType T>
std::vector<paddle::Tensor> PrefillMLAWriteCache(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& kv_nope,
const paddle::Tensor& kv_pe,
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* kv_cache) {
typedef PDTraits<T> traits_;
typedef typename traits_::DataType DataType_;
typedef typename traits_::data_t data_t;
auto max_blocks_per_seq = meta_data.max_blocks_per_seq;
auto num_tokens = meta_data.token_nums;
auto block_size = meta_data.block_size;
auto nope_size = meta_data.head_dims_v;
auto all_size = meta_data.head_dims;
int pe_size = all_size - nope_size;
auto kv_num_heads = meta_data.kv_num_heads;
const uint32_t elem_nums = num_tokens * kv_num_heads * all_size;
constexpr int PackSize = 16 / sizeof(DataType_);
const int pack_num = elem_nums / PackSize;
const int blocksize = 128;
int grid_size = 1;
GetNumBlocks<128>(pack_num, &grid_size);
prefill_absorb_cache_kernel<DataType_, PackSize>
<<<grid_size, blocksize, 0, stream>>>(
reinterpret_cast<DataType_*>(const_cast<data_t*>(kv_nope.data<data_t>())),
reinterpret_cast<DataType_*>(const_cast<data_t*>(kv_pe.data<data_t>())),
reinterpret_cast<DataType_*>(kv_cache->data<data_t>()),
block_tables.data<int>(),
padding_offsets.data<int>(),
cum_offsets.data<int>(),
seq_lens.data<int>(),
seq_lens_decoder.data<int>(),
max_seq_len,
max_blocks_per_seq,
kv_num_heads,
nope_size,
pe_size,
block_size,
elem_nums);
return {};
}
std::vector<paddle::Tensor> PrefillMLAWriteCacheKernel(
const paddle::Tensor& kv_nope,
const paddle::Tensor& kv_pe,
const paddle::Tensor& kv_cache,
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const std::string& cache_quant_type_str,
const int max_seq_len) {
cudaStream_t stream = kv_pe.stream();
AppendAttnMetaData meta_data;
const auto& kv_nope_dims = kv_nope.dims();
const auto& kv_pe_dims = kv_pe.dims();
const auto& kv_cache_dims = kv_cache.dims();
meta_data.kv_num_heads = kv_cache_dims[1];
const auto nope_size = kv_nope_dims[kv_nope_dims.size() - 1] / meta_data.kv_num_heads;
meta_data.token_nums = kv_nope_dims[0];
meta_data.head_dims = kv_cache_dims[3];
meta_data.head_dims_v = nope_size;
meta_data.max_blocks_per_seq = block_tables.dims()[1];
meta_data.block_size = kv_cache_dims[2];
meta_data.batch_size = cum_offsets.dims()[0];
switch (kv_pe.dtype()) {
case paddle::DataType::BFLOAT16: {
return PrefillMLAWriteCache<paddle::DataType::BFLOAT16>(meta_data,
kv_nope,
kv_pe,
seq_lens,
seq_lens_decoder,
padding_offsets,
cum_offsets,
block_tables,
max_seq_len,
stream,
const_cast<paddle::Tensor*>(&kv_cache));
}
case paddle::DataType::FLOAT16: {
return PrefillMLAWriteCache<paddle::DataType::FLOAT16>(meta_data,
kv_nope,
kv_pe,
seq_lens,
seq_lens_decoder,
padding_offsets,
cum_offsets,
block_tables,
max_seq_len,
stream,
const_cast<paddle::Tensor*>(&kv_cache));
}
}
return {};
}
template <paddle::DataType T>
std::vector<paddle::Tensor> DecodeMLAWriteCache(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& kv_nope,
const paddle::Tensor& kv_pe,
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const int max_seq_len,
const bool speculate_decoder,
cudaStream_t& stream,
paddle::Tensor* kv_cache) {
typedef PDTraits<T> traits_;
typedef typename traits_::DataType DataType_;
typedef typename traits_::data_t data_t;
auto max_blocks_per_seq = meta_data.max_blocks_per_seq;
auto bsz = meta_data.batch_size;
auto token_num = meta_data.token_nums;
auto block_size = meta_data.block_size;
auto nope_size = meta_data.head_dims_v;
auto all_size = meta_data.head_dims;
int pe_size = all_size - nope_size;
auto kv_num_heads = meta_data.kv_num_heads;
constexpr int PackSize = 16 / sizeof(DataType_);
const int blocksize = 128;
int grid_size = 1;
if (speculate_decoder) {
const uint32_t elem_nums = token_num * kv_num_heads * all_size;
const int pack_num = elem_nums / PackSize;
GetNumBlocks<128>(pack_num, &grid_size);
speculate_decode_absorb_cache_kernel<DataType_, PackSize>
<<<grid_size, blocksize, 0, stream>>>(
reinterpret_cast<DataType_*>(const_cast<data_t*>(kv_nope.data<data_t>())),
reinterpret_cast<DataType_*>(const_cast<data_t*>(kv_pe.data<data_t>())),
reinterpret_cast<DataType_*>(kv_cache->data<data_t>()),
block_tables.data<int>(),
padding_offsets.data<int>(),
cum_offsets.data<int>(),
seq_lens.data<int>(),
seq_lens_encoder.data<int>(),
max_seq_len,
max_blocks_per_seq,
kv_num_heads,
nope_size,
pe_size,
block_size,
elem_nums);
} else {
const uint32_t elem_nums = bsz * kv_num_heads * all_size;
const int pack_num = elem_nums / PackSize;
GetNumBlocks<128>(pack_num, &grid_size);
decode_absorb_cache_kernel<DataType_, PackSize>
<<<grid_size, blocksize, 0, stream>>>(
reinterpret_cast<DataType_*>(const_cast<data_t*>(kv_nope.data<data_t>())),
reinterpret_cast<DataType_*>(const_cast<data_t*>(kv_pe.data<data_t>())),
reinterpret_cast<DataType_*>(kv_cache->data<data_t>()),
block_tables.data<int>(),
cum_offsets.data<int>(),
seq_lens.data<int>(),
seq_lens_encoder.data<int>(),
max_seq_len,
max_blocks_per_seq,
kv_num_heads,
nope_size,
pe_size,
block_size,
elem_nums);
}
return {};
}
std::vector<paddle::Tensor> DecodeMLAWriteCacheKernel(
const paddle::Tensor& kv_nope,
const paddle::Tensor& kv_pe,
const paddle::Tensor& kv_cache,
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const std::string& cache_quant_type_str,
const int max_seq_len,
const bool speculate_decoder) {
cudaStream_t stream = kv_pe.stream();
AppendAttnMetaData meta_data;
const auto& kv_nope_dims = kv_nope.dims();
const auto& kv_pe_dims = kv_pe.dims();
const auto& kv_cache_dims = kv_cache.dims();
meta_data.kv_num_heads = kv_cache_dims[1];
const auto nope_size = kv_nope_dims[kv_nope_dims.size() - 1] / meta_data.kv_num_heads;
meta_data.token_nums = kv_nope_dims[0];
meta_data.head_dims = kv_cache_dims[3];
meta_data.head_dims_v = nope_size;
meta_data.max_blocks_per_seq = block_tables.dims()[1];
meta_data.block_size = kv_cache_dims[2];
meta_data.batch_size = cum_offsets.dims()[0];
switch (kv_pe.dtype()) {
case paddle::DataType::BFLOAT16: {
return DecodeMLAWriteCache<paddle::DataType::BFLOAT16>(meta_data,
kv_nope,
kv_pe,
seq_lens,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
max_seq_len,
speculate_decoder,
stream,
const_cast<paddle::Tensor*>(&kv_cache));
}
case paddle::DataType::FLOAT16: {
return DecodeMLAWriteCache<paddle::DataType::FLOAT16>(meta_data,
kv_nope,
kv_pe,
seq_lens,
seq_lens_encoder,
padding_offsets,
cum_offsets,
block_tables,
max_seq_len,
speculate_decoder,
stream,
const_cast<paddle::Tensor*>(&kv_cache));
}
}
return {};
}
PD_BUILD_OP(prefill_mla_write_cache)
.Inputs({"kv_nope",
"kv_pe",
"kv_cache",
"seq_lens",
"seq_lens_decoder",
"padding_offsets",
"cum_offsets",
"block_tables"})
.Outputs({"kv_cache_out"})
.SetInplaceMap({{"kv_cache", "kv_cache_out"}})
.Attrs({"cache_quant_type_str: std::string",
"max_seq_len: int"})
.SetKernelFn(PD_KERNEL(PrefillMLAWriteCacheKernel));
PD_BUILD_OP(decode_mla_write_cache)
.Inputs({"kv_nope",
"kv_pe",
"kv_cache",
"seq_lens",
"seq_lens_encoder",
"padding_offsets",
"cum_offsets",
"block_tables"})
.Outputs({"kv_cache_out"})
.SetInplaceMap({{"kv_cache", "kv_cache_out"}})
.Attrs({"cache_quant_type_str: std::string",
"max_seq_len: int",
"speculate_decoder: bool"})
.SetKernelFn(PD_KERNEL(DecodeMLAWriteCacheKernel));

View File

@@ -0,0 +1,242 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "helper.h"
#include "mem_util.cuh"
#include "utils.cuh"
template <typename T, int VecSize = 1>
__global__ void decode_absorb_cache_kernel(
const T* __restrict__ kv_nope, // [bsz, kv_num_heads, pe_size] 512
const T* __restrict__ kv_pe, // [bsz, kv_num_heads, nope_size] 64
T* __restrict__ kv_cache, // [num_blocks, kv_num_heads, block_size,
// nope_size]
const int* __restrict__ block_tables, // [bsz, max_blocks_per_seq]
const int* __restrict__ cum_offsets,
const int* __restrict__ seq_lens, // [bsz]
const int* __restrict__ seq_lens_encoder, // [bsz]
const int max_seq_len,
const int max_blocks_per_seq,
const int kv_num_heads,
const int nope_size,
const int pe_size,
const int block_size,
const uint32_t elem_cnt) {
using LoadT = AlignedVector<T, VecSize>;
constexpr int HalfVecSize = VecSize / 2;
LoadT src_vec;
int64_t global_thread_idx = blockDim.x * blockIdx.x + threadIdx.x;
const uint32_t nope_hidden_size = kv_num_heads * nope_size;
const uint32_t pe_hidden_size = kv_num_heads * pe_size;
const uint32_t all_size = nope_size + pe_size;
const int64_t hidden_size = nope_hidden_size + pe_hidden_size;
for (int32_t linear_index = global_thread_idx * VecSize,
step = gridDim.x * blockDim.x * VecSize;
linear_index < elem_cnt;
linear_index += step) {
const int ori_bi = linear_index / hidden_size;
const int bias = linear_index % hidden_size;
const int start_token_idx = ori_bi * max_seq_len - cum_offsets[ori_bi];
if (seq_lens_encoder[ori_bi] > 0) return;
const int write_seq_id = seq_lens[ori_bi];
if (write_seq_id == 0) continue;
const int* block_table_now = nullptr;
block_table_now = block_tables + ori_bi * max_blocks_per_seq;
const int block_idx = block_table_now[write_seq_id / block_size];
const int block_offset = write_seq_id % block_size;
if (bias < nope_hidden_size) { // pe
const uint32_t inner_bias = bias;
const uint32_t hi = inner_bias / nope_size;
const uint32_t h_bias = inner_bias % nope_size;
const uint32_t tgt_idx = block_idx * kv_num_heads * block_size * all_size +
hi * block_size * all_size +
block_offset * all_size + h_bias;
const uint32_t ori_idx =
start_token_idx * nope_hidden_size + inner_bias;
Load<T, VecSize>(&kv_nope[ori_idx], &src_vec);
Store<T, VecSize>(src_vec, &kv_cache[tgt_idx]);
} else {
const uint32_t inner_bias = bias - nope_hidden_size;
const uint32_t hi = inner_bias / pe_size;
const uint32_t h_bias = inner_bias % pe_size;
const uint32_t tgt_idx = block_idx * kv_num_heads * block_size * all_size +
hi * block_size * all_size +
block_offset * all_size + nope_size + h_bias;
const uint32_t ori_idx =
start_token_idx * pe_hidden_size + inner_bias;
Load<T, VecSize>(&kv_pe[ori_idx], &src_vec);
Store<T, VecSize>(src_vec, &kv_cache[tgt_idx]);
}
}
}
template <typename T, int VecSize = 1>
__global__ void speculate_decode_absorb_cache_kernel(
const T* __restrict__ kv_nope, // [bsz, kv_num_heads, pe_size] 512
const T* __restrict__ kv_pe, // [bsz, kv_num_heads, nope_size] 64
T* __restrict__ kv_cache, // [num_blocks, kv_num_heads, block_size,
// nope_size]
const int* __restrict__ block_tables, // [bsz, max_blocks_per_seq]
const int* __restrict__ padding_offsets,
const int* __restrict__ cum_offsets,
const int* __restrict__ seq_lens, // [bsz]
const int* __restrict__ seq_lens_encoder, // [bsz]
const int max_seq_len,
const int max_blocks_per_seq,
const int kv_num_heads,
const int nope_size,
const int pe_size,
const int block_size,
const uint32_t elem_cnt) {
using LoadT = AlignedVector<T, VecSize>;
constexpr int HalfVecSize = VecSize / 2;
LoadT src_vec;
int64_t global_thread_idx = blockDim.x * blockIdx.x + threadIdx.x;
const uint32_t nope_hidden_size = kv_num_heads * nope_size;
const uint32_t pe_hidden_size = kv_num_heads * pe_size;
const uint32_t all_size = nope_size + pe_size;
const int64_t hidden_size = nope_hidden_size + pe_hidden_size;
for (int32_t linear_index = global_thread_idx * VecSize,
step = gridDim.x * blockDim.x * VecSize;
linear_index < elem_cnt;
linear_index += step) {
const int token_id = linear_index / hidden_size;
const int ori_bi = (token_id + padding_offsets[token_id]) / max_seq_len;
if (seq_lens[ori_bi] == 0) continue;
const int bias = linear_index % hidden_size;
const int start_token_idx = ori_bi * max_seq_len - cum_offsets[ori_bi];
const int write_seq_id =
seq_lens[ori_bi] + token_id - start_token_idx;
if (write_seq_id == 0) continue;
const int* block_table_now = nullptr;
block_table_now = block_tables + ori_bi * max_blocks_per_seq;
const int block_idx = block_table_now[write_seq_id / block_size];
const int block_offset = write_seq_id % block_size;
if (block_idx < 0) {
printf(
"Fatal Error!!!, block idx %d when write_seq_id is %d\n some key var "
"%d %d %d %d\n",
block_idx,
write_seq_id,
ori_bi,
seq_lens[ori_bi],
token_id,
cum_offsets[ori_bi]);
}
if (bias < nope_hidden_size) { // pe
const uint32_t inner_bias = bias;
const uint32_t hi = inner_bias / nope_size;
const uint32_t h_bias = inner_bias % nope_size;
const uint32_t tgt_idx = block_idx * kv_num_heads * block_size * all_size +
hi * block_size * all_size +
block_offset * all_size + h_bias;
const uint32_t ori_idx =
token_id * nope_hidden_size + inner_bias;
Load<T, VecSize>(&kv_nope[ori_idx], &src_vec);
Store<T, VecSize>(src_vec, &kv_cache[tgt_idx]);
} else {
const uint32_t inner_bias = bias - nope_hidden_size;
const uint32_t hi = inner_bias / pe_size;
const uint32_t h_bias = inner_bias % pe_size;
const uint32_t tgt_idx = block_idx * kv_num_heads * block_size * all_size +
hi * block_size * all_size +
block_offset * all_size + nope_size + h_bias;
const uint32_t ori_idx =
token_id * pe_hidden_size + inner_bias;
Load<T, VecSize>(&kv_pe[ori_idx], &src_vec);
Store<T, VecSize>(src_vec, &kv_cache[tgt_idx]);
}
}
}
template <typename T, int VecSize = 1>
__global__ void prefill_absorb_cache_kernel(
const T* __restrict__ kv_nope, // [bsz, kv_num_heads, pe_size] 512
const T* __restrict__ kv_pe, // [bsz, kv_num_heads, nope_size] 64
T* __restrict__ kv_cache, // [num_blocks, kv_num_heads, block_size,
// nope_size]
const int* __restrict__ block_tables, // [bsz, max_blocks_per_seq]
const int* __restrict__ padding_offsets,
const int* __restrict__ cum_offsets,
const int* __restrict__ seq_lens, // [bsz]
const int* __restrict__ seq_lens_decoder, // [bsz]
const int max_seq_len,
const int max_blocks_per_seq,
const int kv_num_heads,
const int nope_size,
const int pe_size,
const int block_size,
const uint32_t elem_cnt) {
using LoadT = AlignedVector<T, VecSize>;
LoadT src_vec;
int64_t global_thread_idx = blockDim.x * blockIdx.x + threadIdx.x;
const uint32_t nope_hidden_size = kv_num_heads * nope_size;
const uint32_t pe_hidden_size = kv_num_heads * pe_size;
const uint32_t all_size = nope_size + pe_size;
const int64_t hidden_size = nope_hidden_size + pe_hidden_size;
for (int32_t linear_index = global_thread_idx * VecSize,
step = gridDim.x * blockDim.x * VecSize;
linear_index < elem_cnt;
linear_index += step) {
const uint32_t token_idx = linear_index / hidden_size;
const uint32_t bias = linear_index % hidden_size;
const uint32_t ori_token_idx = token_idx + padding_offsets[token_idx];
const uint32_t ori_bi = ori_token_idx / max_seq_len;
if (seq_lens[ori_bi] == 0) continue;
const uint32_t ori_seq_id =
ori_token_idx % max_seq_len + seq_lens_decoder[ori_bi];
const int* block_table_now = nullptr;
block_table_now = block_tables + ori_bi * max_blocks_per_seq;
const uint32_t block_idx = block_table_now[ori_seq_id / block_size];
const uint32_t block_offset = ori_seq_id % block_size;
if (bias < nope_hidden_size) { // pe
const uint32_t inner_bias = bias;
const uint32_t hi = inner_bias / nope_size;
const uint32_t h_bias = inner_bias % nope_size;
const uint32_t tgt_idx = block_idx * kv_num_heads * block_size * all_size +
hi * block_size * all_size +
block_offset * all_size + h_bias;
const uint32_t ori_idx =
token_idx * nope_hidden_size + inner_bias;
Load<T, VecSize>(&kv_nope[ori_idx], &src_vec);
Store<T, VecSize>(src_vec, &kv_cache[tgt_idx]);
} else {
const uint32_t inner_bias = bias - nope_hidden_size;
const uint32_t hi = inner_bias / pe_size;
const uint32_t h_bias = inner_bias % pe_size;
const uint32_t tgt_idx = block_idx * kv_num_heads * block_size * all_size +
hi * block_size * all_size +
block_offset * all_size + nope_size + h_bias;
const uint32_t ori_idx =
token_idx * pe_hidden_size + inner_bias;
Load<T, VecSize>(&kv_pe[ori_idx], &src_vec);
Store<T, VecSize>(src_vec, &kv_cache[tgt_idx]);
}
}
}

View File

@@ -0,0 +1,296 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <cuda_bf16.h>
#include <cuda_fp16.h>
#include <cuda_runtime.h>
enum class MMAMode {
kInit = 0U,
kInplaceUpdate = 1U,
};
template <typename T, MMAMode mma_mode = MMAMode::kInplaceUpdate>
__device__ __forceinline__ void mma_sync_m16n16k32_row_col_i8i8i32(
int* C, // 8
uint32_t* A, // 4
uint32_t* B) { // 4
if constexpr (mma_mode == MMAMode::kInit) {
asm volatile(
"mma.sync.aligned.m16n8k32.row.col.s32.s8.s8.s32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=r"(C[0]), "=r"(C[1]), "=r"(C[2]), "=r"(C[3])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[0]),
"r"(B[1]),
"r"(0),
"r"(0),
"r"(0),
"r"(0));
asm volatile(
"mma.sync.aligned.m16n8k32.row.col.s32.s8.s8.s32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=r"(C[4]), "=r"(C[5]), "=r"(C[6]), "=r"(C[7])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[2]),
"r"(B[3]),
"r"(0),
"r"(0),
"r"(0),
"r"(0));
} else {
asm volatile(
"mma.sync.aligned.m16n8k32.row.col.s32.s8.s8.s32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=r"(C[0]), "=r"(C[1]), "=r"(C[2]), "=r"(C[3])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[0]),
"r"(B[1]),
"r"(C[0]),
"r"(C[1]),
"r"(C[2]),
"r"(C[3]));
asm volatile(
"mma.sync.aligned.m16n8k32.row.col.s32.s8.s8.s32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=r"(C[4]), "=r"(C[5]), "=r"(C[6]), "=r"(C[7])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[2]),
"r"(B[3]),
"r"(C[4]),
"r"(C[5]),
"r"(C[6]),
"r"(C[7]));
}
}
template <typename T, MMAMode mma_mode = MMAMode::kInplaceUpdate>
__device__ __forceinline__ void mma_sync_m16n16k16_row_col_f16f16f32(
float* C, uint32_t* A, uint32_t* B) {
if constexpr (mma_mode == MMAMode::kInit) {
if constexpr (std::is_same<T, half>::value) { // fp16
asm volatile(
"mma.sync.aligned.m16n8k16.row.col.f32.f16.f16.f32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=f"(C[0]), "=f"(C[1]), "=f"(C[2]), "=f"(C[3])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[0]),
"r"(B[1]),
"f"(0.f),
"f"(0.f),
"f"(0.f),
"f"(0.f));
asm volatile(
"mma.sync.aligned.m16n8k16.row.col.f32.f16.f16.f32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=f"(C[4]), "=f"(C[5]), "=f"(C[6]), "=f"(C[7])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[2]),
"r"(B[3]),
"f"(0.f),
"f"(0.f),
"f"(0.f),
"f"(0.f));
} else { // bf16
asm volatile(
"mma.sync.aligned.m16n8k16.row.col.f32.bf16.bf16.f32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=f"(C[0]), "=f"(C[1]), "=f"(C[2]), "=f"(C[3])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[0]),
"r"(B[1]),
"f"(0.f),
"f"(0.f),
"f"(0.f),
"f"(0.f));
asm volatile(
"mma.sync.aligned.m16n8k16.row.col.f32.bf16.bf16.f32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=f"(C[4]), "=f"(C[5]), "=f"(C[6]), "=f"(C[7])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[2]),
"r"(B[3]),
"f"(0.f),
"f"(0.f),
"f"(0.f),
"f"(0.f));
}
} else {
if constexpr (std::is_same<T, half>::value) {
asm volatile(
"mma.sync.aligned.m16n8k16.row.col.f32.f16.f16.f32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=f"(C[0]), "=f"(C[1]), "=f"(C[2]), "=f"(C[3])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[0]),
"r"(B[1]),
"f"(C[0]),
"f"(C[1]),
"f"(C[2]),
"f"(C[3]));
asm volatile(
"mma.sync.aligned.m16n8k16.row.col.f32.f16.f16.f32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=f"(C[4]), "=f"(C[5]), "=f"(C[6]), "=f"(C[7])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[2]),
"r"(B[3]),
"f"(C[4]),
"f"(C[5]),
"f"(C[6]),
"f"(C[7]));
} else {
asm volatile(
"mma.sync.aligned.m16n8k16.row.col.f32.bf16.bf16.f32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=f"(C[0]), "=f"(C[1]), "=f"(C[2]), "=f"(C[3])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[0]),
"r"(B[1]),
"f"(C[0]),
"f"(C[1]),
"f"(C[2]),
"f"(C[3]));
asm volatile(
"mma.sync.aligned.m16n8k16.row.col.f32.bf16.bf16.f32 "
"{%0, %1, %2, %3},"
"{%4, %5, %6, %7},"
"{%8, %9},"
"{%10, %11, %12, %13};\n"
: "=f"(C[4]), "=f"(C[5]), "=f"(C[6]), "=f"(C[7])
: "r"(A[0]),
"r"(A[1]),
"r"(A[2]),
"r"(A[3]),
"r"(B[2]),
"r"(B[3]),
"f"(C[4]),
"f"(C[5]),
"f"(C[6]),
"f"(C[7]));
}
}
}
template <typename DType>
__device__ __forceinline__ void rowsum_f16f16f32(float* d, DType* s) {
static_assert(sizeof(DType) == 2, "DType must be 16bit floating data type");
uint32_t* s_u32 = (uint32_t*)(s);
if constexpr (std::is_same<DType, half>::value) {
asm volatile(
"{\n"
".reg .f32 ph;\n"
"mma.sync.aligned.m16n8k16.row.col.f32.f16.f16.f32 "
"{%0, ph, %1, ph},"
"{%2, %3, %4, %5},"
"{%6, %7},"
"{%8, 0., %9, 0.};\n"
"}\n"
: "=f"(d[0]), "=f"(d[1])
: "r"(s_u32[0]),
"r"(s_u32[1]),
"r"(s_u32[2]),
"r"(s_u32[3]),
"r"(1006648320),
"r"(1006648320),
"f"(d[0]),
"f"(d[1]));
} else {
asm volatile(
"{\n"
".reg .f32 ph;\n"
"mma.sync.aligned.m16n8k16.row.col.f32.bf16.bf16.f32 "
"{%0, ph, %1, ph},"
"{%2, %3, %4, %5},"
"{%6, %7},"
"{%8, 0., %9, 0.};\n"
"}\n"
: "=f"(d[0]), "=f"(d[1])
: "r"(s_u32[0]),
"r"(s_u32[1]),
"r"(s_u32[2]),
"r"(s_u32[3]),
"r"(1065369472),
"r"(1065369472),
"f"(d[0]),
"f"(d[1]));
}
}

View File

@@ -0,0 +1,38 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "helper.h"
#include "utils.cuh"
template <typename T>
void DecodeMLAAttentionKernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor &q, // [token_num, num_heads, head_dim]
const paddle::Tensor &cache_k,
const paddle::Tensor &cache_v,
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>& shift_bias,
const paddle::optional<paddle::Tensor>& smooth_weight,
const paddle::Tensor &seq_lens_q, // q_seq_len is 1
const paddle::Tensor &seq_lens_kv,
const paddle::Tensor &padding_offsets,
const paddle::Tensor &cum_offsets,
const paddle::Tensor &block_table,
int max_seq_len,
int max_dec_len,
float softmax_scale,
float in_scale,
bool causal,
cudaStream_t &stream,
paddle::Tensor *out);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,608 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "speculate_write_cache_with_rope_kernel.h"
#include "utils.cuh"
template <typename T>
void SpeculateWriteCacheKV(const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv,
const paddle::Tensor& seq_lens,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out) {
auto max_blocks_per_seq = meta_data.max_blocks_per_seq;
auto bsz = meta_data.batch_size;
auto block_size = meta_data.block_size;
auto head_dim_qk = meta_data.head_dims;
auto head_dim_v = meta_data.head_dims_v;
auto num_heads = meta_data.q_num_heads;
auto kv_num_heads = meta_data.kv_num_heads;
auto token_num = meta_data.token_nums;
const uint32_t elem_nums = token_num * kv_num_heads * (head_dim_qk + head_dim_v);
constexpr int PackSize = 16 / sizeof(T);
const int pack_num = elem_nums / PackSize;
const int blocksize = 128;
int grid_size = 1;
GetNumBlocks<128>(pack_num, &grid_size);
append_speculate_cache_kernel<T, PackSize>
<<<grid_size, blocksize, 0, stream>>>(
reinterpret_cast<T*>(const_cast<T*>(qkv.data<T>())),
reinterpret_cast<T*>(key_cache_out->data<T>()),
reinterpret_cast<T*>(value_cache_out->data<T>()),
block_tables.data<int>(),
padding_offsets.data<int>(),
cum_offsets.data<int>(),
seq_lens.data<int>(),
max_seq_len,
max_blocks_per_seq,
num_heads,
head_dim_qk,
head_dim_v,
block_size,
elem_nums,
kv_num_heads);
}
// rope + write
template <typename T, typename QKV_TYPE>
void append_speculate_cache_rope(const QKV_TYPE* qkv,
T* key_cache,
T* value_cache,
T* qkv_out,
const int* block_tables,
const int* padding_offsets,
const int* cum_offsets,
const int* seq_lens,
const int* seq_lens_encoder,
const float* cos_emb,
const float* sin_emb,
const float* qkv_out_scales,
const T* qkv_biases,
const int max_seq_len,
const int max_blocks_per_seq,
const int num_heads,
const int kv_num_heads,
const int dim_head,
const int block_size,
const int bsz,
const int token_num,
const cudaStream_t& stream,
const bool use_neox_style) {
int output_inner_dim = num_heads + 2 * kv_num_heads;
const uint32_t elem_nums =
use_neox_style ? token_num * (num_heads + 2 * kv_num_heads) * dim_head / 2
: token_num * (num_heads + 2 * kv_num_heads) * dim_head;
constexpr int PackSize = 16 / sizeof(T);
const int pack_num = elem_nums / PackSize;
const int threads_per_block = 128;
int grid_size = 1;
GetNumBlocks(pack_num, &grid_size);
if (use_neox_style) {
append_speculate_cache_neox_rope_kernel<T, PackSize>
<<<grid_size, threads_per_block, 0, stream>>>(
qkv, // [token_num, num_heads + 2 * gqa_group_size, head_size]
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases, // [num_head + 2 * gqa_group_size, dim_head]
max_seq_len,
max_blocks_per_seq,
num_heads,
output_inner_dim,
dim_head,
block_size,
elem_nums,
kv_num_heads);
} else {
append_speculate_cache_rope_kernel<T, PackSize>
<<<grid_size, threads_per_block, 0, stream>>>(
qkv, // [token_num, num_heads + 2 * gqa_group_size, head_size]
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases, // [num_head + 2 * gqa_group_size, dim_head]
max_seq_len,
max_blocks_per_seq,
num_heads,
output_inner_dim,
dim_head,
block_size,
elem_nums,
kv_num_heads);
}
}
template <typename T, typename QKV_TYPE>
void append_speculate_cache_int8_rope(const QKV_TYPE* qkv,
uint8_t* key_cache,
uint8_t* value_cache,
T* qkv_out,
const int* block_tables,
const int* padding_offsets,
const int* cum_offsets,
const int* seq_lens,
const int* seq_lens_encoder,
const float* cos_emb,
const float* sin_emb,
const float* qkv_out_scales,
const T* qkv_biases,
const T* cache_k_scale,
const T* cache_v_scale,
const int max_seq_len,
const int max_blocks_per_seq,
const int num_heads,
const int kv_num_heads,
const int dim_head,
const int block_size,
const int bsz,
const int token_num,
const cudaStream_t& stream,
const bool use_neox_style) {
constexpr int num_warps = 4;
const int all_warps =
((num_heads + 2 * kv_num_heads) + num_warps - 1) / num_warps * num_warps;
dim3 grids(token_num, all_warps / num_warps);
append_clear_cache_int8_block<4>
<<<grids, num_warps * 32, 0, stream>>>(key_cache,
value_cache,
seq_lens,
block_tables,
padding_offsets,
cum_offsets,
seq_lens_encoder,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
kv_num_heads);
if (use_neox_style) {
append_speculate_cache_int8_neox_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(qkv,
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases,
cache_k_scale,
cache_v_scale,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
127.0f,
-127.0f,
kv_num_heads);
} else {
append_speculate_cache_int8_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(qkv,
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases,
cache_k_scale,
cache_v_scale,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
127.0f,
-127.0f,
kv_num_heads);
}
}
template <typename T, typename QKV_TYPE>
void append_speculate_cache_int4_rope(const QKV_TYPE* qkv,
uint8_t* key_cache,
uint8_t* value_cache,
T* qkv_out,
const int* block_tables,
const int* padding_offsets,
const int* cum_offsets,
const int* seq_lens,
const int* seq_lens_encoder,
const float* cos_emb,
const float* sin_emb,
const float* qkv_out_scales,
const T* qkv_biases,
const T* cache_k_scale,
const T* cache_v_scale,
const T* cache_k_zp,
const T* cache_v_zp,
const int max_seq_len,
const int max_blocks_per_seq,
const int num_heads,
const int kv_num_heads,
const int dim_head,
const int block_size,
const int bsz,
const int token_num,
const cudaStream_t& stream,
const bool use_neox_style) {
constexpr int num_warps = 4;
const int all_warps =
((num_heads + 2 * kv_num_heads) + num_warps - 1) / num_warps * num_warps;
dim3 grids(token_num, all_warps / num_warps);
append_clear_cache_int4_block<4>
<<<grids, num_warps * 32, 0, stream>>>(key_cache,
value_cache,
seq_lens,
block_tables,
padding_offsets,
cum_offsets,
seq_lens_encoder,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
kv_num_heads);
if (use_neox_style) {
append_speculate_cache_int4_neox_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(qkv,
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases,
cache_k_scale,
cache_v_scale,
cache_k_zp,
cache_v_zp,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
7.0f,
-8.0f,
kv_num_heads);
} else {
append_speculate_cache_int4_rope_kernel<T, 4>
<<<grids, num_warps * 32, 0, stream>>>(qkv,
key_cache,
value_cache,
qkv_out,
block_tables,
padding_offsets,
cum_offsets,
seq_lens,
seq_lens_encoder,
cos_emb,
sin_emb,
qkv_out_scales,
qkv_biases,
cache_k_scale,
cache_v_scale,
cache_k_zp,
cache_v_zp,
max_seq_len,
max_blocks_per_seq,
num_heads,
block_size,
7.0f,
-8.0f,
kv_num_heads);
}
}
template <typename T, typename QKV_TYPE>
void SpeculateWriteCacheWithRoPEKernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv,
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out) {
typedef cascade_attn_type_traits<T> traits_;
typedef cascade_attn_type_traits<QKV_TYPE> qkt_nv_type_;
typedef typename traits_::type DataType_;
typedef typename qkt_nv_type_::type QKV_Data_TYPE;
const QKV_TYPE* qkv_ptr = qkv.data<QKV_TYPE>();
auto max_blocks_per_seq = meta_data.max_blocks_per_seq;
auto bsz = meta_data.batch_size;
auto token_nums = meta_data.token_nums;
auto block_size = meta_data.block_size;
auto dim_head = meta_data.head_dims;
auto num_heads = meta_data.q_num_heads;
auto kv_num_heads = meta_data.kv_num_heads;
if (rotary_embs) {
const float* cos_emb =
rotary_embs ? rotary_embs.get().data<float>() : nullptr;
const float* sin_emb =
use_neox_rotary_style
? rotary_embs.get().data<float>() + max_seq_len * dim_head
: rotary_embs.get().data<float>() + max_seq_len * dim_head / 2;
if (cache_quant_type_str == "none") {
append_speculate_cache_rope(
reinterpret_cast<const QKV_TYPE*>(qkv_ptr),
reinterpret_cast<DataType_*>(key_cache_out->data<T>()),
reinterpret_cast<DataType_*>(value_cache_out->data<T>()),
reinterpret_cast<DataType_*>(qkv_out->data<T>()),
block_tables.data<int>(),
padding_offsets.data<int>(),
cum_offsets.data<int>(),
seq_lens.data<int>(),
seq_lens_encoder.data<int>(),
cos_emb,
sin_emb,
qkv_out_scales ? qkv_out_scales.get().data<float>() : nullptr,
qkv_biases ? reinterpret_cast<DataType_*>(
const_cast<T*>(qkv_biases.get().data<T>()))
: nullptr,
max_seq_len,
max_blocks_per_seq,
num_heads,
kv_num_heads,
dim_head,
block_size,
bsz,
token_nums,
stream,
use_neox_rotary_style);
} else if (cache_quant_type_str == "cache_int8") {
append_speculate_cache_int8_rope(
reinterpret_cast<const QKV_TYPE*>(qkv_ptr),
key_cache_out->data<uint8_t>(),
value_cache_out->data<uint8_t>(),
reinterpret_cast<DataType_*>(qkv_out->data<T>()),
block_tables.data<int>(),
padding_offsets.data<int>(),
cum_offsets.data<int>(),
seq_lens.data<int>(),
seq_lens_encoder.data<int>(),
cos_emb,
sin_emb,
qkv_out_scales ? qkv_out_scales.get().data<float>() : nullptr,
qkv_biases ? reinterpret_cast<DataType_*>(
const_cast<T*>(qkv_biases.get().data<T>()))
: nullptr,
cache_k_scale ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_k_scale.get().data<T>()))
: nullptr,
cache_v_scale ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_v_scale.get().data<T>()))
: nullptr,
max_seq_len,
max_blocks_per_seq,
num_heads,
kv_num_heads,
dim_head,
block_size,
bsz,
token_nums,
stream,
use_neox_rotary_style);
} else if (cache_quant_type_str == "cache_int4_zp") {
append_speculate_cache_int4_rope(
reinterpret_cast<const QKV_TYPE*>(qkv_ptr),
key_cache_out->data<uint8_t>(),
value_cache_out->data<uint8_t>(),
reinterpret_cast<DataType_*>(const_cast<T*>(qkv_out->data<T>())),
block_tables.data<int>(),
padding_offsets.data<int>(),
cum_offsets.data<int>(),
seq_lens.data<int>(),
seq_lens_encoder.data<int>(),
cos_emb,
sin_emb,
qkv_out_scales ? qkv_out_scales.get().data<float>() : nullptr,
qkv_biases ? reinterpret_cast<DataType_*>(
const_cast<T*>(qkv_biases.get().data<T>()))
: nullptr,
cache_k_scale ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_k_scale.get().data<T>()))
: nullptr,
cache_v_scale ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_v_scale.get().data<T>()))
: nullptr,
cache_k_zp ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_k_zp.get().data<T>()))
: nullptr,
cache_v_zp ? reinterpret_cast<DataType_*>(
const_cast<T*>(cache_v_zp.get().data<T>()))
: nullptr,
max_seq_len,
max_blocks_per_seq,
num_heads,
kv_num_heads,
dim_head,
block_size,
bsz,
token_nums,
stream,
use_neox_rotary_style);
} else {
PD_THROW(
"cache_quant_type_str should be one of [none, cache_int8, "
"cache_int4_zp]");
}
} else {
SpeculateWriteCacheKV<QKV_TYPE>(meta_data,
qkv,
seq_lens,
padding_offsets,
cum_offsets,
block_tables,
max_seq_len,
stream,
key_cache_out,
value_cache_out);
}
}
template void SpeculateWriteCacheWithRoPEKernel<paddle::bfloat16, int>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// gqa_group_size, head_dim] if GQA)
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);
template void
SpeculateWriteCacheWithRoPEKernel<paddle::bfloat16, paddle::bfloat16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// gqa_group_size, head_dim] if GQA)
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);
template void SpeculateWriteCacheWithRoPEKernel<paddle::float16, int>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// gqa_group_size, head_dim] if GQA)
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);
template void
SpeculateWriteCacheWithRoPEKernel<paddle::float16, paddle::float16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// gqa_group_size, head_dim] if GQA)
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);

View File

@@ -0,0 +1,42 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "speculate_write_cache_with_rope_impl.cuh"
template <typename T, typename QKV_TYPE = int>
void SpeculateWriteCacheWithRoPEKernel(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// gqa_group_size, head_dim] if GQA)
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_seq_len,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);

View File

@@ -0,0 +1,58 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c16_impl.cuh"
template void CascadeAppendAttentionC16Kernel<paddle::bfloat16, paddle::bfloat16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c16_impl.cuh"
template void CascadeAppendAttentionC16Kernel<paddle::bfloat16, paddle::float8_e4m3fn>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c16_impl.cuh"
template void CascadeAppendAttentionC16Kernel<paddle::bfloat16, int8_t>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c16_impl.cuh"
template void CascadeAppendAttentionC16Kernel<paddle::float16, paddle::float16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c16_impl.cuh"
template void CascadeAppendAttentionC16Kernel<paddle::float16, paddle::float8_e4m3fn>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c16_impl.cuh"
template void CascadeAppendAttentionC16Kernel<paddle::float16, int8_t>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c4_impl.cuh"
template void CascadeAppendAttentionC4Kernel<paddle::bfloat16, paddle::bfloat16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c4_impl.cuh"
template void CascadeAppendAttentionC4Kernel<paddle::bfloat16, paddle::float8_e4m3fn>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c4_impl.cuh"
template void CascadeAppendAttentionC4Kernel<paddle::bfloat16, int8_t>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,58 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c4_impl.cuh"
template void CascadeAppendAttentionC4Kernel<paddle::float16, paddle::float16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c4_impl.cuh"
template void CascadeAppendAttentionC4Kernel<paddle::float16, paddle::float8_e4m3fn>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c4_impl.cuh"
template void CascadeAppendAttentionC4Kernel<paddle::float16, int8_t>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,59 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c8_impl.cuh"
template void
CascadeAppendAttentionC8Kernel<paddle::bfloat16, paddle::bfloat16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c8_impl.cuh"
template void CascadeAppendAttentionC8Kernel<paddle::bfloat16, paddle::float8_e4m3fn>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c8_impl.cuh"
template void CascadeAppendAttentionC8Kernel<paddle::bfloat16, int8_t>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c8_impl.cuh"
template void CascadeAppendAttentionC8Kernel<paddle::float16, paddle::float16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c8_impl.cuh"
template void CascadeAppendAttentionC8Kernel<paddle::float16, paddle::float8_e4m3fn>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,57 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../append_attention_c8_impl.cuh"
template void CascadeAppendAttentionC8Kernel<paddle::float16, int8_t>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor& qkv, // [token_num, num_heads, head_dim]
const paddle::Tensor&
cache_k, // [max_block_num, num_heads, block_size, head_dim]
const paddle::Tensor&
cache_v, // [max_block_num, num_heads, head_dim, block_size]
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>&
cache_k_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_scale, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_k_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
cache_v_zp, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
shift_bias, // [num_kv_heads, head_dim]
const paddle::optional<paddle::Tensor>&
smooth_weight, // [num_kv_heads, head_dim]
const paddle::Tensor& seq_lens_q,
const paddle::Tensor& seq_lens_kv,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_table,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids_per_batch,
const int num_blocks,
const int block_shape_q,
const int max_seq_len,
const int max_dec_len,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool is_decoder,
const bool enable_prefill,
cudaStream_t& stream,
paddle::Tensor* out);

View File

@@ -0,0 +1,45 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../encoder_write_cache_with_rope_kernel.h"
template void
EncoderWriteCacheWithRopeKernel<paddle::bfloat16, paddle::bfloat16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// kv_num_heads, head_dim] if GQA)
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const paddle::optional<paddle::Tensor>& excess_blocks,
const std::string& cache_quant_type_str,
const int num_blocks,
const int max_seq_len,
const bool use_neox_style,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);

View File

@@ -0,0 +1,44 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../encoder_write_cache_with_rope_kernel.h"
template void EncoderWriteCacheWithRopeKernel<paddle::bfloat16, int>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// kv_num_heads, head_dim] if GQA)
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const paddle::optional<paddle::Tensor>& excess_blocks,
const std::string& cache_quant_type_str,
const int num_blocks,
const int max_seq_len,
const bool use_neox_style,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);

View File

@@ -0,0 +1,44 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../encoder_write_cache_with_rope_kernel.h"
template void EncoderWriteCacheWithRopeKernel<paddle::float16, paddle::float16>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// kv_num_heads, head_dim] if GQA)
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const paddle::optional<paddle::Tensor>& excess_blocks,
const std::string& cache_quant_type_str,
const int num_blocks,
const int max_seq_len,
const bool use_neox_style,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);

View File

@@ -0,0 +1,44 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "../encoder_write_cache_with_rope_kernel.h"
template void EncoderWriteCacheWithRopeKernel<paddle::float16, int>(
const AppendAttnMetaData& meta_data,
const paddle::Tensor&
qkv, // [token_num, 3, num_head, head_dim] ([token_num, num_head + 2 *
// kv_num_heads, head_dim] if GQA)
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::Tensor& batch_ids,
const paddle::Tensor& tile_ids,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& qkv_biases,
const paddle::optional<paddle::Tensor>& cache_k_scale,
const paddle::optional<paddle::Tensor>& cache_v_scale,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const paddle::optional<paddle::Tensor>& excess_blocks,
const std::string& cache_quant_type_str,
const int num_blocks,
const int max_seq_len,
const bool use_neox_style,
cudaStream_t& stream,
paddle::Tensor* qkv_out,
paddle::Tensor* key_cache_out,
paddle::Tensor* value_cache_out);

View File

@@ -0,0 +1,474 @@
// Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <cuda_bf16.h>
#include <cuda_fp8.h>
#include <cuda_runtime.h>
#include "mem_util.cuh"
struct AppendAttnMetaData {
int batch_size;
int block_size;
int q_num_heads;
int kv_num_heads;
int token_nums;
int head_dims;
int head_dims_v;
int max_blocks_per_seq;
};
__forceinline__ __host__ __device__ int div_up(int a, int b) {
return (a + b - 1) / b;
}
enum PosEncMode { kNonePos, kRoPE, kAliBi };
enum CacheType { CacheT, CacheInt8Hw, CacheInt4CwZp };
template <typename T>
struct cascade_attn_type_traits {
using type = T;
};
template <>
struct cascade_attn_type_traits<phi::dtype::bfloat16> {
using type = __nv_bfloat16;
};
template <>
struct cascade_attn_type_traits<phi::dtype::float16> {
using type = half;
};
template <>
struct cascade_attn_type_traits<phi::dtype::float8_e4m3fn> {
using type = __nv_fp8_e4m3;
};
template <typename T>
struct cascade_attn_nv_type2_traits {
using type = T;
};
template <>
struct cascade_attn_nv_type2_traits<__nv_bfloat16> {
using type = __nv_bfloat162;
};
template <>
struct cascade_attn_nv_type2_traits<half> {
using type = half2;
};
template <CacheType cache_type>
struct vec_traits {
using type = b128_t;
};
template <>
struct vec_traits<CacheType::CacheInt8Hw> {
using type = b64_t;
};
template <>
struct vec_traits<CacheType::CacheInt4CwZp> {
using type = b32_t;
};
template <typename T, CacheType cache_type>
struct cache_type_traits {
using type = T;
};
template <typename T>
struct cache_type_traits<T, CacheType::CacheInt8Hw> {
using type = uint8_t;
};
template <typename T>
struct cache_type_traits<T, CacheType::CacheInt4CwZp> {
using type = uint8_t;
};
__device__ __forceinline__ uint32_t sub_if_greater_or_zero(uint32_t x,
uint32_t y) {
return (x > y) ? x - y : 0U;
}
/******************************FASTER CAST*********************************/
inline __device__ static void convert_int8(
__nv_bfloat16* result, const uint32_t& source) { // 4 int8 each time
uint32_t* bf16_result_ptr = reinterpret_cast<uint32_t*>(result);
uint32_t const i8s = reinterpret_cast<uint32_t const&>(source);
static constexpr uint32_t fp32_base = 0x4B000000;
float fp32_intermediates[4];
uint32_t* fp32_intermediates_casted =
reinterpret_cast<uint32_t*>(fp32_intermediates);
fp32_intermediates_casted[0] = __byte_perm(i8s, fp32_base, 0x7650);
fp32_intermediates_casted[1] = __byte_perm(i8s, fp32_base, 0x7651);
fp32_intermediates_casted[2] = __byte_perm(i8s, fp32_base, 0x7652);
fp32_intermediates_casted[3] = __byte_perm(i8s, fp32_base, 0x7653);
#pragma unroll
for (int ii = 0; ii < 4; ++ii) {
fp32_intermediates[ii] -= 8388736.f; // (8388608.f + 128.f);
}
#pragma unroll
for (int ii = 0; ii < 2; ++ii) {
bf16_result_ptr[ii] = __byte_perm(fp32_intermediates_casted[2 * ii + 0],
fp32_intermediates_casted[2 * ii + 1],
0x7632);
}
}
inline __device__ static void convert_int8(
half* result, const uint32_t& source) { // 4 int8 each time
uint32_t* fp16_result_ptr = reinterpret_cast<uint32_t*>(result);
uint32_t const i8s = reinterpret_cast<uint32_t const&>(source);
static constexpr uint32_t mask_for_elt_01 = 0x5150;
static constexpr uint32_t mask_for_elt_23 = 0x5352;
static constexpr uint32_t start_byte_for_fp16 = 0x64646464;
asm volatile("prmt.b32 %0,%1,%2,%3;\n"
: "=r"(fp16_result_ptr[0])
: "r"(i8s), "n"(start_byte_for_fp16), "n"(mask_for_elt_01));
asm volatile("prmt.b32 %0,%1,%2,%3;\n"
: "=r"(fp16_result_ptr[1])
: "r"(i8s), "n"(start_byte_for_fp16), "n"(mask_for_elt_23));
static constexpr uint32_t I8s_TO_F16s_MAGIC_NUM = 0x64806480;
asm volatile("sub.f16x2 %0, %1, %2;\n"
: "=r"(fp16_result_ptr[0])
: "r"(fp16_result_ptr[0]), "r"(I8s_TO_F16s_MAGIC_NUM));
asm volatile("sub.f16x2 %0, %1, %2;\n"
: "=r"(fp16_result_ptr[1])
: "r"(fp16_result_ptr[1]), "r"(I8s_TO_F16s_MAGIC_NUM));
}
inline __device__ static void convert_int4(
__nv_bfloat16* result, const uint32_t& source) { // 8 int4 each time
uint32_t* bf16_result_ptr = reinterpret_cast<uint32_t*>(result);
static constexpr uint32_t immLut = (0xf0 & 0xcc) | 0xaa;
static constexpr uint32_t MASK = 0x0f0f0f0f; // 0xf -> 0b1111 select 0,4
static constexpr uint32_t I4s_TO_FP32s_MAGIC_NUM = 0x43434343;
static constexpr uint32_t mask_for_elt_01 = 0x5150;
static constexpr uint32_t mask_for_elt_23 = 0x5352;
uint32_t tmp1 = source & MASK; // 0 1 2 3
uint32_t tmp2 = source >> 4 & MASK; // 4 5 6 7
bf16_result_ptr[0] = __byte_perm(tmp1,
I4s_TO_FP32s_MAGIC_NUM,
mask_for_elt_01); // 0 1
bf16_result_ptr[1] = __byte_perm(tmp1,
I4s_TO_FP32s_MAGIC_NUM,
mask_for_elt_23); // 2 3
bf16_result_ptr[2] = __byte_perm(tmp2,
I4s_TO_FP32s_MAGIC_NUM,
mask_for_elt_01); // 4 5
bf16_result_ptr[3] = __byte_perm(tmp2,
I4s_TO_FP32s_MAGIC_NUM,
mask_for_elt_23); // 6 7
}
inline __device__ static void convert_int4(
half* result, const uint32_t& source) { // 7 5 3 1 6 4 2 0
uint32_t* fp16_result_ptr = reinterpret_cast<uint32_t*>(result);
static constexpr uint32_t MASK =
0x0f0f0f0f; // 0xf -> 0b1111 select 0,1; 7 5 3 1 6 4 2 0
static constexpr uint32_t I4s_TO_FP32s_MAGIC_NUM = 0x64646464;
static constexpr uint32_t mask_for_elt_01 = 0x5150;
static constexpr uint32_t mask_for_elt_23 = 0x5352;
uint32_t tmp1 = source & MASK; // 0 1 2 3
uint32_t tmp2 = source >> 4 & MASK; // 4 5 6 7
fp16_result_ptr[0] = __byte_perm(tmp1,
I4s_TO_FP32s_MAGIC_NUM,
mask_for_elt_01); // 0 1
fp16_result_ptr[1] = __byte_perm(tmp1,
I4s_TO_FP32s_MAGIC_NUM,
mask_for_elt_23); // 2 3
fp16_result_ptr[2] = __byte_perm(tmp2,
I4s_TO_FP32s_MAGIC_NUM,
mask_for_elt_01); // 4 5
fp16_result_ptr[3] = __byte_perm(tmp2,
I4s_TO_FP32s_MAGIC_NUM,
mask_for_elt_23); // 6 7
}
/******************* vec_t type cast *******************/
template <typename dst_t, typename src_t, size_t vec_size>
__forceinline__ __host__ __device__ void vec_cast(dst_t* dst,
const src_t* src) {
#pragma unroll
for (size_t i = 0; i < vec_size; ++i) {
dst[i] = src[i];
}
}
template <size_t vec_size>
__forceinline__ __host__ __device__ void vec_cast<float, half>(
float* dst, const half* src) {
#pragma unroll
for (size_t i = 0; i < vec_size / 2; ++i) {
((float2*)dst)[i] = __half22float2(((half2*)src)[i]);
}
}
template <size_t vec_size>
__forceinline__ __host__ __device__ void vec_cast<half, float>(
half* dst, const float* src) {
#pragma unroll
for (size_t i = 0; i < vec_size / 2; ++i) {
((half2*)dst)[i] = __float22half2_rn(((float2*)src)[i]);
}
}
template <size_t vec_size>
__forceinline__ __host__ __device__ void vec_cast<float, nv_bfloat16>(
float* dst, const nv_bfloat16* src) {
#pragma unroll
for (size_t i = 0; i < vec_size / 2; ++i) {
((float2*)dst)[i] = __bfloat1622float2(((nv_bfloat162*)src)[i]);
}
}
template <size_t vec_size>
__forceinline__ __host__ __device__ void vec_cast<nv_bfloat16, float>(
nv_bfloat16* dst, const float* src) {
#pragma unroll
for (size_t i = 0; i < vec_size / 2; ++i) {
((nv_bfloat162*)dst)[i] = __float22bfloat162_rn(((float2*)src)[i]);
}
}
#define CHECK_CUDA_CALL(func, ...) \
{ \
cudaError_t e = (func); \
if (e != cudaSuccess) { \
std::cerr << "CUDA Error: " << cudaGetErrorString(e) << " (" << e \
<< ") " << __FILE__ << ": line " << __LINE__ \
<< " at function " << STR(func) << std::endl; \
return e; \
} \
}
#define DISPATCH_GQA_HEAD_DIM(head_dim, HEAD_DIM, ...) \
switch (head_dim) { \
case 128: { \
constexpr size_t HEAD_DIM = 128; \
__VA_ARGS__ \
break; \
} \
case 192: { \
constexpr size_t HEAD_DIM = 192; \
__VA_ARGS__ \
break; \
} \
default: { \
PD_THROW("not support the head_dim: ", head_dim); \
} \
}
#define DISPATCH_MLA_HEAD_DIM(head_dim, HEAD_DIM, ...) \
switch (head_dim) { \
case 128: { \
constexpr size_t HEAD_DIM = 128; \
__VA_ARGS__ \
break; \
} \
case 192: { \
constexpr size_t HEAD_DIM = 192; \
__VA_ARGS__ \
break; \
} \
case 512: { \
constexpr size_t HEAD_DIM = 512; \
__VA_ARGS__ \
break; \
} \
case 576: { \
constexpr size_t HEAD_DIM = 576; \
__VA_ARGS__ \
break; \
} \
default: { \
PD_THROW("not support the head_dim: ", head_dim); \
} \
}
#define DISPATCH_NUM_STAGE(num_stage, NUM_STAGE, ...) \
if (num_stage == 2) { \
constexpr size_t NUM_STAGE = 2; \
__VA_ARGS__ \
} else { \
PD_THROW("not support the num_stage: ", num_stage); \
}
#define DISPATCH_CACHE_TYPE(cache_type, cache_type_now, cache_bytes, ...) \
if (cache_type == 0) { \
constexpr CacheType cache_type_now = CacheType::CacheT; \
constexpr size_t cache_bytes = 16; \
__VA_ARGS__ \
} else if (cache_type == 1) { \
constexpr CacheType cache_type_now = CacheType::CacheInt8Hw; \
constexpr size_t cache_bytes = 8; \
__VA_ARGS__ \
} else if (cache_type == 2) { \
constexpr CacheType cache_type_now = CacheType::CacheInt4CwZp; \
constexpr size_t cache_bytes = 4; \
__VA_ARGS__ \
} else { \
PD_THROW("not support the cache_type: ", cache_type); \
}
#define DISPATCH_DEAL_EACH_TIME(deal_each_time, DEAL_EACH_TIME, ...) \
if (deal_each_time == 16) { \
constexpr size_t DEAL_EACH_TIME = 16; \
__VA_ARGS__ \
} else if (deal_each_time == 32) { \
constexpr size_t DEAL_EACH_TIME = 32; \
__VA_ARGS__ \
} else { \
PD_THROW("not support the deal_each_time: ", deal_each_time); \
}
#define DISPATCH_GQA_GROUP_SIZE(group_size, GROUP_SIZE, ...) \
if (group_size == 1) { \
constexpr size_t GROUP_SIZE = 1; \
__VA_ARGS__ \
} else if (group_size == 2) { \
constexpr size_t GROUP_SIZE = 2; \
__VA_ARGS__ \
} else if (group_size == 3) { \
constexpr size_t GROUP_SIZE = 3; \
__VA_ARGS__ \
} else if (group_size == 4) { \
constexpr size_t GROUP_SIZE = 4; \
__VA_ARGS__ \
} else if (group_size == 5) { \
constexpr size_t GROUP_SIZE = 5; \
__VA_ARGS__ \
} else if (group_size == 6) { \
constexpr size_t GROUP_SIZE = 6; \
__VA_ARGS__ \
} else if (group_size == 7) { \
constexpr size_t GROUP_SIZE = 7; \
__VA_ARGS__ \
} else if (group_size == 8) { \
constexpr size_t GROUP_SIZE = 8; \
__VA_ARGS__ \
} else if (group_size == 16) { \
constexpr size_t GROUP_SIZE = 16; \
__VA_ARGS__ \
} else { \
PD_THROW("not support the group_size: ", group_size); \
}
#define DISPATCH_MLA_GROUP_SIZE(group_size, GROUP_SIZE, ...) \
if (group_size == 1) { \
constexpr size_t GROUP_SIZE = 1; \
__VA_ARGS__ \
} else if (group_size == 2) { \
constexpr size_t GROUP_SIZE = 2; \
__VA_ARGS__ \
} else if (group_size == 4) { \
constexpr size_t GROUP_SIZE = 4; \
__VA_ARGS__ \
} else if (group_size == 8) { \
constexpr size_t GROUP_SIZE = 8; \
__VA_ARGS__ \
} else if (group_size == 16) { \
constexpr size_t GROUP_SIZE = 16; \
__VA_ARGS__ \
} else if (group_size == 128) { \
constexpr size_t GROUP_SIZE = 128; \
__VA_ARGS__ \
} else { \
PD_THROW("not support the group_size: ", group_size); \
}
#define DISPATCH_BLOCKSHAPE_Q(block_shape_q, BLOCK_SHAPE_Q, NUM_WARP_Q, ...) \
if (block_shape_q <= 16) { \
constexpr size_t BLOCK_SHAPE_Q = 16; \
constexpr size_t NUM_WARP_Q = 1; \
__VA_ARGS__ \
} else if (block_shape_q <= 64) { \
constexpr size_t BLOCK_SHAPE_Q = 64; \
constexpr size_t NUM_WARP_Q = 4; \
__VA_ARGS__ \
} else { \
PD_THROW("not support the block_shape_q: ", block_shape_q); \
}
#define DISPATCH_CAUSAL(causal, CAUSAL, ...) \
if (causal) { \
constexpr bool CAUSAL = true; \
__VA_ARGS__ \
} else { \
PD_THROW("not support the causal: ", causal); \
}
#define DISPATCH_ENABLE_PREFILL(enable_prefill, ENABLE_PREFILL, ...) \
if (enable_prefill) { \
constexpr bool ENABLE_PREFILL = 1; \
__VA_ARGS__ \
} else { \
constexpr bool ENABLE_PREFILL = 0; \
__VA_ARGS__ \
}
#define DISPATCH_BLOCK_SIZE(block_size, BLOCK_SIZE, ...) \
if (block_size == 64) { \
constexpr size_t BLOCK_SIZE = 64; \
__VA_ARGS__ \
} else { \
PD_THROW("not support the block_size: ", block_size); \
}
#define DISPATCH_BLOCKSHAPE_Q_SYSTEM( \
block_shape_q, BLOCK_SHAPE_Q, NUM_WARP_Q, ...) \
if (block_shape_q <= 16) { \
constexpr size_t BLOCK_SHAPE_Q = 16; \
constexpr size_t NUM_WARP_Q = 1; \
__VA_ARGS__ \
} else if (block_shape_q <= 32) { \
constexpr size_t BLOCK_SHAPE_Q = 32; \
constexpr size_t NUM_WARP_Q = 1; \
__VA_ARGS__ \
} else { \
PD_THROW("not support the block_shape_q: ", block_shape_q); \
}
template <typename T>
inline HOSTDEVICE T roundWithTiesToEven(T x) {
T xLower = floor(x);
T xUpper = ceil(x);
// x is in interval [xl,xu]. Choose closest of two bounds, breaking ties to
// even.
T dLower = x - xLower;
T dUpper = xUpper - x;
return static_cast<T>(
(dLower == dUpper ? fmod(xLower, 2.0F) == 0.0F : dLower < dUpper)
? xLower
: xUpper);
}

365
csrc/gpu/cpp_extensions.cu Normal file
View File

@@ -0,0 +1,365 @@
// Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/extension.h"
#include "all_reduce.h"
namespace py = pybind11;
std::vector<paddle::Tensor> AppendAttention(
const paddle::Tensor& qkv,
const paddle::Tensor& key_cache,
const paddle::Tensor& value_cache,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::Tensor& encoder_batch_ids,
const paddle::Tensor& encoder_tile_ids_per_batch,
const paddle::Tensor& encoder_num_blocks,
const paddle::Tensor& kv_batch_ids,
const paddle::Tensor& kv_tile_ids_per_batch,
const paddle::Tensor& kv_num_blocks,
const paddle::Tensor& decoder_batch_ids,
const paddle::Tensor& decoder_tile_ids_per_batch,
const paddle::Tensor& decoder_num_blocks,
const paddle::Tensor& max_enc_len_this_time,
const paddle::Tensor& max_dec_len_this_time,
const paddle::Tensor& max_len_kv,
const paddle::optional<paddle::Tensor>& rotary_embs,
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>& qkv_bias,
const paddle::optional<paddle::Tensor>& qkv_out_scales,
const paddle::optional<paddle::Tensor>& cache_k_quant_scales,
const paddle::optional<paddle::Tensor>& cache_v_quant_scales,
const paddle::optional<paddle::Tensor>& cache_k_dequant_scales,
const paddle::optional<paddle::Tensor>& cache_v_dequant_scales,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const paddle::optional<paddle::Tensor>& out_linear_shifts,
const paddle::optional<paddle::Tensor>& out_linear_smooths,
const paddle::optional<paddle::Tensor>& excess_blocks,
const std::string& compute_dtype,
const std::string& cache_quant_type_str,
const bool use_neox_rotary_style,
const int max_input_length,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float out_linear_in_scale,
const int speculate_max_draft_token_num,
const bool causal,
const bool speculate_decoder);
void FusedRotaryPositionEncoding(
paddle::Tensor& query, // [num_tokens, num_heads, head_size] or
// [num_tokens, num_heads * head_size]
paddle::Tensor& key,
// [num_tokens, num_kv_heads, head_size] or [num_tokens, num_kv_heads *
// head_size]
const paddle::Tensor& position_ids, // [num_tokens]
const paddle::Tensor& cos_sin_cache, // [max_position, rot_dim]
int head_size,
bool is_neox);
std::vector<paddle::Tensor> MultiHeadLatentAttention(
const paddle::Tensor& query,
const paddle::Tensor& key_cache,
const paddle::Tensor& value_cache,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& cu_seqlens_q,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const paddle::Tensor& encoder_batch_ids,
const paddle::Tensor& encoder_tile_ids_per_batch,
const paddle::Tensor& encoder_num_blocks,
const paddle::Tensor& kv_batch_ids,
const paddle::Tensor& kv_tile_ids_per_batch,
const paddle::Tensor& kv_num_blocks,
const paddle::Tensor& decoder_batch_ids,
const paddle::Tensor& decoder_tile_ids_per_batch,
const paddle::Tensor& decoder_num_blocks,
const paddle::Tensor& decoder_num_blocks_cpu,
const paddle::Tensor& decoder_chunk_size_cpu,
const paddle::Tensor& max_enc_len_this_time,
const paddle::Tensor& max_dec_len_this_time,
const paddle::Tensor& max_len_kv,
const paddle::optional<paddle::Tensor>& attn_mask,
const paddle::optional<paddle::Tensor>& query_bias,
const paddle::optional<paddle::Tensor>& query_out_scales,
const paddle::optional<paddle::Tensor>& cache_k_quant_scales,
const paddle::optional<paddle::Tensor>& cache_v_quant_scales,
const paddle::optional<paddle::Tensor>& cache_k_dequant_scales,
const paddle::optional<paddle::Tensor>& cache_v_dequant_scales,
const paddle::optional<paddle::Tensor>& cache_k_zp,
const paddle::optional<paddle::Tensor>& cache_v_zp,
const paddle::optional<paddle::Tensor>& out_linear_shifts,
const paddle::optional<paddle::Tensor>& out_linear_smooths,
const std::string& compute_dtype,
const std::string& cache_quant_type_str,
const int nope_size,
const int max_input_length,
const float softmax_scale,
const float quant_max_bound,
const float quant_min_bound,
const float out_linear_in_scale,
const int speculate_draft_total_token_num,
const bool causal,
const bool speculate_decoder);
std::vector<paddle::Tensor> GetBlockShapeAndSplitKVBlock(
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& max_enc_len_this_time,
const paddle::Tensor& max_dec_len_this_time,
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& cum_offsets,
const int group_size,
const int block_size,
const int decoder_step_token_num);
std::vector<paddle::Tensor> NoauxTc(paddle::Tensor& scores,
paddle::Tensor& scores_with_bias,
int n_group,
int topk_group,
int topk,
float routed_scaling_factor);
std::vector<paddle::Tensor> PrefillMLAWriteCacheKernel(
const paddle::Tensor& kv_nope,
const paddle::Tensor& kv_pe,
const paddle::Tensor& kv_cache,
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const std::string& cache_quant_type_str,
const int max_seq_len);
std::vector<paddle::Tensor> DecodeMLAWriteCacheKernel(
const paddle::Tensor& kv_nope,
const paddle::Tensor& kv_pe,
const paddle::Tensor& kv_cache,
const paddle::Tensor& seq_lens,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& padding_offsets,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& block_tables,
const std::string& cache_quant_type_str,
const int max_seq_len,
const bool speculate_decoder);
paddle::Tensor cutlass_fp8_fp8_half_block_gemm_fused_func(
const paddle::Tensor& x,
const paddle::Tensor& y,
const paddle::Tensor& x_scale,
const paddle::Tensor& y_scale,
const paddle::optional<paddle::Tensor>& bias,
bool trans_x,
bool trans_y,
std::string output_dtype,
std::string activation_type);
void GetPositionIdsAndMaskEncoderBatch(
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& position_ids,
const paddle::Tensor& mask_encoder_batch);
void SetPreidsTokenPenaltyMultiScores(const paddle::Tensor& pre_ids,
const paddle::Tensor& input_ids,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& step_idx,
const paddle::Tensor& stop_flags,
const paddle::Tensor& logits,
const paddle::Tensor& penalty_scores,
const paddle::Tensor& frequency_scores,
const paddle::Tensor& presence_scores,
const paddle::Tensor& temperatures,
const paddle::Tensor& bad_tokens,
const paddle::Tensor& cur_len,
const paddle::Tensor& min_len,
const paddle::Tensor& eos_token_id);
void UpdateInputesV2(const paddle::Tensor& stop_flags,
const paddle::Tensor& step_idx,
const paddle::Tensor& not_need_stop, // cpu
const paddle::Tensor& seq_lens_this_time,
const paddle::Tensor& seq_lens_encoder,
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& max_dec_len,
const paddle::Tensor& input_ids,
const paddle::Tensor& stop_nums,
const paddle::Tensor& next_tokens,
const paddle::Tensor& is_block_step,
const paddle::Tensor& end_ids,
const paddle::Tensor& kwargs_next_tokens);
paddle::Tensor RebuildPaddingV2Func(const paddle::Tensor& tmp_out, // [token_num, dim_embed]
const paddle::Tensor& cum_offsets, // [bsz, 1]
const paddle::Tensor& seq_lens_decoder,
const paddle::Tensor& seq_lens_encoder,
const paddle::optional<paddle::Tensor>& output_padding_offset,
int max_input_length);
std::vector<paddle::Tensor> PerTokenGroupQuant(const paddle::Tensor& x,
const int group_size,
const bool transpose_scale,
const float quant_max_bound,
const float quant_min_bound);
std::vector<paddle::Tensor> PerTensorQuantFp8(const paddle::Tensor& x, const paddle::optional<paddle::Tensor>& scale);
std::vector<paddle::Tensor> GetPaddingOffsetV2(const paddle::Tensor& input_ids,
const paddle::Tensor& cum_offsets,
const paddle::Tensor& token_num,
const paddle::Tensor& seq_len,
const paddle::optional<paddle::Tensor>& draft_tokens,
const paddle::optional<paddle::Tensor>& seq_lens_encoder);
void SaveOutMmsg(const paddle::Tensor& x,
const paddle::Tensor& not_need_stop, // cpu
int64_t rank_id);
void GetOutput(const paddle::Tensor& x,
int64_t rank_id,
bool wait_flag);
void StepPaddle(const paddle::Tensor &stop_flags,
const paddle::Tensor &seq_lens_this_time,
const paddle::Tensor &ori_seq_lens_encoder,
const paddle::Tensor &seq_lens_encoder,
const paddle::Tensor &seq_lens_decoder,
const paddle::Tensor &block_tables, // [bsz, block_num_per_seq]
const paddle::Tensor &encoder_block_lens,
const paddle::Tensor &is_block_step,
const paddle::Tensor &step_block_list,
const paddle::Tensor &step_lens,
const paddle::Tensor &recover_block_list,
const paddle::Tensor &recover_lens,
const paddle::Tensor &need_block_list,
const paddle::Tensor &need_block_len,
const paddle::Tensor &used_list_len,
const paddle::Tensor &free_list,
const paddle::Tensor &free_list_len,
const paddle::Tensor &input_ids,
const paddle::Tensor &pre_ids,
const paddle::Tensor &step_idx,
const paddle::Tensor &next_tokens,
const paddle::Tensor &first_token_ids,
const int block_size,
const int encoder_decoder_block_num);
void SaveOutputDygraph(
const paddle::Tensor& all_token_ids,
const paddle::Tensor& tokens,
const paddle::Tensor& result_ids,
const paddle::Tensor& step_idx
);
PYBIND11_MODULE(paddlenlp_ops, m) {
/**
* all_reduce.cu
*/
m.def("init_custom_all_reduce", &init_custom_all_reduce, "init all reduce class function");
m.def("all_reduce", &all_reduce, "all reduce function");
m.def("dispose", &dispose, "del function for python");
m.def("meta_size", &meta_size, "meta_size function for Signal struct");
m.def("register_buffer", &register_buffer, "register ipc buffer");
m.def("f_append_attention", &AppendAttention, "AppendAttention");
m.def("f_fused_rotary_position_encoding", &FusedRotaryPositionEncoding, "FusedRotaryPositionEncoding");
m.def("f_multi_head_latent_attention", &MultiHeadLatentAttention, "MultiHeadLatentAttention");
m.def("f_noaux_tc", &NoauxTc, "NoauxTc");
m.def("f_get_block_shape_and_split_kv_block", &GetBlockShapeAndSplitKVBlock, "GetBlockShapeAndSplitKVBlock");
m.def("f_prefill_mla_write_cache", &PrefillMLAWriteCacheKernel, "PrefillMLAWriteCacheKernel");
m.def("f_decode_mla_write_cache", &DecodeMLAWriteCacheKernel, "DecodeMLAWriteCacheKernel");
m.def("f_get_position_ids_and_mask_encoder_batch", &GetPositionIdsAndMaskEncoderBatch, "GetPositionIdsAndMaskEncoderBatch");
m.def("f_set_preids_token_penalty_multi_scores", &SetPreidsTokenPenaltyMultiScores, "SetPreidsTokenPenaltyMultiScores");
m.def("f_update_inputs_v2", &UpdateInputesV2, "UpdateInputesV2");
m.def("f_rebuild_padding_v2", &RebuildPaddingV2Func, "RebuildPaddingV2Func");
m.def("f_per_token_group_quant", &PerTokenGroupQuant, "PerTokenGroupQuant");
m.def("f_per_tensor_quant_fp8", &PerTensorQuantFp8, "PerTensorQuantFp8");
m.def("f_get_padding_offset_v2", &GetPaddingOffsetV2, "GetPaddingOffsetV2");
m.def("f_save_output", &SaveOutMmsg, "SaveOutMmsg");
m.def("f_get_output", &GetOutput, "GetOutput");
m.def("f_step_paddle", &StepPaddle, "StepPaddle");
m.def("f_save_output_dygraph", &SaveOutputDygraph, "SaveOutputDygraph");
// m.def("f_cutlass_fp8_fp8_half_block_gemm_fused", &cutlass_fp8_fp8_half_block_gemm_fused_func, "cutlass_fp8_fp8_half_block_gemm_fused_func");
}
PYBIND11_MODULE(paddlenlp_ops_80, m) {
/**
* all_reduce.cu
*/
m.def("init_custom_all_reduce", &init_custom_all_reduce, "init all reduce class function");
m.def("all_reduce", &all_reduce, "all reduce function");
m.def("dispose", &dispose, "del function for python");
m.def("meta_size", &meta_size, "meta_size function for Signal struct");
m.def("register_buffer", &register_buffer, "register ipc buffer");
m.def("f_append_attention", &AppendAttention, "AppendAttention");
m.def("f_fused_rotary_position_encoding", &FusedRotaryPositionEncoding, "FusedRotaryPositionEncoding");
m.def("f_multi_head_latent_attention", &MultiHeadLatentAttention, "MultiHeadLatentAttention");
m.def("f_noaux_tc", &NoauxTc, "NoauxTc");
m.def("f_get_block_shape_and_split_kv_block", &GetBlockShapeAndSplitKVBlock, "GetBlockShapeAndSplitKVBlock");
m.def("f_prefill_mla_write_cache", &PrefillMLAWriteCacheKernel, "PrefillMLAWriteCacheKernel");
m.def("f_decode_mla_write_cache", &DecodeMLAWriteCacheKernel, "DecodeMLAWriteCacheKernel");
m.def("f_get_position_ids_and_mask_encoder_batch", &GetPositionIdsAndMaskEncoderBatch, "GetPositionIdsAndMaskEncoderBatch");
m.def("f_set_preids_token_penalty_multi_scores", &SetPreidsTokenPenaltyMultiScores, "SetPreidsTokenPenaltyMultiScores");
m.def("f_update_inputs_v2", &UpdateInputesV2, "UpdateInputesV2");
m.def("f_rebuild_padding_v2", &RebuildPaddingV2Func, "RebuildPaddingV2Func");
m.def("f_per_token_group_quant", &PerTokenGroupQuant, "PerTokenGroupQuant");
m.def("f_per_tensor_quant_fp8", &PerTensorQuantFp8, "PerTensorQuantFp8");
m.def("f_get_padding_offset_v2", &GetPaddingOffsetV2, "GetPaddingOffsetV2");
m.def("f_save_output", &SaveOutMmsg, "SaveOutMmsg");
m.def("f_get_output", &GetOutput, "GetOutput");
m.def("f_step_paddle", &StepPaddle, "StepPaddle");
m.def("f_save_output_dygraph", &SaveOutputDygraph, "SaveOutputDygraph");
}
PYBIND11_MODULE(paddlenlp_ops_90, m) {
/**
* all_reduce.cu
*/
m.def("init_custom_all_reduce", &init_custom_all_reduce, "init all reduce class function");
m.def("all_reduce", &all_reduce, "all reduce function");
m.def("dispose", &dispose, "del function for python");
m.def("meta_size", &meta_size, "meta_size function for Signal struct");
m.def("register_buffer", &register_buffer, "register ipc buffer");
m.def("f_append_attention", &AppendAttention, "AppendAttention");
m.def("f_fused_rotary_position_encoding", &FusedRotaryPositionEncoding, "FusedRotaryPositionEncoding");
m.def("f_multi_head_latent_attention", &MultiHeadLatentAttention, "MultiHeadLatentAttention");
m.def("f_noaux_tc", &NoauxTc, "NoauxTc");
m.def("f_get_block_shape_and_split_kv_block", &GetBlockShapeAndSplitKVBlock, "GetBlockShapeAndSplitKVBlock");
m.def("f_prefill_mla_write_cache", &PrefillMLAWriteCacheKernel, "PrefillMLAWriteCacheKernel");
m.def("f_decode_mla_write_cache", &DecodeMLAWriteCacheKernel, "DecodeMLAWriteCacheKernel");
m.def("f_get_position_ids_and_mask_encoder_batch", &GetPositionIdsAndMaskEncoderBatch, "GetPositionIdsAndMaskEncoderBatch");
m.def("f_set_preids_token_penalty_multi_scores", &SetPreidsTokenPenaltyMultiScores, "SetPreidsTokenPenaltyMultiScores");
m.def("f_update_inputs_v2", &UpdateInputesV2, "UpdateInputesV2");
m.def("f_rebuild_padding_v2", &RebuildPaddingV2Func, "RebuildPaddingV2Func");
m.def("f_per_token_group_quant", &PerTokenGroupQuant, "PerTokenGroupQuant");
m.def("f_per_tensor_quant_fp8", &PerTensorQuantFp8, "PerTensorQuantFp8");
m.def("f_get_padding_offset_v2", &GetPaddingOffsetV2, "GetPaddingOffsetV2");
m.def("f_save_output", &SaveOutMmsg, "SaveOutMmsg");
m.def("f_get_output", &GetOutput, "GetOutput");
m.def("f_step_paddle", &StepPaddle, "StepPaddle");
m.def("f_save_output_dygraph", &SaveOutputDygraph, "SaveOutputDygraph");
}

View File

@@ -0,0 +1,113 @@
// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <mutex>
#include "helper.h"
#include "cutlass/half.h"
#include "cutlass/bfloat16.h"
#include "paddle/extension.h"
template <paddle::DataType D>
class CutlassDtypeTraits;
template <>
class CutlassDtypeTraits<paddle::DataType::FLOAT32> {
public:
typedef float DataType;
typedef float data_t;
};
template <>
class CutlassDtypeTraits<paddle::DataType::FLOAT16> {
public:
typedef cutlass::half_t DataType;
typedef paddle::float16 data_t;
};
template <>
class CutlassDtypeTraits<paddle::DataType::BFLOAT16> {
public:
typedef cutlass::bfloat16_t DataType;
typedef paddle::bfloat16 data_t;
};
class CutlassGemmConfigMannager {
public:
static CutlassGemmConfigMannager& getInstance() {
static CutlassGemmConfigMannager instance;
return instance;
}
CutlassGemmConfigMannager(const CutlassGemmConfigMannager&) = delete;
CutlassGemmConfigMannager& operator=(const CutlassGemmConfigMannager&) = delete;
void up_date_configs(const nlohmann::json& j){
std::lock_guard<std::mutex> lock(mutex_);
for (auto it = j.begin(); it != j.end(); ++it) {
json_[it.key()] = it.value();
}
}
nlohmann::json* get_gemm_best_configs(const std::string & config_file_path) {
if (!load_initialized_) {
std::ifstream file(config_file_path);
if(!file.good()){
throw std::runtime_error("cutlass gemm_best_config can not be found, please set gemm_best_config'path as FLAGS_use_cutlass_device_best_config_path, or unset FLAGS_use_cutlass_device_best_config_path to tune gemm_best_config");
}
json_ = ReadJsonFromFile(config_file_path);
load_initialized_ = true;
save_initialized_ = false;
}
return &json_;
}
private:
void save_gemm_best_configs_(const std::string & config_file_path) {
std::ifstream file(config_file_path);
if(!file.good()){
std::ofstream new_file(config_file_path);
new_file << json_.dump(4);
new_file.close();
} else {
nlohmann::json old_json = ReadJsonFromFile(config_file_path);
for (auto it = json_.begin(); it != json_.end(); ++it) {
old_json[it.key()] = it.value();
}
json_ = old_json;
std::ofstream new_file(config_file_path, std::ios::out | std::ios::trunc);
new_file << json_.dump(4);
new_file.close();
file.close();
}
return;
}
CutlassGemmConfigMannager() : json_(nullptr), load_initialized_(false) , save_initialized_(true){}
~CutlassGemmConfigMannager() {
std::lock_guard<std::mutex> lock(mutex_);
if(save_initialized_){
std::string config_file_path = "fp8_fuse_gemm_config.json";
save_gemm_best_configs_(config_file_path);
}
save_initialized_=true;
load_initialized_=false;
json_.clear();
}
mutable std::mutex mutex_;
nlohmann::json json_;
bool load_initialized_;
bool save_initialized_;
};

View File

@@ -0,0 +1,544 @@
/***************************************************************************************************
* Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
* Copyright (c) 2017 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights
*reserved. SPDX-License-Identifier: BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
*this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
*ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
*LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
*CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
*SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
*INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
*CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
*ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
/*! \file
\brief Performs a dual gemm in one fused kernel:
```
D0 = epilogue0(X @ B0, C0)
D1 = epilogue1(X @ B1, C1)
D2 = element_wise(D0, D1)
```
*/
#pragma once
#include "cutlass/arch/arch.h"
#include "cutlass/cutlass.h"
#include "cutlass/device_kernel.h"
#include "cutlass/numeric_types.h"
#include "cutlass/gemm/threadblock/threadblock_swizzle.h"
#include "cutlass/epilogue/thread/linear_combination_relu.h"
#include "cutlass/epilogue/threadblock/default_epilogue_tensor_op.h"
#include "cutlass/gemm/device/default_gemm_configuration.h"
#include "cutlass/gemm/threadblock/default_mma.h"
#include "fp8_gemm_fused/dual_gemm/dual_gemm_common.h"
#include "fp8_gemm_fused/dual_gemm/kernel/dual_gemm.h"
////////////////////////////////////////////////////////////////////////////////
namespace cutlass {
namespace gemm {
namespace device {
/////////////////////////////////////////////////////////////////////////////////////////////////
template <
/// Element type for A matrix operand
typename ElementA_,
/// Layout type for A matrix operand
typename LayoutA_,
/// Element type for B matrix operand
typename ElementB_,
/// Layout type for B0 matrix operand
typename LayoutB0_,
/// Layout type for B1 matrix operand
typename LayoutB1_,
/// Element type for C matrix operands
typename ElementC_,
/// Layout type for D matrix operands
typename ElementD_,
/// Layout type for C and D matrix operands
typename LayoutC_,
/// Element type for internal accumulation
typename ElementAccumulator_,
/// Operator class tag
typename OperatorClass_,
/// Tag indicating architecture to tune for
typename ArchTag_,
/// Threadblock-level tile size (concept: GemmShape)
typename ThreadblockShape_,
/// Warp-level tile size (concept: GemmShape)
typename WarpShape_,
/// Instruction-level tile size (concept: GemmShape)
typename InstructionShape_,
/// Epilogue output operator
typename EpilogueOutputOp0_,
typename EpilogueOutputOp1_,
typename EpilogueOutputOp2_,
/// Threadblock-level swizzling operator
typename ThreadblockSwizzle_ =
threadblock::GemmIdentityThreadblockSwizzle<>,
/// Number of stages used in the pipelined mainloop
int Stages = DefaultGemmConfiguration<OperatorClass_,
ArchTag_,
ElementA_,
ElementB_,
ElementC_,
ElementAccumulator_>::kStages,
bool StoreD0 = true,
bool StoreD1 = true,
/// If true, kernel supports split-K with serial reduction
bool SplitKSerial = false,
/// Access granularity of A matrix in units of elements
int AlignmentA = DefaultGemmConfiguration<OperatorClass_,
ArchTag_,
ElementA_,
ElementB_,
ElementC_,
ElementAccumulator_>::kAlignmentA,
/// Access granularity of B matrix in units of elements
int AlignmentB = DefaultGemmConfiguration<OperatorClass_,
ArchTag_,
ElementA_,
ElementB_,
ElementC_,
ElementAccumulator_>::kAlignmentB,
/// Operation performed by GEMM
typename Operator_ =
typename DefaultGemmConfiguration<OperatorClass_,
ArchTag_,
ElementA_,
ElementB_,
ElementC_,
ElementAccumulator_>::Operator>
class DualGemm {
public:
using ElementA = ElementA_;
using LayoutA = LayoutA_;
using TensorRefA = TensorRef<ElementA const, LayoutA>;
using ElementB = ElementB_;
using LayoutB0 = LayoutB0_;
using LayoutB1 = LayoutB1_;
using TensorRefB0 = TensorRef<ElementB const, LayoutB0>;
using TensorRefB1 = TensorRef<ElementB const, LayoutB1>;
using ElementC = ElementC_;
using ElementD = ElementD_;
using LayoutC = LayoutC_;
using TensorRefC = TensorRef<ElementC const, LayoutC>;
using TensorRefD = TensorRef<ElementD, LayoutC>;
using ElementAccumulator = ElementAccumulator_;
using OperatorClass = OperatorClass_;
using ArchTag = ArchTag_;
using ThreadblockShape = ThreadblockShape_;
using WarpShape = WarpShape_;
using InstructionShape = InstructionShape_;
using EpilogueOutputOp0 = EpilogueOutputOp0_;
using EpilogueOutputOp1 = EpilogueOutputOp1_;
using EpilogueOutputOp2 = EpilogueOutputOp2_;
using ThreadblockSwizzle = ThreadblockSwizzle_;
using Operator = Operator_;
static int const kStages = Stages;
static int const kAlignmentA = AlignmentA;
static int const kAlignmentB = AlignmentB;
static int const kAlignmentC = EpilogueOutputOp1::kCount;
static bool const kSplitKSerial = SplitKSerial;
static bool constexpr kStoreD0 = StoreD0;
static bool constexpr kStoreD1 = StoreD1;
static ComplexTransform const kTransformA = ComplexTransform::kNone;
static ComplexTransform const kTransformB = ComplexTransform::kNone;
using LayoutScaleBias = layout::RowMajor;
/// Define the kernel
/// Define the threadblock-scoped matrix multiply-accumulate
static_assert(ArchTag::kMinComputeCapability >= 80,
"Only multistage is implemented");
static_assert(kStages >= 3, "Only multistage is implemented");
using Mma0 =
typename cutlass::gemm::threadblock::DefaultMma<ElementA,
LayoutA,
kAlignmentA,
ElementB,
LayoutB0,
kAlignmentB,
ElementAccumulator,
layout::RowMajor,
arch::OpClassTensorOp,
ArchTag,
ThreadblockShape,
WarpShape,
InstructionShape,
Stages,
Operator>::ThreadblockMma;
using Mma1 =
typename cutlass::gemm::threadblock::DefaultMma<ElementA,
LayoutA,
kAlignmentA,
ElementB,
LayoutB1,
kAlignmentB,
ElementAccumulator,
layout::RowMajor,
arch::OpClassTensorOp,
ArchTag,
ThreadblockShape,
WarpShape,
InstructionShape,
Stages,
Operator>::ThreadblockMma;
using DualMma =
threadblock::DualMmaMultistage<typename Mma0::Shape,
typename Mma0::IteratorA,
typename Mma0::SmemIteratorA,
Mma0::kCacheOpA,
typename Mma0::IteratorB,
typename Mma0::SmemIteratorB,
Mma0::kCacheOpB,
typename Mma1::IteratorB,
typename Mma1::SmemIteratorB,
typename Mma0::ElementC,
typename Mma0::LayoutC,
typename Mma0::Policy,
typename Mma1::Policy,
Mma0::kStages,
SharedMemoryClearOption::kNone>;
static const int kPartitionsK = ThreadblockShape::kK / WarpShape::kK;
/// Define the epilogue
using Epilogue0 =
typename cutlass::epilogue::threadblock::DefaultEpilogueTensorOp<
ThreadblockShape,
typename DualMma::Operator0,
kPartitionsK,
EpilogueOutputOp0,
EpilogueOutputOp0::kCount>::Epilogue;
using Epilogue1 =
typename cutlass::epilogue::threadblock::DefaultEpilogueTensorOp<
ThreadblockShape,
typename DualMma::Operator1,
kPartitionsK,
EpilogueOutputOp1,
EpilogueOutputOp1::kCount>::Epilogue;
using Epilogue2 =
typename cutlass::epilogue::threadblock::DefaultEpilogueTensorOp<
ThreadblockShape,
typename DualMma::Operator1,
kPartitionsK,
EpilogueOutputOp2,
EpilogueOutputOp2::kCount>::Epilogue;
/// Define the kernel-level GEMM operator.
using DualGemmKernel = kernel::DualGemm<DualMma,
Epilogue0,
Epilogue1,
Epilogue2,
EpilogueOutputOp2,
ThreadblockSwizzle,
kSplitKSerial,
kStoreD0,
kStoreD1>;
/// Argument structure
struct Arguments {
//
// Data members
//
DualGemmMode mode;
GemmCoord problem_size;
TensorRef<ElementA const, LayoutA> ref_A0;
TensorRef<ElementB const, LayoutB0> ref_B0;
TensorRef<ElementC const, LayoutC> ref_C0;
TensorRef<ElementC, LayoutC> ref_D0;
TensorRef<ElementB const, LayoutB1> ref_B1;
TensorRef<ElementC const, LayoutC> ref_C1;
TensorRef<ElementC, LayoutC> ref_D1;
TensorRef<ElementD, LayoutC> ref_D2;
typename EpilogueOutputOp0::Params epilogue0;
typename EpilogueOutputOp1::Params epilogue1;
typename EpilogueOutputOp2::Params epilogue2;
int split_k_slices;
int batch_count;
int64_t batch_stride_A;
int64_t batch_stride_B0;
int64_t batch_stride_B1;
int64_t batch_stride_C;
int64_t batch_stride_D;
//
// Methods
//
/// Default ctor
CUTLASS_HOST_DEVICE
Arguments() : problem_size(0, 0, 0), split_k_slices(1) {}
/// Constructs an Arguments structure
CUTLASS_HOST_DEVICE
Arguments(DualGemmMode mode,
GemmCoord problem_size_,
TensorRef<ElementA const, LayoutA> ref_A0_,
TensorRef<ElementB const, LayoutB0> ref_B0_,
TensorRef<ElementC const, LayoutC> ref_C0_,
TensorRef<ElementC, LayoutC> ref_D0_,
TensorRef<ElementB const, LayoutB1> ref_B1_,
TensorRef<ElementC const, LayoutC> ref_C1_,
TensorRef<ElementC, LayoutC> ref_D1_,
TensorRef<ElementD, LayoutC> ref_D2_,
typename EpilogueOutputOp0::Params epilogue0_ =
typename EpilogueOutputOp0::Params(),
typename EpilogueOutputOp1::Params epilogue1_ =
typename EpilogueOutputOp1::Params(),
typename EpilogueOutputOp2::Params epilogue2_ =
typename EpilogueOutputOp2::Params(),
int split_k_slices_ = 1,
int batch_count = 1,
int64_t batch_stride_A = 0,
int64_t batch_stride_B0 = 0,
int64_t batch_stride_B1 = 0,
int64_t batch_stride_C = 0,
int64_t batch_stride_D = 0)
: mode(mode),
problem_size(problem_size_),
ref_A0(ref_A0_),
ref_B0(ref_B0_),
ref_C0(ref_C0_),
ref_D0(ref_D0_),
ref_B1(ref_B1_),
ref_C1(ref_C1_),
ref_D1(ref_D1_),
ref_D2(ref_D2_),
epilogue0(epilogue0_),
epilogue1(epilogue1_),
epilogue2(epilogue2_),
split_k_slices(split_k_slices_),
batch_count(batch_count),
batch_stride_A(batch_stride_A),
batch_stride_B0(batch_stride_B0),
batch_stride_B1(batch_stride_B1),
batch_stride_C(batch_stride_C),
batch_stride_D(batch_stride_D) {}
};
private:
/// Kernel parameters object
typename DualGemmKernel::Params params_;
public:
/// Constructs the GEMM.
DualGemm() = default;
/// Determines whether the GEMM can execute the given problem.
static Status can_implement(Arguments const &args) {
if (args.mode == DualGemmMode::kBatched && kSplitKSerial) {
return Status::kErrorInvalidProblem;
}
if (!kSplitKSerial && args.split_k_slices > 1) {
return Status::kErrorInvalidProblem;
}
if (kStoreD0 != (args.ref_D0.data() != nullptr)) {
return Status::kErrorInternal;
}
if (kStoreD1 != (args.ref_D1.data() != nullptr)) {
return Status::kErrorInternal;
}
Status status = DualGemmKernel::can_implement(args.problem_size,
args.ref_A0.non_const_ref(),
args.ref_B0.non_const_ref(),
args.ref_C0.non_const_ref(),
args.ref_D0,
args.ref_B1.non_const_ref(),
args.ref_C1.non_const_ref(),
args.ref_D1,
args.ref_D2);
if (status != Status::kSuccess) {
return status;
}
return Status::kSuccess;
}
/// Gets the workspace size
static size_t get_workspace_size(Arguments const &args) {
size_t bytes = 0;
if (kSplitKSerial && args.split_k_slices > 1) {
// Determine grid shape
ThreadblockSwizzle threadblock_swizzle;
cutlass::gemm::GemmCoord tiled_shape =
threadblock_swizzle.get_tiled_shape(args.problem_size,
{ThreadblockShape::kM,
ThreadblockShape::kN,
ThreadblockShape::kK},
args.split_k_slices);
bytes += sizeof(int) * size_t(tiled_shape.m()) * size_t(tiled_shape.n());
}
return bytes;
}
/// Initializes GEMM state from arguments.
Status initialize(Arguments const &args,
void *workspace = nullptr,
cudaStream_t stream = nullptr) {
// Determine grid shape
ThreadblockSwizzle threadblock_swizzle;
cutlass::gemm::GemmCoord grid_shape = threadblock_swizzle.get_tiled_shape(
args.problem_size,
{ThreadblockShape::kM, ThreadblockShape::kN, ThreadblockShape::kK},
args.mode == DualGemmMode::kBatched ? args.batch_count
: args.split_k_slices);
if (kSplitKSerial) {
if (args.split_k_slices > 1) {
if (!workspace) {
return Status::kErrorWorkspaceNull;
}
size_t bytes = get_workspace_size(args);
cudaError_t result = cudaMemsetAsync(workspace, 0, bytes, stream);
if (result != cudaSuccess) {
return Status::kErrorInternal;
}
}
} else {
if (args.split_k_slices > 1) {
return Status::kErrorInvalidProblem;
}
}
// Initialize the Params structure
params_ = typename DualGemmKernel::Params{
args.mode,
args.problem_size,
grid_shape,
args.ref_A0.non_const_ref(),
args.ref_B0.non_const_ref(),
args.ref_C0.non_const_ref(),
args.ref_D0,
args.ref_B1.non_const_ref(),
args.ref_C1.non_const_ref(),
args.ref_D1,
args.ref_D2,
args.epilogue0,
args.epilogue1,
args.epilogue2,
reinterpret_cast<int *>(workspace),
args.batch_stride_A,
args.batch_stride_B0,
args.batch_stride_B1,
args.batch_stride_C,
args.batch_stride_D,
};
return Status::kSuccess;
}
/// Lightweight update given a subset of arguments
Status update(Arguments const &args, void *workspace = nullptr) {
if (kSplitKSerial && args.split_k_slices > 1) {
if (!workspace) {
return Status::kErrorWorkspaceNull;
}
}
params_.ref_A0.reset(args.ref_A0.non_const_ref().data());
params_.ref_B0.reset(args.ref_B0.non_const_ref().data());
params_.ref_C0.reset(args.ref_C0.non_const_ref().data());
params_.ref_D0.reset(args.ref_D0.data());
params_.ref_B1.reset(args.ref_B1.non_const_ref().data());
params_.ref_C1.reset(args.ref_C1.non_const_ref().data());
params_.ref_D1.reset(args.ref_D1.data());
params_.ref_D2.reset(args.ref_D2.data());
params_.output_op_0 = args.epilogue0;
params_.output_op_1 = args.epilogue1;
params_.output_op_2 = args.epilogue2;
params_.semaphore = reinterpret_cast<int *>(workspace);
return Status::kSuccess;
}
/// Runs the kernel using initialized state.
Status run(cudaStream_t stream = nullptr) {
ThreadblockSwizzle threadblock_swizzle;
dim3 grid = threadblock_swizzle.get_grid_shape(params_.grid_tiled_shape);
dim3 block(DualGemmKernel::kThreadCount, 1, 1);
cudaError_t result;
int smem_size =
int(sizeof(typename DualGemmKernel::SharedStorage)); // NOLINT
if (smem_size >= (48 << 10)) {
result = cudaFuncSetAttribute(Kernel<DualGemmKernel>,
cudaFuncAttributeMaxDynamicSharedMemorySize,
smem_size);
if (result != cudaSuccess) {
printf(
"cudaFuncSetAttribute(Kernel<DualGemmKernel>, "
"cudaFuncAttributeMaxDynamicSharedMemorySize, %d) returned an "
"error\n",
smem_size);
return Status::kErrorInternal;
}
}
cutlass::Kernel<DualGemmKernel>
<<<grid, block, smem_size, stream>>>(params_);
result = cudaGetLastError();
return result == cudaSuccess ? Status::kSuccess : Status::kErrorInternal;
}
/// Runs the kernel using initialized state.
Status operator()(cudaStream_t stream = nullptr) { return run(stream); }
/// Runs the kernel using initialized state.
Status operator()(Arguments const &args,
void *workspace = nullptr,
cudaStream_t stream = nullptr) {
Status status = initialize(args, workspace, stream);
if (status == Status::kSuccess) {
status = run(stream);
}
return status;
}
};
} // namespace device
} // namespace gemm
} // namespace cutlass

View File

@@ -0,0 +1,43 @@
/***************************************************************************************************
* Copyright (c) 2017 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights
*reserved. SPDX-License-Identifier: BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
*this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
*ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
*LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
*CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
*SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
*INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
*CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
*ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************************/
/*! \file
\brief Defines common types used for all DualGemm operators.
*/
#pragma once
namespace cutlass {
namespace gemm {
enum class DualGemmMode { kGemm, kBatched, kInvalid };
} // namespace gemm
} // namespace cutlass

Some files were not shown because too many files have changed in this diff Show More