Skip to content

Instantly share code, notes, and snippets.

@SimonHFL
Created June 25, 2021 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SimonHFL/0ca08654a9ef87a10500a4141d7fd252 to your computer and use it in GitHub Desktop.
Save SimonHFL/0ca08654a9ef87a10500a4141d7fd252 to your computer and use it in GitHub Desktop.
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