docstr: A simple test to check if the last modules for some classes (AutoModelForCausalLM or SequenceClassification)
  are kept in their native class.
docstr_tok: ["A","simple","test","to","check","if","the","last","modules","for","some","classes","(","AutoModelForCausalLM","or","SequenceClassification",")","are","kept","in","their","native","class","."]
code: def test_correct_head_class(self):
      r"""
      A simple test to check if the last modules for some classes (AutoModelForCausalLM or SequenceClassification)
      are kept in their native class.
      """
      from bitsandbytes.nn import Int8Params
  
      # last param of a base model should be a linear8bit module
      self.assertTrue(
          self.base_model.h[-1].mlp.dense_4h_to_h.weight.__class__
          == Int8Params
      )
  
      # Other heads should be nn.Parameter
      self.assertTrue(
          self.model_8bit.lm_head.weight.__class__ == torch.nn.Parameter
      )
      self.assertTrue(
          self.sequence_model.score.weight.__class__
          == torch.nn.Parameter
      )
      self.assertTrue(
          self.seq_to_seq_model.lm_head.weight.__class__
          == torch.nn.Parameter
      )
  
imports: import gc
  import importlib.metadata
  import tempfile
  import unittest
  from packaging import version
  from transformers import AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForSeq2SeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, pipeline
  from transformers.testing_utils import is_accelerate_available, is_torch_available, require_accelerate, require_bitsandbytes, require_torch, require_torch_gpu, require_torch_multi_gpu, slow
label_desc: Use image node_id 3 for calling the MixedInt8ModelClassesTest obj's underlying member method code with example usage: obj.test_correct_head_class() without return types