UER-py icon indicating copy to clipboard operation
UER-py copied to clipboard

Error encountered while using prompt-based classification

Open zhezhaoa opened this issue 2 years ago • 0 comments

The command:

python3 finetune/run_classifier_prompt.py --pretrained_model_path models/google_zh_model.bin \
                                          --vocab_path models/google_zh_vocab.txt \
                                          --config_path models/bert/base_config.json \
                                          --train_path datasets/douban_book_review/train.tsv \
                                          --dev_path datasets/douban_book_review/dev.tsv \
                                          --test_path datasets/douban_book_review/test.tsv \
                                          --prompt_path models/prompts.json --prompt_id chnsenticorp_char \
                                          --learning_rate 3e-5 --epochs_num 3 --batch_size 64

Error report:

  File "finetune/run_classifier_prompt.py", line 45, in forward
    logits = logits * self.answer_position
RuntimeError: expected device cuda:0 and dtype Float but got device cuda:0 and dtype Long

zhezhaoa avatar Mar 06 '22 07:03 zhezhaoa