code: def test_method_get_teacher_forced_logits_for_decoder_model():
      """Tests if get_teacher_forced_logits() works for decoder only models."""
  
      transformers = pytest.importorskip("transformers")
  
      name = "hf-internal-testing/tiny-random-gpt2"
      tokenizer = transformers.AutoTokenizer.from_pretrained(name)
      model = transformers.AutoModelForCausalLM.from_pretrained(name)
      model.config.is_decoder = True
  
      wrapped_model = shap.models.TeacherForcing(
          model, tokenizer, device="cpu"
      )
  
      source_sentence = np.array(
          ["This is a test statement for verifying"]
      )
      target_sentence = np.array(
          ["working of teacher forcing logits functionality"]
      )
  
      # call the get teacher forced logits function
      logits = wrapped_model.get_teacher_forced_logits(
          source_sentence, target_sentence
      )
  
      assert not np.isnan(np.sum(logits))
  
imports: import numpy
  import pytest
  import shap
label_desc: Use image node_id 2 for calling a global function with example usage: test_method_get_teacher_forced_logits_for_decoder_model() without return types