docstr: Returns a `Adapter` given `method` of `AdapterSpec`.
docstr_tok: ["Returns","a","`","Adapter","`","given","`","method","`","of","`","AdapterSpec","`","."]
code: def get_adapter(
      adapter_spec: AdapterSpec, tokenizer_service: TokenizerService
  ) -> Adapter:
      """
      Returns a `Adapter` given `method` of `AdapterSpec`.
      """
      method: str = adapter_spec.method
      adapter: Adapter
  
      if method == ADAPT_GENERATION:
          adapter = GenerationAdapter(adapter_spec, tokenizer_service)
      elif method == ADAPT_LANGUAGE_MODELING:
          adapter = LanguageModelingAdapter(
              adapter_spec, tokenizer_service
          )
      elif method == ADAPT_MULTIPLE_CHOICE_JOINT:
          adapter = MultipleChoiceJointAdapter(
              adapter_spec, tokenizer_service
          )
      elif method == ADAPT_MULTIPLE_CHOICE_SEPARATE_ORIGINAL:
          adapter = MultipleChoiceSeparateAdapter(
              adapter_spec, tokenizer_service
          )
      elif method == ADAPT_MULTIPLE_CHOICE_SEPARATE_CALIBRATED:
          adapter = MultipleChoiceCalibratedAdapter(
              adapter_spec, tokenizer_service
          )
      elif method == ADAPT_RANKING_BINARY:
          adapter = BinaryRankingAdapter(
              adapter_spec, tokenizer_service
          )
      else:
          raise ValueError(f"Invalid adaptation method: {method}")
  
      return adapter
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/adaptation/adapters/adapter_factory.py
imports: from typing import List
  from helm.benchmark.adaptation.adapter_spec import AdapterSpec
  from helm.benchmark.window_services.tokenizer_service import TokenizerService
  from .adapter import Adapter
  from .generation_adapter import GenerationAdapter
  from .language_modeling_adapter import LanguageModelingAdapter
  from .multiple_choice_joint_adapter import MultipleChoiceJointAdapter
  from .multiple_choice_separate_adapter import MultipleChoiceSeparateAdapter
  from .multiple_choice_calibrated_adapter import MultipleChoiceCalibratedAdapter
  from .binary_ranking_adapter import BinaryRankingAdapter
label_desc: Use image node_id 1 for calling the AdapterFactory obj's underlying member method code with example usage: obj.get_adapter(adapter_spec, tokenizer_service) and returns: adapter