code: def trf_model(name, output_attentions, output_hidden_states):
      if "gpt2" in name:
          model = TransformerModel(
              name,
              get_doc_spans,
              {"use_fast": True, "pad_token": "<|endoftext|>"},
              {
                  "output_attentions": output_attentions,
                  "output_hidden_states": output_hidden_states,
              },
          )
  
      else:
          # test slow tokenizers with distilbert-base-uncased (parameterizing
          # for all models blows up the memory usage during the test suite)
          if name == "distilbert-base-uncased":
              use_fast = False
          else:
              use_fast = True
          model = TransformerModel(
              name,
              get_doc_spans,
              {"use_fast": use_fast},
              {
                  "output_attentions": output_attentions,
                  "output_hidden_states": output_hidden_states,
              },
          )
      model.initialize()
      return model
  
file_path: spacy-transformers/spacy_transformers/tests/test_model_wrapper.py
imports: import pytest
  import spacy
  from thinc.api import Model
  from ..layers import TransformerModel
  from ..data_classes import FullTransformerBatch
  from ..span_getters import get_doc_spans
label_desc: Use image node_id 6 for calling a global function with example usage: trf_model(name, output_attentions, output_hidden_states) and returns: model