fix(deps): update dependency peft to ^0.14.0 #124
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^0.11.1
->^0.14.0
Release Notes
huggingface/peft (peft)
v0.14.0
: Version 0.14.0: EVA, Context-aware Prompt Tuning, Bone, and moreCompare Source
Highlights
New Methods
Context-aware Prompt Tuning
@tsachiblau added a new soft prompt method called Context-aware Prompt Tuning (CPT) which is a combination of In-Context Learning and Prompt Tuning in the sense that, for each training sample, it builds a learnable context from training examples in addition to the single training sample. Allows for sample- and parameter-efficient few-shot classification and addresses recency-bias.
Explained Variance Adaptation
@sirluk contributed a new LoRA initialization method called Explained Variance Adaptation (EVA). Instead of randomly initializing LoRA weights, this method uses SVD on minibatches of finetuning data to initialize the LoRA weights and is also able to re-allocate the ranks of the adapter based on the explained variance ratio (derived from SVD). Thus, this initialization method can yield better initial values and better rank distribution.
Bone
@JL-er added an implementation for Block Affine (Bone) Adaptation which utilizes presumed sparsity in the base layer weights to divide them into multiple sub-spaces that share a single low-rank matrix for updates. Compared to LoRA, Bone has the potential to significantly reduce memory usage and achieve faster computation.
Enhancements
PEFT now supports LoRAs for
int8
torchao quantized models (check this and this notebook) . In addition, VeRA can now be used with 4 and 8 bit bitsandbytes quantization thanks to @ZiadHelal.Hot-swapping of LoRA adapters is now possible using the
hotswap_adapter
function. Now you are able to load one LoRA and replace its weights in-place with the LoRA weights of another adapter which, in general, should be faster than deleting one adapter and loading the other adapter in its place. The feature is built so that no re-compilation of the model is necessary iftorch.compile
was called on the model (right now, this requires ranks and alphas to be the same for the adapters).LoRA and IA³ now support
Conv3d
layers thanks to @jsilter, and @JINO-ROHIT added a notebook showcasing PEFT model evaluation using lm-eval-harness toolkit.With the
target_modules
argument, you can specify which layers to target with the adapter (e.g. LoRA). Now you can also specify which modules not to target by using theexclude_modules
parameter (thanks @JINO-ROHIT).Changes
DynamicCache
caching infrastructure of transformers (see #2096). If you are using this PEFT version and a recent version of transformers with an old prefix tuning checkpoint, you should double check that it still works correctly and retrain it if it doesn't.lora_bias
parameter to LoRA layers to enable bias on LoRA B matrix. This is useful when extracting LoRA weights from fully fine-tuned parameters with bias vectors so that these can be taken into account.from_pretrained
now warns the user if PEFT keys are missing.modules_to_save
is now properly and transparently handled.What's Changed
SFTConfig
instead ofSFTTrainer
keyword args by @qgallouedec in https://github.com/huggingface/peft/pull/2150eval
andno dropout
by @ariG23498 in https://github.com/huggingface/peft/pull/2122rank_pattern
andalpha_pattern
together inLoraConfig
by @sirluk in https://github.com/huggingface/peft/pull/2195meta
device check bug + add multi-gpu functionality by @sirluk in https://github.com/huggingface/peft/pull/2218None
check forloftq_config
attribute inLoraConfig
by @sirluk in https://github.com/huggingface/peft/pull/2215task_type
in PEFT Configurations by @d-kleine in https://github.com/huggingface/peft/pull/2210New Contributors
Full Changelog: huggingface/peft@v0.13.2...v0.14.0
v0.13.2
: : Small patch releaseCompare Source
This patch release contains a small bug fix for an issue that prevented some LoRA checkpoints to be loaded correctly (mostly concerning stable diffusion checkpoints not trained with PEFT when loaded in diffusers, #2144).
Full Changelog: huggingface/peft@v0.13.1...v0.13.2
v0.13.1
: : Small patch releaseCompare Source
This patch release contains a small bug fix for the
low_cpu_mem_usage=True
option (#2113).Full Changelog: huggingface/peft@v0.13.0...v0.13.1
v0.13.0
: : LoRA+, VB-LoRA, and moreCompare Source
Highlights
New methods
LoRA+
@kallewoof added LoRA+ to PEFT (#1915). This is a function that allows to initialize an optimizer with settings that are better suited for training a LoRA adapter.
VB-LoRA
@leo-yangli added a new method to PEFT called VB-LoRA (#2039). The idea is to have LoRA layers be composed from a single vector bank (hence "VB") that is shared among all layers. This makes VB-LoRA extremely parameter efficient and the checkpoints especially small (comparable to the VeRA method), while still promising good fine-tuning performance. Check the VB-LoRA docs and example.
Enhancements
New Hugging Face team member @ariG23498 added the helper function
rescale_adapter_scale
to PEFT (#1951). Use this context manager to temporarily increase or decrease the scaling of the LoRA adapter of a model. It also works for PEFT adapters loaded directly into a transformers or diffusers model.@ariG23498 also added DoRA support for embedding layers (#2006). So if you're using the
use_dora=True
option in theLoraConfig
, you can now also target embedding layers.For some time now, we support inference with batches that are using different adapters for different samples, so e.g. sample 1-5 use "adapter1" and samples 6-10 use "adapter2". However, this only worked for LoRA layers so far. @saeid93 extended this to also work with layers targeted by
modules_to_save
(#1990).When loading a PEFT adapter, you now have the option to pass
low_cpu_mem_usage=True
(#1961). This will initialize the adapter with empty weights ("meta" device) before loading the weights instead of initializing on CPU or GPU. This can speed up loading PEFT adapters. So use this option especially if you have a lot of adapters to load at the same time or if these adapters are very big. Please let us know if you encounter issues with this option, as we may make this the default in the future.Changes
Safe loading of PyTorch weights
Unless indicated otherwise, PEFT adapters are saved and loaded using the secure
safetensors
format. However, we also support the PyTorch format for checkpoints, which relies on the inherently insecure pickle protocol from Python. In the future, PyTorch will be more strict when loading these files to improve security by making the optionweights_only=True
the default. This is generally recommended and should not cause any trouble with PEFT checkpoints, which is why with this release, PEFT will enable this by default. Please open an issue if this causes trouble.What's Changed
merge_and_unload
by @snarayan21 in https://github.com/huggingface/peft/pull/1978helper.rescale_adapter_scale
by @ariG23498 in https://github.com/huggingface/peft/pull/1989test_vera_dtypes
on XPU by @faaany in https://github.com/huggingface/peft/pull/2017TestModelAndLayerStatus
device-agnostic by @faaany in https://github.com/huggingface/peft/pull/2026test_mixed_adapter_batches_lora_opt_timing
on XPU by @faaany in https://github.com/huggingface/peft/pull/2021test_common_gpu.py
to work on XPU by @faaany in https://github.com/huggingface/peft/pull/2031test_gpu_examples.py
on XPU by @faaany in https://github.com/huggingface/peft/pull/2036tie_word_embeddings
by @ltoniazzi in https://github.com/huggingface/peft/pull/2025evaluation_strategy
by @muellerzr in https://github.com/huggingface/peft/pull/1664New Contributors
Full Changelog: huggingface/peft@v0.12.0...v0.13.0
v0.12.0
: : New methods OLoRA, X-LoRA, FourierFT, HRA, and much moreCompare Source
Highlights
New methods
OLoRA
@tokenizer-decode added support for a new LoRA initialization strategy called OLoRA (#1828). With this initialization option, the LoRA weights are initialized to be orthonormal, which promises to improve training convergence. Similar to PiSSA, this can also be applied to models quantized with bitsandbytes. Check out the accompanying OLoRA examples.
X-LoRA
@EricLBuehler added the X-LoRA method to PEFT (#1491). This is a mixture of experts approach that combines the strength of multiple pre-trained LoRA adapters. Documentation has yet to be added but check out the X-LoRA tests for how to use it.
FourierFT
@Phoveran, @zqgao22, @Chaos96, and @DSAILatHKUST added discrete Fourier transform fine-tuning to PEFT (#1838). This method promises to match LoRA in terms of performance while reducing the number of parameters even further. Check out the included FourierFT notebook.
HRA
@DaShenZi721 added support for Householder Reflection Adaptation (#1864). This method bridges the gap between low rank adapters like LoRA on the one hand and orthogonal fine-tuning techniques such as OFT and BOFT on the other. As such, it is interesting for both LLMs and image generation models. Check out the HRA example on how to perform DreamBooth fine-tuning.
Enhancements
add_weighted_adapter
method thanks to @alexrs (#1701).peft_model.get_layer_status()
andpeft_model.get_model_status()
to get an overview of the layer/model status of the PEFT model. This can be especially helpful when dealing with multiple adapters or for debugging purposes. More information can be found in the docs (#1743).Examples
Changes
Casting of the adapter dtype
Important: If the base model is loaded in float16 (fp16) or bfloat16 (bf16), PEFT now autocasts adapter weights to float32 (fp32) instead of using the dtype of the base model (#1706). This requires more memory than previously but stabilizes training, so it's the more sensible default. To prevent this, pass
autocast_adapter_dtype=False
when callingget_peft_model
,PeftModel.from_pretrained
, orPeftModel.load_adapter
.Adapter device placement
The logic of device placement when loading multiple adapters on the same model has been changed (#1742). Previously, PEFT would move all adapters to the device of the base model. Now, only the newly loaded/created adapter is moved to the base model's device. This allows users to have more fine-grained control over the adapter devices, e.g. allowing them to offload unused adapters to CPU more easily.
PiSSA
save_pretrained
with theconvert_pissa_to_lora
argument is deprecated, the argument was renamed topath_initial_model_for_weight_conversion
(#1828). Also, calling this no longer deletes the original adapter (#1933).path_initial_model_for_weight_conversion
) while also usinguse_rslora=True
andrank_pattern
oralpha_pattern
now raises an error (#1930). This used not to raise but inference would return incorrect outputs. We also warn about this setting during initialization.Call for contributions
We are now making sure to tag appropriate issues with the
contributions welcome
label. If you are looking for a way to contribute to PEFT, check out these issues.What's Changed
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.