We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6235fcd commit 678843eCopy full SHA for 678843e
legacy/examples/few_shot/p-tuning/data.py
@@ -139,7 +139,8 @@ def convert_ids_to_words(example, token_ids):
139
the length of which should coincide with that of `mask` in prompt.
140
"""
141
if "label_ids" in example:
142
- 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')
143
+ labels = paddle.index_select(token_ids, label_ids_tensor, axis=0).squeeze(0)
144
example["labels"] = labels
145
return example
146
0 commit comments