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 unittest
  from transformers import AutoModel, AutoModelForCausalLM, AutoModelForSeq2SeqLM, AutoModelForSequenceClassification, AutoTokenizer, pipeline
  from transformers.testing_utils import 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