code: def test_initialize_transformer_components_with_model_loading_strategy_always_local(
      self,
  ):
      transformer_model = TransformerModelArguments(
          "sshleifer/tiny-distilroberta-base",
          model_loading_strategy=ModelLoadingStrategy.ALWAYS_LOCAL,
      )
      num_labels = 3
      cache_dir = "tmp/"
  
      def config_fake_from_pretrained(_self, *_args, **_kwargs):
          return MagicMock(), {}
  
      with patch.object(
          AutoConfig, "from_pretrained"
      ) as config_mock, patch.object(
          AutoTokenizer, "from_pretrained"
      ) as tokenizer_mock, patch.object(
          AutoModelForSequenceClassification, "from_pretrained"
      ) as model_mock:
          config_mock.side_effect = config_fake_from_pretrained
  
          config, tokenizer, model = _initialize_transformer_components(
              transformer_model, num_labels, cache_dir
          )
  
          self.assertIsNotNone(config)
          self.assertIsNotNone(tokenizer)
          self.assertIsNotNone(model)
  
          # this mock can be called multiple times
          for i in range(config_mock.call_count):
              kwargs = config_mock.call_args_list[i].kwargs
              self.assertEqual(
                  transformer_model.config,
                  config_mock.call_args_list[i][0][0],
              )
              self.assertEqual(num_labels, kwargs["num_labels"])
              self.assertEqual(cache_dir, kwargs["cache_dir"])
              self.assertFalse(kwargs["force_download"])
  
          for i in range(tokenizer_mock.call_count):
              kwargs = tokenizer_mock.call_args_list[i].kwargs
              self.assertEqual(
                  transformer_model.tokenizer,
                  tokenizer_mock.call_args_list[i][0][0],
              )
              self.assertEqual(cache_dir, kwargs["cache_dir"])
              self.assertFalse(kwargs["force_download"])
  
          for i in range(model_mock.call_count):
              kwargs = model_mock.call_args_list[i].kwargs
              self.assertEqual(
                  transformer_model.model,
                  model_mock.call_args_list[i][0][0],
              )
              self.assertEqual(cache_dir, kwargs["cache_dir"])
              self.assertEqual(config, kwargs["config"])
              self.assertFalse(kwargs["force_download"])
              self.assertTrue(kwargs["local_files_only"])
  
file_path: small-text/tests/unit/small_text/integrations/transformers/utils/test_classification.py
imports: import unittest
  import pytest
  import numpy
  from unittest.mock import patch, MagicMock
  from small_text.integrations.pytorch.exceptions import PytorchNotFoundError
label_desc: Use image node_id 5 for calling the ClassificationUtilsTest obj's underlying member method code with example usage: obj.test_initialize_transformer_components_with_model_loading_strategy_always_local() and returns: MagicMock,  dict