Skip to content

Commit

Permalink
Fix the issue of P-tuning official sample error (#8884)
Browse files Browse the repository at this point in the history
* Fix the issue of P-tuning official sample error

* Create codecov workflow.yml

* Delete .github/workflows/workflow.yml
  • Loading branch information
guangyunms committed Aug 7, 2024
1 parent 6235fcd commit 678843e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion legacy/examples/few_shot/p-tuning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 678843e

Please sign in to comment.