code: def test_weight_sharing_output_match(self):
      with torch.no_grad():
          for model_id in {"albert-base-v1", "albert-base-v2"}:
              tokenizer = AutoTokenizer.from_pretrained(model_id)
              model = AutoModel.from_pretrained(model_id)
  
              task = "feature-extraction"
              with TemporaryDirectory() as tmpdir:
                  subprocess.run(
                      f"python3 -m optimum.exporters.onnx --model {model_id} --task {task} {tmpdir}",
                      shell=True,
                      check=True,
                  )
  
                  original_albert_ir = onnx_load(
                      os.path.join(tmpdir, "model.onnx")
                  )
                  compressed_albert_ir = remove_duplicate_weights(
                      original_albert_ir, inplace=False
                  )
                  compressed_albert_session = InferenceSession(
                      compressed_albert_ir.SerializeToString(),
                      providers=["CPUExecutionProvider"],
                  )
  
              original_outputs = model(
                  **tokenizer(
                      "Hello from Hugging Face", return_tensors="pt"
                  )
              )
              compressed_outputs = compressed_albert_session.run(
                  None,
                  dict(
                      tokenizer(
                          "Hello from Hugging Face", return_tensors="np"
                      )
                  ),
              )
  
          self.assertTrue(
              np.allclose(
                  original_outputs.last_hidden_state.cpu().numpy(),
                  compressed_outputs[0],
                  atol=1e-4,
              )
          )
  
imports: import os
  import subprocess
  import unittest
  from pathlib import Path
  from tempfile import TemporaryDirectory
  from unittest import TestCase
  import huggingface_hub
  import numpy
  import onnx
  import torch
  from onnx import load
  from onnxruntime import InferenceSession
  from parameterized import parameterized
  from transformers import AutoModel, AutoTokenizer
  from optimum.exporters.onnx import main_export
  from optimum.onnx.graph_transformations import cast_slice_nodes_inputs_to_int32, merge_decoders, remove_duplicate_weights
label_desc: Use image node_id 1 for calling the WeightSharingTestCase obj's underlying member method code with example usage: obj.test_weight_sharing_output_match() without return types