code: def test_spec_affecting_config_options(
      self,
      config: dict[str, bool],
      expect_attention: bool,
      expect_embs: bool,
      expect_grads: bool,
  ):
      model = GlueModelForTesting(
          model_name_or_path="bert-base-uncased", **config
      )
      input_spec = model.input_spec()
      output_spec = model.output_spec()
  
      attention_fields = [
          key for key in output_spec if "/attention" in key
      ]
      avg_emb_fields = [key for key in output_spec if "/avg_emb" in key]
      text_a_embs = "input_embs_" + model.config.text_a_name
      text_b_embs = "input_embs_" + model.config.text_b_name
      text_a_token_grads = "token_grad_" + model.config.text_a_name
      text_b_token_grads = "token_grad_" + model.config.text_b_name
  
      self.assertEqual(model.config.compute_grads, expect_grads)
      self.assertEqual(model.config.output_attention, expect_attention)
      self.assertEqual(model.config.output_embeddings, expect_embs)
  
      # Check required fields in input spec, should only be the text inputs.
      for key, field_spec in input_spec.items():
          if (
              key == model.config.text_a_name
              or key == model.config.text_b_name
          ):
              self.assertTrue(field_spec.required)
          else:
              self.assertFalse(field_spec.required)
  
      # Check required fields in output spec.
      for key, field_spec in output_spec.items():
          self.assertTrue(field_spec.required)
  
      if expect_attention:
          self.assertLen(
              attention_fields, model.model.config.num_hidden_layers
          )
      else:
          self.assertEmpty(attention_fields)
  
      if expect_embs:
          self.assertLen(
              avg_emb_fields, model.model.config.num_hidden_layers + 1
          )
          self.assertIn(text_a_embs, input_spec)
          self.assertIn(text_b_embs, input_spec)
          self.assertIn("cls_emb", output_spec)
          self.assertIn(text_a_embs, output_spec)
          self.assertIn(text_b_embs, output_spec)
      else:
          self.assertEmpty(avg_emb_fields)
          self.assertNotIn(text_a_embs, input_spec)
          self.assertNotIn(text_b_embs, input_spec)
          self.assertNotIn("cls_emb", output_spec)
          self.assertNotIn(text_a_embs, output_spec)
          self.assertNotIn(text_b_embs, output_spec)
  
      if expect_embs and expect_grads:
          self.assertIn(text_a_token_grads, output_spec)
          self.assertIn(text_b_token_grads, output_spec)
      else:
          self.assertNotIn(text_a_token_grads, output_spec)
          self.assertNotIn(text_b_token_grads, output_spec)
  
file_path: lit/lit_nlp/examples/models/glue_models_test.py
imports: from absl.testing import absltest
  from absl.testing import parameterized
  import attr
  from lit_nlp.examples.models import glue_models
  import numpy
label_desc: Use image node_id 1 for calling the GlueModelsTest obj's underlying member method code with example usage: obj.test_spec_affecting_config_options(config, expect_attention, expect_embs, expect_grads) without return types