-
Notifications
You must be signed in to change notification settings - Fork 72
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
RuntimeError: Unexpected key(s) in state_dict when loading OFAModel #34
Comments
Could you let me know which scripts and checkpoints you are using? |
For the scripts, I used 'pretrain_tiny.sh' located in the scripts/pretrain/ . I only made two modifications to this script:
For the checkpoint, I used 'biomedgpt_tiny.pt' which I downloaded from the Dropbox link provided in the checkpoints.md (https://www.dropbox.com/sh/cu2r5zkj2r0e6zu/AADZ-KHn-emsICawm9CM4MqVa?dl=0). These were the key components I utilized for my setup. Let me know if you need any clarification or have additional questions about the configuration. |
Could you try installing Fairseq from this repository instead of OFA and re-run the code? Additionally, could you please share the entire error log? |
hi i've install fairseq from your repository, but still get the same error as below: 2024-09-23 02:08:07 - train.py[line:154] - INFO: training on 4 devices (GPUs/TPUs) File "/mypath/fairseq/fairseq/distributed/module_proxy_wrapper.py", line 52, in load_state_dict
return super().load_state_dict(new_state_dict, strict) File "/root/miniconda3/envs/biomedgpt/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1668, in load_state_dict File "/root/miniconda3/envs/biomedgpt/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1668, in load_state_dict During handling of the above exception, another exception occurred: Error(s) in loading state_dict for OFAModel: During handling of the above exception, another exception occurred:
self.class.name, "\n\t".join(error_msgs))) File "../../train.py", line 537, in Traceback (most recent call last): Error(s) in loading state_dict for OFAModel: During handling of the above exception, another exception occurred: File "../../train.py", line 537, in File "/mypath/fairseq/fairseq/distributed/utils.py", line 348, in distributed_main File "/mypath/utils/checkpoint_utils.py", line 254, in load_checkpoint ExceptionException: : Cannot load model parameters from checkpoint ../../scripts/biomedgpt_tiny.pt; please ensure that the architectures match.Cannot load model parameters from checkpoint ../../scripts/biomedgpt_tiny.pt; please ensure that the architectures match.
Exception: Cannot load model parameters from checkpoint ../../scripts/biomedgpt_tiny.pt; please ensure that the architectures match.
|
@aaaaaannie Apologies I missed your response earlier. It seems that |
Hi,I am encountering an issue when trying to load a pre-trained OFAModel. The error message I receive is as follows:
![image](https://private-user-images.githubusercontent.com/78579573/366919961-488cc59d-562b-403f-9f4c-7f1f42e05103.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1Mjg4NTIsIm5iZiI6MTczOTUyODU1MiwicGF0aCI6Ii83ODU3OTU3My8zNjY5MTk5NjEtNDg4Y2M1OWQtNTYyYi00MDNmLTlmNGMtN2YxZjQyZTA1MTAzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDEwMjIzMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUzMjI1ZmU1MGJjZDY2MDkxOWM1YTFmYWFmZjgxNGJhZDVkODVjNDhkOTA4MDJiY2MzMDIxNjc4YWIzODUxNmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.RdItCrHO98Surc3X1m4OmrWjucwJ0QhML780ehmwl2o)
Environment Details:
pip version: 21.2.4
Fairseq version: Installed from the OFA repository
Steps to Reproduce:
Installed Fairseq from the OFA repository.
Configured the environment and downloaded the necessary pre-trained datasets.
Attempted to load the OFAModel using the provided scripts.
The text was updated successfully, but these errors were encountered: