docstr: This test checks if an adapter is loaded from the Hub correctly by evaluating it on some MRPC samples
  and comparing with the expected result.
docstr_tok: ["This","test","checks","if","an","adapter","is","loaded","from","the","Hub","correctly","by","evaluating","it","on","some","MRPC","samples","and","comparing","with","the","expected","result","."]
code: def test_load_task_adapter_from_hub(self):
      """This test checks if an adapter is loaded from the Hub correctly by evaluating it on some MRPC samples
      and comparing with the expected result.
      """
      for config in ["pfeiffer", "houlsby"]:
          with self.subTest(config=config):
              tokenizer = AutoTokenizer.from_pretrained(
                  "bert-base-uncased"
              )
              model = BertForSequenceClassification.from_pretrained(
                  "bert-base-uncased"
              )
              adapters.init(model)
  
              loading_info = {}
              adapter_name = model.load_adapter(
                  "sts/mrpc@ukp",
                  config=config,
                  version="1",
                  loading_info=loading_info,
              )
              model.train_adapter(adapter_name)
  
              self.assertEqual(0, len(loading_info["missing_keys"]))
              self.assertEqual(0, len(loading_info["unexpected_keys"]))
  
              self.assertIn(
                  adapter_name, model.adapters_config.adapters
              )
              self.assertNotIn(
                  adapter_name, model.base_model.invertible_adapters
              )
  
              # check if config is valid
              expected_hash = get_adapter_config_hash(
                  AdapterConfig.load(config)
              )
              real_hash = get_adapter_config_hash(
                  model.adapters_config.get(adapter_name)
              )
              self.assertEqual(expected_hash, real_hash)
  
              # setup dataset
              data_args = GlueDataTrainingArguments(
                  task_name="mrpc",
                  data_dir="./hf_transformers/tests/fixtures/tests_samples/MRPC",
                  overwrite_cache=True,
              )
              eval_dataset = GlueDataset(
                  data_args, tokenizer=tokenizer, mode="dev"
              )
              training_args = TrainingArguments(
                  output_dir="./examples", no_cuda=True
              )
  
              # evaluate
              trainer = Trainer(
                  model=model,
                  args=training_args,
                  eval_dataset=eval_dataset,
                  compute_metrics=self._compute_glue_metrics("mrpc"),
                  adapter_names=["mrpc"],
              )
              result = trainer.evaluate()
              self.assertGreater(result["eval_acc"], 0.9)
  
file_path: adapters/tests/test_adapter_hub.py
imports: import os
  import unittest
  import numpy
  import adapters
  from adapters import ADAPTER_CONFIG_MAP, AdapterConfig, BertAdapterModel, get_adapter_config_hash
  from adapters.trainer import AdapterTrainer
  from adapters.utils import find_in_index
  from transformers import AutoModel, AutoTokenizer, BertForSequenceClassification, GlueDataset, GlueDataTrainingArguments, TrainingArguments, glue_compute_metrics
  from transformers.testing_utils import require_torch, torch_device
  from .test_adapter import ids_tensor
label_desc: Use image node_id 2 for calling the AdapterHubTest obj's underlying member method code with example usage: obj.test_load_task_adapter_from_hub() without return types