[PEFT] Protect adapter_kwargs check (#26537)

Update modeling_utils.py
This commit is contained in:
Younes Belkada 2023-10-02 14:59:24 +02:00 committed by GitHub
parent 63864e057f
commit 1b8decb04c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2480,7 +2480,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
)
token = use_auth_token
if token is not None and "token" not in adapter_kwargs:
if token is not None and adapter_kwargs is not None and "token" not in adapter_kwargs:
adapter_kwargs["token"] = token
if use_safetensors is None and not is_safetensors_available():