code: def test_serialize_transformer_data():
      data = {"x": TransformerData.empty()}
      bytes_data = srsly.msgpack_dumps(data)
      new_data = srsly.msgpack_loads(bytes_data)
      assert isinstance(new_data["x"], TransformerData)
  
      nlp = Language()
      nlp.add_pipe(
          "transformer",
          config={
              "model": {
                  "name": "hf-internal-testing/tiny-random-DistilBertModel",
                  "transformer_config": {"output_attentions": True},
              }
          },
      )
      nlp.initialize()
      doc = nlp("This is a test.")
      b = doc.to_bytes()
      reloaded_doc = Doc(nlp.vocab)
      reloaded_doc.from_bytes(b)
      assert_docs_equal(doc, reloaded_doc)
      ops = get_current_ops()
      for key in doc._.trf_data.model_output:
          assert_array_equal(
              ops.to_numpy(
                  ops.asarray(doc._.trf_data.model_output[key])
              ),
              ops.to_numpy(
                  ops.asarray(reloaded_doc._.trf_data.model_output[key])
              ),
          )
  
imports: import pytest
  import copy
  import spacy
  from spacy import Language
  from spacy.lang.en import English
  from spacy.tests.util import assert_docs_equal
  from spacy.tokens import Doc
  from spacy.util import make_tempdir
  from spacy import util
  import srsly
  from thinc.api import Config, get_current_ops
  from numpy.testing import assert_array_equal
  from ..None import TransformerData
label_desc: Use image node_id 1 for calling a global function with example usage: test_serialize_transformer_data() without return types