Skip to content

Target sizes over 512 #3

Description

你好,在运行 python train.py --dataset restaurant --prompt_name lora --ft_epoch 100 --model_name bert --withAugment --withCL 时报错

Traceback (most recent call last):
File "/home/userc3da/train.py", line 428, in
main()
File "/home/user/c3da/train.py", line 425, in main
ins.run()
File "/home/user/c3da/train.py", line 287, in run
max_test_acc, max_f1, model_path = self._train(criterion, optimizer, max_test_acc_overall)
File "/home/user/c3da/train.py", line 170, in _train
aug_inputs = self.entropy_filter(aug_sample)
File "/home/user/c3da/train.py", line 143, in entropy_filter
logit = F.softmax(self.model(sen.unsqueeze(dim=0), mode='filter'), dim=1)
File "/home/user/miniconda3/envs/c3da/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/home/user/c3da/models/predictModel.py", line 36, in forward
res = self.backbone(inputs) # del attention_mask and bert_segments_ids
File "/home/user/miniconda3/envs/c3da/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "/home/user/miniconda3/envs/c3da/lib/python3.9/site-packages/transformers/models/bert/modeling_bert.py", line 956, in forward
buffered_token_type_ids_expanded = buffered_token_type_ids.expand(batch_size, seq_length)
RuntimeError: The expanded size of the tensor (692) must match the existing size (512) at non-singleton dimension 1. Target sizes: [1, 692]. Tensor sizes: [1, 512]``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions