huggingface / peft

🤗 PEFT: State-of-the-art Parameter-Efficient Fine-Tuning.
https://huggingface.co/docs/peft
Apache License 2.0
15.98k stars 1.56k forks source link

FIX: Change check if past_key_values is empty #2106

Closed BenjaminBossan closed 2 days ago

BenjaminBossan commented 3 days ago

After transformers merged this PR:

https://github.com/huggingface/transformers/pull/33703

The bool of past_key_values (a Cache instance) would change from False to True in one of our checks:

https://github.com/huggingface/peft/blob/ccc350151f95a9ff95da046bae5671da75eab52f/src/peft/peft_model.py#L1779

Use get_seq_length() method instead, which is consistent before and after that commit.

I checked the tests with the new change for both transformers before and after that commit and they passed, so this change should be backwards compatible.

HuggingFaceDocBuilderDev commented 3 days ago

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

BenjaminBossan commented 2 days ago

@zucchini-nlp Could you please review? You can ignore the test that's being skipped, it's unrelated and will be treated in a separate PR.

BenjaminBossan commented 2 days ago

Thanks for the review @zucchini-nlp. I gave you write access to the repo as otherwise, your review was not deemed sufficient by GitHub to allow me to merge :D