code: def test_captures_model_internals(self):
      inputs = {"sentence": "I always write unit tests"}
  
      archive = load_archive(
          self.FIXTURES_ROOT
          / "basic_classifier"
          / "embedding_with_trainable_is_false"
          / "model.tar.gz"
      )
      predictor = Predictor.from_archive(archive)
  
      with predictor.capture_model_internals() as internals:
          predictor.predict_json(inputs)
  
      assert len(internals) == 10
  
      with predictor.capture_model_internals(
          r"_text_field_embedder.*"
      ) as internals:
          predictor.predict_json(inputs)
      assert len(internals) == 2
  
file_path: allennlp/tests/predictors/predictor_test.py
imports: from allennlp.common.testing import AllenNlpTestCase
  from allennlp.models.archival import load_archive
  from allennlp.predictors import Predictor
  from allennlp.nn import util
label_desc: Use image node_id 5 for calling the TestPredictor obj's underlying member method code with example usage: obj.test_captures_model_internals() without return types