Update dependency peft to v0.15.2 #61
Open
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.3.0
->==0.15.2
Warning
Some dependencies could not be looked up. Check the warning logs for more information.
Release Notes
huggingface/peft (peft)
v0.15.2
Compare Source
This patch fixes a bug that resulted in prompt learning methods like P-tuning not to work (#2477).
v0.15.1
Compare Source
This patch includes a fix for #2450. In this bug
modules_to_save
was not handled correctly when used in conjunction with DeepSpeed ZeRO stage 3 which resulted in those modules being placeholder values in the saved checkpoints.Full Changelog: huggingface/peft@v0.15.0...v0.15.1
v0.15.0
Compare Source
Highlights
New Methods
CorDA: Context-Oriented Decomposition Adaptation
@iboing and @5eqn contributed CorDA: Context-Oriented Decomposition Adaptation of Large Language Models for Task-Aware Parameter-Efficient Fine-tuning . This task-driven initialization method has two modes, knowledge-preservation and instruction-preservation, both using external data to select ranks intelligently. The former can be used to select those ranks that correspond to weights not affiliated with knowledge from, say, a QA dataset. The latter can be used to select those ranks that correspond most to the task at hand (e.g., a classification task). (#2231)
Trainable Tokens: Selective token update
The new Trainable Tokens tuner allows for selective training of tokens without re-training the full embedding matrix, e.g. when adding support for reasoning / thinking tokens. This is a lot more memory efficient and the saved checkpoint is much smaller. It can be used standalone or in conjunction with LoRA adapters by passing
trainable_token_indices
toLoraConfig
. (#2376)Enhancements
LoRA now supports targeting multihead attention modules (but for now only those with
_qkv_same_embed_dim=True
). These modules were tricky as they may expose linear submodules but won't use their forward methods, therefore needing explicit support. (#1324)Hotswapping now allows different alpha scalings and ranks without recompilation of the model when the model is prepared using a call to
prepare_model_for_compiled_hotswap()
before compiling the model. (#2177)GPTQModel support was added in #2247 as a replacement for AutoGPTQ which is not maintained anymore.
Changes
all-linear
astarget_modules
for custom (non-transformers) models (#2267). With this change comes a bugfix where it was possible that non-linear layers were selected when they shared the same name with a linear layer (e.g.,bar.foo
andbaz.foo
).register_peft_method()
call. (#2282)PEFT_TYPE_TO_MODEL_MAPPING
is now deprecated and should not be relied upon. UsePEFT_TYPE_TO_TUNER_MAPPING
instead. (#2282)modules_to_save
keys wrongly matched parts of the state dict if the key was a substring of another key (e.g.,classifier
andclassifier2
). (#2334)disable_input_dtype_casting=True
. (#2353)rank_pattern
andalpha_pattern
used by many adapters now supports matching full paths as well by specifying the pattern with a caret in front, for example:^foo
to targetmodel.foo
but notmodel.bar.foo
. (#2419)What's Changed
adapter_name
conflict with tuner by @pzdkn in https://github.com/huggingface/peft/pull/2254"all-linear"
to target custom models by @BenjaminBossan in https://github.com/huggingface/peft/pull/2267__all__
by @bluenote10 in https://github.com/huggingface/peft/pull/2280config.py
by @innerlee in https://github.com/huggingface/peft/pull/2297prepare_model_for_kbit_training
docstring by @NilBiescas in https://github.com/huggingface/peft/pull/2305resize_token_embeddings
to docs by @bingwork in https://github.com/huggingface/peft/pull/2290get_peft_model()
for in-place base model modification by @d-kleine in https://github.com/huggingface/peft/pull/2313low_cpu_mem_usage=True
with 8bit bitsandbytes by @BenjaminBossan in https://github.com/huggingface/peft/pull/2325PEFT_TYPE_TO_MODEL_MAPPING
variable with deprecation by @BenjaminBossan in https://github.com/huggingface/peft/pull/2328modules_to_save
loading if substring by @BenjaminBossan in https://github.com/huggingface/peft/pull/2334modules_to_save
by @BenjaminBossan in https://github.com/huggingface/peft/pull/2220torch.compile
tests and docs by @BenjaminBossan in https://github.com/huggingface/peft/pull/2332nn.Conv1d
by @CCLDArjun in https://github.com/huggingface/peft/pull/2333prepare_model_for_compiled_hotswap
raises when no adapter was found by @BenjaminBossan in https://github.com/huggingface/peft/pull/2375hf_hub_download
arguments are used when loading locally by @henryzhengr in https://github.com/huggingface/peft/pull/2373all-linear
target modules by @BenjaminBossan in https://github.com/huggingface/peft/pull/2391PeftConfig.from_pretrained
by @BenjaminBossan in https://github.com/huggingface/peft/pull/2397.eval()
for inference by @faaany in https://github.com/huggingface/peft/pull/2408New Contributors
Full Changelog: huggingface/peft@v0.14.0...v0.15.0
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
Configuration
📅 Schedule: Branch creation - "after 5am on saturday" (UTC), 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 these updates again.
To execute skipped test pipelines write comment
/ok-to-test
.This PR has been generated by MintMaker (powered by Renovate Bot).