From b53b427e33c66ff9e21be740d254137c92033ffb Mon Sep 17 00:00:00 2001 From: guangyunms Date: Tue, 6 Aug 2024 21:25:14 +0800 Subject: [PATCH 1/3] Fix the issue of P-tuning official sample error --- legacy/examples/few_shot/p-tuning/data.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/legacy/examples/few_shot/p-tuning/data.py b/legacy/examples/few_shot/p-tuning/data.py index 6f96ac02cdc8..15dd653a29a9 100644 --- a/legacy/examples/few_shot/p-tuning/data.py +++ b/legacy/examples/few_shot/p-tuning/data.py @@ -139,7 +139,8 @@ def convert_ids_to_words(example, token_ids): the length of which should coincide with that of `mask` in prompt. """ if "label_ids" in example: - labels = paddle.index_select(token_ids, paddle.to_tensor(example.pop("label_ids")), axis=0).squeeze(0) + label_ids_tensor = paddle.to_tensor([example.pop("label_ids")], dtype='int64') + labels = paddle.index_select(token_ids, label_ids_tensor, axis=0).squeeze(0) example["labels"] = labels return example From 4b3854a5338e0bb82ec46c8b4c77cd048797417f Mon Sep 17 00:00:00 2001 From: S M <152000127+guangyunms@users.noreply.github.com> Date: Tue, 6 Aug 2024 23:32:03 +0800 Subject: [PATCH 2/3] Create codecov workflow.yml --- .github/workflows/workflow.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/workflow.yml diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 000000000000..4d5952e2417a --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,10 @@ +steps: +- uses: actions/checkout@main +- uses: codecov/codecov-action@v4.5.0 + with: + fail_ci_if_error: true # optional (default = false) + files: ./coverage1.xml,./coverage2.xml # optional + flags: unittests # optional + name: paddlenlp-guangyun # optional + token: 9216cd63-5964-4528-81ad-ff5cc7f7180a # required + verbose: true # optional (default = false) From 35ce21e762caf8393bf855e7f0a56a1c090df048 Mon Sep 17 00:00:00 2001 From: S M <152000127+guangyunms@users.noreply.github.com> Date: Wed, 7 Aug 2024 11:35:26 +0800 Subject: [PATCH 3/3] Delete .github/workflows/workflow.yml --- .github/workflows/workflow.yml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .github/workflows/workflow.yml diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml deleted file mode 100644 index 4d5952e2417a..000000000000 --- a/.github/workflows/workflow.yml +++ /dev/null @@ -1,10 +0,0 @@ -steps: -- uses: actions/checkout@main -- uses: codecov/codecov-action@v4.5.0 - with: - fail_ci_if_error: true # optional (default = false) - files: ./coverage1.xml,./coverage2.xml # optional - flags: unittests # optional - name: paddlenlp-guangyun # optional - token: 9216cd63-5964-4528-81ad-ff5cc7f7180a # required - verbose: true # optional (default = false)