Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: FSL的P-Tuning官方示例报错 #8883

Closed
1 task done
guangyunms opened this issue Aug 6, 2024 · 1 comment
Closed
1 task done

[Bug]: FSL的P-Tuning官方示例报错 #8883

guangyunms opened this issue Aug 6, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@guangyunms
Copy link
Contributor

软件环境

- paddlepaddle:2.6.1 and 3.0.0Beta
- paddlepaddle-gpu: 2.6.1 and 3.0.0Beta
- paddlenlp: 3.0Beta

重复问题

  • I have searched the existing issues

错误描述

在P-Tuning官方的例子中给出了使用方法。然而运行报错。文档链接:https://github.com/PaddlePaddle/PaddleNLP/tree/develop/legacy/examples/few_shot/p-tuning

Traceback (most recent call last):
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddle/io/dataloader/dataloader_iter.py", line 235, in _thread_loop
    batch = self._dataset_fetcher.fetch(
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddle/io/dataloader/fetcher.py", line 77, in fetch
    data.append(self.dataset[idx])
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddlenlp/datasets/dataset.py", line 263, in __getitem__
    return self._transform(self.new_data[idx]) if self._transform_pipline else self.new_data[idx]
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddlenlp/datasets/dataset.py", line 255, in _transform
    data = fn(data)
  File "/home/aistudio/PaddleNLP-release-3.0-beta/legacy/examples/few_shot/p-tuning/data.py", line 144, in convert_ids_to_words
    labels = paddle.index_select(token_ids, paddle.to_tensor(example.pop("label_ids")), axis=0).squeeze(0)
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddle/tensor/search.py", line 362, in index_select
    return _C_ops.index_select(x, index, axis)
ValueError: (InvalidArgument) The 'shape' of Input(Index) must be 1-D tensor. But received: the 'shape' of Input(Index) is [], the dimension of Input(Index) is [0].
  [Hint: Expected index_dim.size() == 1 || (index_dim.size() == 2 && index_dim[1] == 1) == true, but received index_dim.size() == 1 || (index_dim.size() == 2 && index_dim[1] == 1):0 != true:1.] (at /paddle/paddle/phi/infermeta/binary.cc:1844)

稳定复现步骤 & 代码

运行命令:

python -u -m paddle.distributed.launch --gpus "0" run_train.py \ --output_dir checkpoint_eprstmt \ --task_name eprstmt \ --split_id few_all \ --prompt_path prompt/eprstmt.json \ --prompt_index 0 \ --do_train \ --do_eval \ --do_test \ --do_predict \ --do_label \ --max_steps 1000 \ --learning_rate 3e-5 \ --eval_steps 100 \ --save_steps 100 \ --logging_steps 5 \ --per_device_train_batch_size 16 \ --max_seq_length 128 \ --load_best_model_at_end \ --metric_for_best_model accuracy \ --save_total_limit 1 \ --model_name_or_path "ernie-3.0-base-zh"

官方文档链接:https://github.com/PaddlePaddle/PaddleNLP/tree/develop/legacy/examples/few_shot/p-tuning

@wawltor
Copy link
Collaborator

wawltor commented Aug 8, 2024

The fixed PR: #8884

@wawltor wawltor closed this as completed Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants