facebookresearch / TaBERT

This repository contains source code for the TaBERT model, a pre-trained language model for learning joint representations of natural language utterances and (semi-)structured tables for semantic parsing. TaBERT is pre-trained on a massive corpus of 26M Web tables and their associated natural language context, and could be used as a drop-in replacement of a semantic parsers original encoder to compute representations for utterances and table schemas (columns).
Other
580 stars 63 forks source link

Loading large tabert_large_k3 giving span_based_prediction.prediction.decoder.bias error #4

Open monk1337 opened 3 years ago

monk1337 commented 3 years ago
RuntimeError                              Traceback (most recent call last)
<ipython-input-5-04c64c2dedcc> in <module>
      1 from table_bert import TableBertModel
      2 
----> 3 model = TableBertModel.from_pretrained('/home/ankit_pal/TaBERT/tabert_large_k3/model.bin')

~/TaBERT/table_bert/table_bert.py in from_pretrained(cls, model_name_or_path, config_file, config, state_dict, **kwargs)
    235                 state_dict[new_key] = state_dict[old_key]
    236 
--> 237         model.load_state_dict(state_dict, strict=True)
    238 
    239         return model

~/TaBERT/table_bert/vanilla_table_bert.py in load_state_dict(self, state_dict, strict)
    314             self._bert_model.load_state_dict(state_dict, strict)
    315         else:
--> 316             super(VanillaTableBert, self).load_state_dict(state_dict, strict)

~/tfenv1/lib/python3.7/site-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict)
    845         if len(error_msgs) > 0:
    846             raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
--> 847                                self.__class__.__name__, "\n\t".join(error_msgs)))
    848         return _IncompatibleKeys(missing_keys, unexpected_keys)
    849 

RuntimeError: Error(s) in loading state_dict for VerticalAttentionTableBert:
    Missing key(s) in state_dict: "span_based_prediction.prediction.decoder.bias".
pcyin commented 3 years ago

Thanks for reporting! Could you share the version of the pytorch-pretrained-bert library?

niviksha commented 3 years ago

Hi - I'm running into the same issue, can you tell me how I'd find the version of the library?

Thanks for reporting! Could you share the version of the pytorch-pretrained-bert library?

zhangxinnan123 commented 3 years ago

Thanks for reporting! Could you share the version of the pytorch-pretrained-bert library?

Hi,I'm running with the same problem and the version of the pytorch-pretrained-bert is 0.6.2

DevHyung commented 3 years ago

Hi - I'm running into the same issue, can you tell me how I'd find the version of the library?

Thanks for reporting! Could you share the version of the pytorch-pretrained-bert library?

input the shell $pip list | grep pytorch and you can find the pytorch-pretrained-bert version

FeiWang96 commented 3 years ago

The version given in env.yaml works well for me.

pip install "--editable=git+https://github.com/huggingface/transformers.git@372a5c1ceec49b52c503707e9657bfaae7c236a0#egg=pytorch_pretrained_bert"