Commit Graph

23 Commits

Author SHA1 Message Date
Benjamin Bossan 8b4eb2b5b2 FEAT Add PEFT shop Gradio space (#3317)
A space that looks like a web shop and allows to quickly check the
capabilities of different PEFT methods, search, and filter
results. Gives code snippets to try to use the models.

This still needs proper review, especially when it comes to the
heuristics used to determine the capabilities.
2026-06-17 11:30:41 +02:00
Benjamin Bossan 16fa9c8801 CHORE: Upgrade ruff 0.15.12 (#3202) 2026-05-12 21:17:27 +02:00
Benjamin Bossan edaab7f2dc FEAT Convert non-LoRA PEFT adapters to LoRA (#2939)
This adds the possibility to convert a non-LoRA adapter into a LoRA
adapter. Not all LoRA adapters will support this, but many will.

Conversion is not precise, there will be a loss of performance. The
higher the rank, the lower the loss, but also the less efficient the
adapter. Also, for now, this only supports linear layers. Still, this
has some advantages:

- In PEFT, LoRA supports more features than most other methods, e.g.
mixed adapter batches. Thus the converted adapter can be used with those
features.

- Some downstream packages support LoRA adapters, but not other PEFT
methods, e.g. Diffusers. The conversion allows to use a non-LoRA adapter
with those packages.

Users can pass a fixed rank for the LoRA adapter or a float that will
use a dynamic rank based on the threshold of the contribution of the
singular values.

Unrelated changes

I noticed that the VB-LoRA layer had no __repr__, so it was added.

The return type annotation of set_peft_model_state_dict was incorrect.
2026-01-08 17:54:43 +01:00
Yao Matrix a4b41e7924 ENH Support XPU in train_memory.py script (#2729)
Signed-off-by: Yao, Matrix <matrix.yao@intel.com>
2025-08-08 12:06:46 +02:00
J.L bb4fb50e2b FEAT Add MiSS as a replacement for Bone. (#2604)
Add MiSS, an evolution of Bone, from https://arxiv.org/abs/2409.15371.

MiSS will replace Bone, which is now deprecated. A script to convert Bone
checkpoints to MiSS checkpoints is included.
2025-08-01 18:37:20 +02:00
Yao Matrix 8d935a63c2 CI Enable 5 test cases on XPU (#2442)
Signed-off-by: Yao, Matrix <matrix.yao@intel.com>
2025-03-25 13:43:14 +01:00
Benjamin Bossan dbae76979b ENH Add simple script to estimate train memory (#2378) 2025-03-04 17:16:54 +01:00
Benjamin Bossan bbb112841b MNT Update ruff to v0.9.2 (#2343)
We use ruff for linting. The version is fixed because otherwise, we
formatting changes would creep into random PRs. Thus far, the version
was ~0.6.1 but that's already quite old by now, thus moving to ~v0.9.2.

The ruff changes themselves are all about:

1. Other line breaking logic for asserts with messages
2. More aggressive string normalizaton

Comment

Making these changes is always a bit annoying since existing PRs might
need to be updated, but there is never a really good time to do it.
2025-01-24 11:28:38 +01:00
githubnemo 9c11a3e59a Attempt at adding a cache for models (#2327)
This change introduces CI caching for datasets and hub artifacts across runner operating systems with the intended goal to minimize the number of failed test runs because of network faults. As an additional bonus it might make the CI a bit faster.

The following artifacts are cached: ${HF_HOME}/hub/**

Note that we're avoiding .lock files as well as *.pyc files. We're not simply caching $HF_HOME since there is also the datasets and modules where the former was acting up when testing (no details, just dropped, we may explore this later but we're not using that many datasets) and the latter is just code which is probably not a good idea to cache anyway.

There is a post process for the cache action which uploads new data to the cache - only one runner can access the cache for uploading. This is done because github actions is locking cache creation, so if there's a concurrent cache creation, both may fail. This runner is currently set to ubuntu in the python 3.10 run.

If this modification turns out to be ineffective we can move to forbidding access to the hub in general (HF_HUB_OFFLINE=1) and updating the cache once per day but let's first try out if this is already enough to decrease the fail rate.
2025-01-23 10:54:25 +01:00
Benjamin Bossan a18734d87a Update style with ruff 0.2.2 (#1565)
This is necessary to add to main fast, or else all branches from main
will require these changes to pass the quality checks.
2024-03-15 10:20:41 +01:00
Aarni Koskela fc78a2491e MNT Move code quality fully to ruff (#1421) 2024-02-07 12:52:35 +01:00
Younes Belkada 029dcd5a1c [bnb] Add bnb nightly workflow (#1282)
* add bnb nightly workflow

* add matrix strategy

* temp

* oops

* temp

* oops

* nit

* fixes

* up

* up

* up

* add pytest cov

* up

* oops

* put correct dir

* fix

* fix dir in makefile + failing test

* revert

* Update .github/workflows/nightly.yml

* Update nightly-bnb.yml

* Update log_reports.py

* Update Makefile

* Update .github/workflows/nightly-bnb.yml

* Update .github/workflows/nightly-bnb.yml

* Update .github/workflows/nightly.yml

* Update nightly.yml

* Update .github/workflows/nightly-bnb.yml

* Update nightly-bnb.yml
2023-12-20 10:49:13 +01:00
Benjamin Bossan 88e2e75cc3 FIX Error in log_reports.py (#1261)
Silly mistake...
2023-12-13 10:50:05 +01:00
Benjamin Bossan 21c304f6f6 FIX Truncate slack message to not exceed 3000 char (#1251)
Should fix the issue of not receiving slack notifications because the
message is too long, see:

https://github.com/huggingface/peft/actions/runs/7148379741/job/19469273483

Currently, we get:

> Error: ver responded with: {'ok': False, 'error': 'invalid_blocks', 'errors': ['failed to match all allowed schemas [json-pointer:/blocks/1/text]', 'must be less than 3001 characters [json-pointer:/blocks/1/text/text]'], 'response_metadata': {'messages': ['[ERROR] failed to match all allowed schemas [json-pointer:/blocks/1/text]', '[ERROR] must be less than 3001 characters [json-pointer:/blocks/1/text/text]']}}

Fixing the error should also lead to a shorter message, but we should
ensure that even if the message is too long, we still get it.
2023-12-12 11:05:48 +01:00
Benjamin Bossan b467e3de5c Lazy import of bitsandbytes (#1230)
Previously, we imported from bitsandbytes eagerly if the package was
installed. This caused two major issues:

- Slow loading time of PEFT (~4 sec)
- Errors with multiprocessing because bnb initializes CUDA

This commit fixes both issues by importing bitsandbytes lazily. PEFT
import time is now reduced to ~2sec.

Notes

Implementation-wise, I use a combination of local imports and
module-level __getattr__. The latter was introduced in Python 3.7 and
should therefore be safe to use.
2023-12-07 16:39:08 +01:00
Younes Belkada 9da72d25ed Fix Slack bot not displaying error messages (#1068)
* Update log_reports.py

* Update log_reports.py

* Update log_reports.py

* change logic

* fix
2023-11-01 12:41:23 +01:00
Benjamin Bossan 07f2b82dae Fix stale.py to use timezone-aware datetime (#1016)
Fix an error with our stale.py script:

> can't subtract offset-naive and offset-aware datetimes

https://github.com/huggingface/peft/actions/runs/6497439325/job/17646562512
2023-10-12 18:42:06 +02:00
Younes Belkada b8b84cb6ce [tests] Fix dockerfile (#608)
* fix dockerfile and test

* relax constraints

* fix

* fix log reports and empty cache

* revert workflow

* add librosa
2023-06-20 12:33:14 +02:00
Younes Belkada a37156c2c7 [CI] Fix nightly CI issues (#375)
* Update log_reports.py

* Update nightly.yml

* Update Makefile

* Update Makefile

* fixes

* add tabulate

* fix setup

* final fix

* fix nits
2023-05-02 09:59:54 +02:00
Younes Belkada 3890665e60 [core] Better log messages (#366)
* better log messages

* better log messages

* change order
2023-04-26 12:30:32 +05:30
Younes Belkada 49a20c16dc [tests] add slow tests to GH workflow (#304)
* add slow tests to GH workflow

* add correct channel
2023-04-25 12:12:16 +02:00
Younes Belkada 4ddb85ce1e Update stale.py 2023-04-03 17:08:42 +02:00
Younes Belkada dd30335ffd [Automation] Add stale bot (#247)
* add stale bot

* fix
2023-04-03 14:31:11 +02:00