Created
June 25, 2021 07:41
-
-
Save SimonHFL/0ca08654a9ef87a10500a4141d7fd252 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import AutoModelForSeq2SeqLM | |
import torch | |
tag_1 = "prithivida/grammar_error_correcter" | |
tag_2 = "prithivida/grammar_error_correcter_v1" | |
correction_model_1 = AutoModelForSeq2SeqLM.from_pretrained(tag_1) | |
correction_model_2 = AutoModelForSeq2SeqLM.from_pretrained(tag_2) | |
params_1={} | |
for name, params in correction_model_1.named_parameters(): | |
params_1[name]=params | |
params_2={} | |
for name, params in correction_model_2.named_parameters(): | |
params_2[name]=params | |
param_is_identical = [] | |
for name in params_1.keys(): | |
is_identical = torch.all(params_1[name]==params_2[name]).item() | |
param_is_identical.append(is_identical) | |
print("models are identical? ", all(param_is_identical)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment