docstr: Test whether it is possible to serialize a model in 8-bit.
code: def test_int8_serialization(self):
      r"""
      Test whether it is possible to serialize a model in 8-bit.
      """
      from bitsandbytes.nn import Int8Params
      from transformers import AutoConfig, AutoModelForCausalLM
  
      with tempfile.TemporaryDirectory() as tmpdirname:
          # saving state dict for now but will save config and other in the future
          self.accelerate.save_model(self.model_8bit, tmpdirname)
  
          with init_empty_weights():
              # let's suppose that we can get the right config
              model_8bit_from_saved = AutoModelForCausalLM.from_config(
                  AutoConfig.from_pretrained(self.model_name)
              )
          model_8bit_from_saved.tie_weights()
  
          bnb_quantization_config = BnbQuantizationConfig(
              load_in_8bit=True
          )
  
          model_8bit_from_saved = load_and_quantize_model(
              model_8bit_from_saved,
              bnb_quantization_config,
              weights_location=tmpdirname,
              device_map="auto",
              no_split_module_classes=["BloomBlock"],
          )
  
          self.assertTrue(
              model_8bit_from_saved.transformer.h[
                  0
              ].mlp.dense_4h_to_h.weight.__class__
              == Int8Params
          )
          self.assertTrue(
              hasattr(
                  model_8bit_from_saved.transformer.h[
                      0
                  ].mlp.dense_4h_to_h.weight,
                  "SCB",
              )
          )
          self.assertTrue(
              hasattr(
                  model_8bit_from_saved.transformer.h[
                      0
                  ].mlp.dense_4h_to_h.weight,
                  "CB",
              )
          )
  
          self.check_inference_correctness(model_8bit_from_saved)
  
imports: import gc
  import tempfile
  import unittest
  import torch
  import torch.nn
  from accelerate import Accelerator, init_empty_weights
  from accelerate.test_utils import require_bnb, require_cuda, require_huggingface_suite, require_multi_gpu, slow
  from accelerate.utils.bnb import load_and_quantize_model
  from accelerate.utils.dataclasses import BnbQuantizationConfig
label_desc: Use image node_id 12 for calling the MixedInt8EmptyModelTest obj's underlying member method code with example usage: obj.test_int8_serialization() without return types