code: def get_transformer_pipeline(
      property_name: str,
      model_name: str,
      device: Optional[str] = None,
      models_storage: Union[pathlib.Path, str, None] = None,
      use_onnx_model: bool = False,
      use_cache=False,
  ):
      """Return a transformers' pipeline for the given model name."""
      if use_onnx_model and "onnx" not in model_name.lower():
          raise ValueError(
              "use_onnx_model=True, but model_name is not for a 'onnx' model"
          )
  
      if use_cache:
          model, tokenizer = _get_transformer_model_and_tokenizer(
              property_name, model_name, models_storage, use_onnx_model
          )
      else:
          # __wrapped__ is simply the function without decoration, in our case - without caching
          (
              model,
              tokenizer,
          ) = _get_transformer_model_and_tokenizer.__wrapped__(
              property_name, model_name, models_storage, use_onnx_model
          )
  
      if use_onnx_model:
          onnx_pipe = import_optional_property_dependency(
              "optimum.pipelines", property_name=property_name
          )
          return onnx_pipe.pipeline(
              "text-classification",
              model=model,
              tokenizer=tokenizer,
              accelerator="ort",
              device=device,
          )
      else:
          transformers = import_optional_property_dependency(
              "transformers", property_name=property_name
          )
          return transformers.pipeline(
              "text-classification",
              model=model,
              tokenizer=tokenizer,
              device=device,
          )
  
file_path: deepchecks/deepchecks/nlp/utils/text_properties_models.py
imports: import logging
  import pathlib
  import warnings
  from contextlib import contextmanager
  from functools import lru_cache
  from importlib import import_module
  from typing import Optional, Union
  import requests
  from nltk import corpus
  from transformers.utils import logging
label_desc: Use image node_id 3 for calling a global function with example usage: get_transformer_pipeline(property_name, model_name, device, models_storage, use_onnx_model, use_cache) and returns: onnx_pipe, transformers