def METHOD_NAME(self):
    retriever = self.get_dummy_retriever()
    retriever.save_pretrained(os.path.join(self.tmpdirname, "realm_block_records"))
    # Test local path
    retriever = retriever.from_pretrained(os.path.join(self.tmpdirname, "realm_block_records"))
    self.assertEqual(retriever.block_records[0], b"This is the first record")
    # Test mocked remote path
    with patch("transformers.models.realm.retrieval_realm.hf_hub_download") as mock_hf_hub_download:
        mock_hf_hub_download.return_value = os.path.join(
            os.path.join(self.tmpdirname, "realm_block_records"), _REALM_BLOCK_RECORDS_FILENAME
        )
        retriever = RealmRetriever.from_pretrained("google/realm-cc-news-pretrained-openqa")
    self.assertEqual(retriever.block_records[0], b"This is the first record")