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

Failed to run example script for sequence_classification_multilabel: Target size (torch.Size([32])) must be the same as input size (torch.Size([32, 27])) #130

Closed
Chen9154 opened this issue Jul 5, 2022 · 0 comments

Comments

@Chen9154
Copy link
Collaborator

Chen9154 commented Jul 5, 2022

I copy the training command from here and modify a little.

python -m torch.distributed.launch $DISTRIBUTED_ARGS main.py \ --mode train \ --tables=train.csv,dev.csv \ --input_schema=content_seq:str:1,label:str:1 \ --first_sequence=content_seq \ --label_name=label \ --label_enumerate_values=母婴,三农,科学,美文,科技,时尚,房产,美食,艺术,职场,健康,财经,国际,家居,娱乐,文化,教育,游戏,读书,动漫,体育,旅游,汽车,搞笑,健身,宠物,育儿 \ --checkpoint_dir=./multi_label_classification_model \ --learning_rate=3e-5 \ --epoch_num=1 \ --random_seed=42 \ --save_checkpoint_steps=100 \ --sequence_length=128 \ --train_batch_size=32 \ --app_name=text_classify \ --user_defined_parameters=' pretrain_model_name_or_path=hfl/chinese-roberta-wwm-ext multi_label=True '

And here's the error stack.
image

It seems the Target has a wrong size (torch.Size([32])) which should be torch.Size([32, 27]) under the multilabel settings.

Chen9154 added a commit that referenced this issue Jul 19, 2022
Chen9154 added a commit that referenced this issue Jul 19, 2022
Chen9154 added a commit that referenced this issue Sep 29, 2022
chywang added a commit that referenced this issue Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant