code: def test_load_with_safetensors() -> None:
      with tempfile.TemporaryDirectory() as cache_folder:
          safetensors_model = SentenceTransformer(
              "sentence-transformers-testing/stsb-bert-tiny-safetensors",
              cache_folder=cache_folder,
          )
  
          # Only the safetensors file must be loaded
          pytorch_files = list(
              Path(cache_folder).glob("**/pytorch_model.bin")
          )
          assert 0 == len(
              pytorch_files
          ), "PyTorch model file must not be downloaded."
          safetensors_files = list(
              Path(cache_folder).glob("**/model.safetensors")
          )
          assert 1 == len(
              safetensors_files
          ), "Safetensors model file must be downloaded."
  
      with tempfile.TemporaryDirectory() as cache_folder:
          transformer = Transformer(
              "sentence-transformers-testing/stsb-bert-tiny-safetensors",
              cache_dir=cache_folder,
              model_args={"use_safetensors": False},
          )
          pooling = Pooling(transformer.get_word_embedding_dimension())
          pytorch_model = SentenceTransformer(
              modules=[transformer, pooling]
          )
  
          # Only the pytorch file must be loaded
          pytorch_files = list(
              Path(cache_folder).glob("**/pytorch_model.bin")
          )
          assert 1 == len(
              pytorch_files
          ), "PyTorch model file must be downloaded."
          safetensors_files = list(
              Path(cache_folder).glob("**/model.safetensors")
          )
          assert 0 == len(
              safetensors_files
          ), "Safetensors model file must not be downloaded."
  
      sentences = [
          "This is a test sentence",
          "This is another test sentence",
      ]
      assert torch.equal(
          safetensors_model.encode(sentences, convert_to_tensor=True),
          pytorch_model.encode(sentences, convert_to_tensor=True),
      ), "Ensure that Safetensors and PyTorch loaded models result in identical embeddings"
  
file_path: sentence-transformers/tests/test_sentence_transformer.py
imports: import logging
  from pathlib import Path
  import tempfile
  import pytest
  from huggingface_hub import HfApi, RepoUrl, GitRefs, GitRefInfo
  import torch
  from sentence_transformers import SentenceTransformer
  from sentence_transformers.models import Transformer, Pooling
label_desc: Use image node_id 1 for calling a global function with example usage: test_load_with_safetensors() without return types