ys7yoo / claf

CLaF: Open-Source Clova Language Framework
https://naver.github.io/claf/
MIT License
0 stars 0 forks source link

RuntimeError: The expanded size of the tensor (11) must match the existing size (512) at non-singleton dimension 2. Target sizes: [12, 512, 11]. Tensor sizes: [1, 512] #6

Open ys7yoo opened 3 years ago

ys7yoo commented 3 years ago
python train.py --base_config korquad/bert_base_multilingual_cased
2021-04-24 16:24:30,783 (modeling_utils.py:650): [INFO] - loading weights file https://cdn.huggingface.co/bert-base-multilingual-cased-pytorch_model.bin from cache at /home/yyoo/.claf_cache/3d1d2b2daef1e2b3ddc2180ddaae8b7a37d5f279babce0068361f71cd548f615.7131dcb754361639a7d5526985f880879c9bfd144b65a0bf50590bddb7de9059
2021-04-24 16:24:35,332 (modeling_utils.py:741): [INFO] - Weights of BertForQuestionAnswering not initialized from pretrained model: ['qa_outputs.weight', 'qa_outputs.bias']
2021-04-24 16:24:35,332 (modeling_utils.py:747): [INFO] - Weights from pretrained model not used in BertForQuestionAnswering: ['cls.predictions.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.decoder.weight', 'cls.seq_relationship.weight', 'cls.seq_relationship.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.transform.LayerNorm.bias']
2021-04-24 16:24:37,981 (experiment.py:327): [INFO] - use_gpu: True num_gpu: 1, distributed training: False, 16-bits training: False
2021-04-24 16:24:38,017 (trainer.py:356): [INFO] - # Train Mode.
Traceback (most recent call last):
  File "train.py", line 10, in <module>
    experiment()
  File "/home/yyoo/src/claf/claf/learn/experiment.py", line 142, in __call__
    self.trainer.train_and_evaluate(train_loader, valid_loader, optimizer)
  File "/home/yyoo/src/claf/claf/learn/trainer.py", line 137, in train_and_evaluate
    eval_and_save_step_count=self.eval_and_save_step_count,
  File "/home/yyoo/src/claf/claf/learn/trainer.py", line 376, in _run_epoch
    output_dict = self.model(**inputs)
  File "/home/yyoo/torch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/yyoo/src/claf/claf/model/reading_comprehension/bert.py", line 72, in forward
    bert_inputs, token_type_ids=token_type_ids, attention_mask=attention_mask
  File "/home/yyoo/torch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/yyoo/torch/lib/python3.6/site-packages/transformers/modeling_bert.py", line 1450, in forward
    inputs_embeds=inputs_embeds,
  File "/home/yyoo/torch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/yyoo/torch/lib/python3.6/site-packages/transformers/modeling_bert.py", line 727, in forward
    input_ids=input_ids, position_ids=position_ids, token_type_ids=token_type_ids, inputs_embeds=inputs_embeds
  File "/home/yyoo/torch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/yyoo/torch/lib/python3.6/site-packages/transformers/modeling_bert.py", line 169, in forward
    position_ids = position_ids.unsqueeze(0).expand(input_shape)
RuntimeError: The expanded size of the tensor (11) must match the existing size (512) at non-singleton dimension 2.  Target sizes: [12, 512, 11].  Tensor sizes: [1, 512]