code: def test_transformer_pipeline_todisk_settings():
      nlp = English()
      trf = nlp.add_pipe("transformer", config=DEFAULT_CONFIG)
      nlp.initialize()
      # initially no attentions
      assert trf.model.tokenizer.model_max_length == 512
      assert trf.model.transformer.config.output_attentions is False
      assert "attentions" not in nlp("test")._.trf_data.model_output
      # modify model_max_length (note that modifications to
      # tokenizer.model_max_length for transformers<4.25 are not serialized by
      # save_pretrained, see: https://github.com/explosion/spaCy/discussions/7393)
      trf.model.tokenizer.init_kwargs["model_max_length"] = 499
      # transformer>=4.25, model_max_length is saved and init_kwargs changes are
      # clobbered, so do both for this test
      trf.model.tokenizer.model_max_length = 499
      # add attentions on-the-fly
      trf.model.transformer.config.output_attentions = True
      assert nlp("test")._.trf_data.model_output.attentions is not None
      with make_tempdir() as d:
          nlp.to_disk(d)
          nlp2 = spacy.load(d)
          assert nlp2.pipe_names == ["transformer"]
          trf2 = nlp2.get_pipe("transformer")
          # model_max_length is preserved
          assert trf2.model.tokenizer.model_max_length == 499
          # output_attentions setting is preserved
          assert trf2.model.transformer.config.output_attentions is True
          assert (
              nlp2("test")._.trf_data.model_output.attentions
              is not None
          )
          # the init configs are empty SimpleFrozenDicts
          assert trf2.model._init_tokenizer_config == {}
          with pytest.raises(NotImplementedError):
              trf2.model._init_tokenizer_config["use_fast"] = False
  
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 7 for calling a global function with example usage: test_transformer_pipeline_todisk_settings() without return types