Self_Explaining_Structures_Improve_NLP_Models icon indicating copy to clipboard operation
Self_Explaining_Structures_Improve_NLP_Models copied to clipboard

num_labels not visible in config.json

Open ThomasWinn opened this issue 2 years ago • 0 comments

roberta-base currently has been updated since. Do I just add "num_labels": 5 into the json still?

Also currently running into error involving unable to load weights from pytorch checkpoint when attempting to run your code for training.

Could anyone help? Thanks.

Traceback (most recent call last): File "/Users/t/opt/anaconda3/envs/NLP/lib/python3.7/site-packages/transformers/modeling_utils.py", line 951, in from_pretrained state_dict = torch.load(resolved_archive_file, map_location="cpu") File "/Users/t/opt/anaconda3/envs/NLP/lib/python3.7/site-packages/torch/serialization.py", line 585, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "/Users/t/opt/anaconda3/envs/NLP/lib/python3.7/site-packages/torch/serialization.py", line 755, in _legacy_load magic_number = pickle_module.load(f, **pickle_load_args) _pickle.UnpicklingError: invalid load key, 'v'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "trainer.py", line 269, in main() File "trainer.py", line 258, in main train(args) File "trainer.py", line 218, in train model = ExplainNLP(args) File "trainer.py", line 48, in init self.model = ExplainableModel(self.bert_dir) File "/Users/t/Desktop/CSCI Projects/CSCI8980/Self_Explaining_Structures_Improve_NLP_Models/explain/model.py", line 22, in init self.intermediate = RobertaModel.from_pretrained(bert_dir) File "/Users/t/opt/anaconda3/envs/NLP/lib/python3.7/site-packages/transformers/modeling_utils.py", line 954, in from_pretrained "Unable to load weights from pytorch checkpoint file. " OSError: Unable to load weights from pytorch checkpoint file. If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.

ThomasWinn avatar Jan 31 '22 06:01 ThomasWinn