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

num_labels not visible in config.json #10

Open
ThomasWinn opened this issue Jan 31, 2022 · 0 comments
Open

num_labels not visible in config.json #10

ThomasWinn opened this issue Jan 31, 2022 · 0 comments

Comments

@ThomasWinn
Copy link

ThomasWinn commented Jan 31, 2022

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.

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