Closed ivanhe123 closed 2 months ago
Hi @ivanhe123, thanks for opening this issue!
From the error, it looks like the keys in the state dict new_model
do not match those in the model SeamlessM4TModel
. You can check the expected keys in the model by doing model_seam.state_dict().keys()
.
Note, it's not necessary for you to download and load in a pretrained checkpoint and then load in new weights. You can initialize a new model with the same architecture and empty weights by just downloading the config:
import torch
from accelerate import init_empty_weights
from transformers import AutoConfig, SeamlessM4TModel
config = AutoConfig.from_pretrained("facebook/hf-seamless-m4t-medium")
with init_empty_weights():
model = SeamlessM4TModel(config)
new_model = torch.load("./expt4_m4tM.pt")
model.load_state_dict(new_model)
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
System Info
Python version 3.11
transformers
version: 4.42.3Who can help?
No response
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Expected behavior
Expected to load the new fintuned model and then save it to a new model file.