code: def test_serialized_model_evaluation(self, mock_stdout):
      precision = 1
      vocab_size = 2
      srl = space_serializer.BoxSpaceSerializer(
          space=gym.spaces.Box(shape=(), low=0.0, high=1.0),
          vocab_size=vocab_size,
          precision=precision,
      )
  
      def inner_model(mode):
          return models.TransformerLM(
              mode=mode,
              vocab_size=vocab_size,
              d_model=2,
              d_ff=4,
              n_layers=1,
              n_heads=1,
          )
  
      serialized_model_fn = functools.partial(
          serialization_utils.SerializedModel,
          inner_model,
          observation_serializer=srl,
          action_serializer=srl,
          significance_decay=0.7,
      )
      eval_callback = functools.partial(
          callbacks.SerializedModelEvaluation, eval_at=5
      )
  
      output_dir = self.create_tempdir().full_path
      trainer_lib.train(
          output_dir=output_dir,
          model=serialized_model_fn,
          inputs=functools.partial(
              random_inputs, seq_len=4, batch_size=64
          ),
          lr_schedule_fn=functools.partial(lr_schedules.constant, 0.01),
          callbacks=[eval_callback],
          steps=10,
      )
      self.assertTrue(_has_metric("pred_error", mock_stdout))
  
imports: import functools
  import io
  from unittest import mock
  from absl.testing import absltest
  from absl.testing import parameterized
  import gym
  import numpy
  from trax import models
  from trax import test_utils
  from trax.data import inputs
  from trax.layers import test_utils
  from trax.rl import serialization_utils
  from trax.rl import space_serializer
  from trax.supervised import callbacks
  from trax.supervised import lr_schedules
  from trax.supervised import trainer_lib
  from trax.supervised import training
label_desc: Use image node_id 2 for calling the CallbacksTest obj's underlying member method code with example usage: obj.test_serialized_model_evaluation(mock_stdout) and returns: models