class_docstr: A testing suite that makes sure that the PeftModel class is correctly integrated into the transformers library.
class_docstr_tok: ["A","testing","suite","that","makes","sure","that","the","PeftModel","class","is","correctly","integrated","into","the","transformers","library","."]
docstr: Tests different combinations of PEFT model + from_pretrained + hub kwargs
docstr_tok: ["Tests","different","combinations","of","PEFT","model","+","from_pretrained","+","hub","kwargs"]
code: def test_peft_from_pretrained_hub_kwargs(self):
      """
      Tests different combinations of PEFT model + from_pretrained + hub kwargs
      """
      peft_model_id = "peft-internal-testing/tiny-opt-lora-revision"
  
      # This should not work
      with self.assertRaises(OSError):
          _ = AutoModelForCausalLM.from_pretrained(peft_model_id)
  
      adapter_kwargs = {"revision": "test"}
  
      # This should work
      model = AutoModelForCausalLM.from_pretrained(
          peft_model_id, adapter_kwargs=adapter_kwargs
      )
      self.assertTrue(self._check_lora_correctly_converted(model))
  
      model = OPTForCausalLM.from_pretrained(
          peft_model_id, adapter_kwargs=adapter_kwargs
      )
      self.assertTrue(self._check_lora_correctly_converted(model))
  
      adapter_kwargs = {
          "revision": "main",
          "subfolder": "test_subfolder",
      }
  
      model = AutoModelForCausalLM.from_pretrained(
          peft_model_id, adapter_kwargs=adapter_kwargs
      )
      self.assertTrue(self._check_lora_correctly_converted(model))
  
      model = OPTForCausalLM.from_pretrained(
          peft_model_id, adapter_kwargs=adapter_kwargs
      )
      self.assertTrue(self._check_lora_correctly_converted(model))
  
imports: import os
  import tempfile
  import unittest
  from huggingface_hub import hf_hub_download
  from transformers import AutoModelForCausalLM, OPTForCausalLM
  from transformers.testing_utils import require_peft, require_torch, require_torch_gpu, slow, torch_device
  from transformers.utils import is_torch_available
label_desc: Use image node_id 16 for calling the PeftIntegrationTester obj's underlying member method code with example usage: obj.test_peft_from_pretrained_hub_kwargs() without return types