Skip to content

Commit

Permalink
fix diffusers tests (#1317)
Browse files Browse the repository at this point in the history
* fix diffusers tests

* quality
  • Loading branch information
pacman100 authored Jan 3, 2024
1 parent cbf346d commit 8665e2b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/peft/utils/save_and_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from huggingface_hub import file_exists, hf_hub_download
from huggingface_hub.utils import EntryNotFoundError
from safetensors.torch import load_file as safe_load_file
from transformers import AutoConfig

from .other import EMBEDDING_LAYER_NAMES, SAFETENSORS_WEIGHTS_NAME, WEIGHTS_NAME, infer_device
from .peft_types import PeftType
Expand Down Expand Up @@ -135,7 +134,7 @@ def get_peft_model_state_dict(
vocab_size = getattr(getattr(model, "config", None), "vocab_size", None)
model_id = getattr(config, "base_model_name_or_path", None)
# check if the vocab size of the base model is different from the vocab size of the finetuned model
if vocab_size and model_id and (vocab_size != AutoConfig.from_pretrained(model_id).vocab_size):
if vocab_size and model_id and (vocab_size != model.config.__class__.from_pretrained(model_id).vocab_size):
warnings.warn(
"Setting `save_embedding_layers` to `True` as the embedding layer has been resized during finetuning."
)
Expand Down

0 comments on commit 8665e2b

Please sign in to comment.