|
from transformers import AutoModel, AutoTokenizer |
|
|
|
|
|
original_model_name = "openchat/openchat_3.5" |
|
original_model = AutoModel.from_pretrained(original_model_name) |
|
original_tokenizer = AutoTokenizer.from_pretrained(original_model_name) |
|
|
|
|
|
new_model_name = "ddddd1367/signalha" |
|
new_model = AutoModel.from_pretrained(new_model_name) |
|
new_tokenizer = AutoTokenizer.from_pretrained(new_model_name) |
|
|
|
|
|
new_model_state_dict = new_model.state_dict() |
|
for name, param in original_model.state_dict().items(): |
|
if name in new_model_state_dict: |
|
new_model_state_dict[name].copy_(param) |
|
|
|
|
|
new_model.save_pretrained(new_model_name) |
|
new_tokenizer.save_pretrained(new_model_name) |
|
|
|
|