Skip to content

Bitsandbytes installation for qlora tests#1951

Merged
regisss merged 1 commit into
huggingface:mainfrom
HabanaAI:dev/bnb_test_installation
Apr 28, 2025
Merged

Bitsandbytes installation for qlora tests#1951
regisss merged 1 commit into
huggingface:mainfrom
HabanaAI:dev/bnb_test_installation

Conversation

@ckvermaAI
Copy link
Copy Markdown
Contributor

@ckvermaAI ckvermaAI commented Apr 25, 2025

Move bitsandbytes installation (required for qlora tests: tests/test_bnb_qlora.py, tests/test_bnb_inference.py) to conftest.py

Details:

  1. pytest runs the pytest_configure function before executing the test itself (https://github.com/huggingface/optimum-habana/blob/main/conftest.py#L118)

  2. Now, this function imports optimum.habana, which imports transformers.utils, which checks whether specific packages (for example: torch, peft, bitsandbytes) are installed (and transformers saves this state).

  3. Bitsandbytes is installed later (during the test execution) because the transformer has not updated its state, and the QLORA tests fail for the above reason.

  4. This issue does not occur in internal (OH-fork) repo because of the absence of the pytest_configure function from conftest.py file

  5. Currently, we cannot add bitsandbytes to the requirements of tests in setup.py as discussed earlier.(Pad the examples for QLoRa finetuning test #1941 (comment)). Once we upstream the a proper fix to bitsandbytes repo, we'll revert this change in conftest.py

@ckvermaAI ckvermaAI requested a review from regisss as a code owner April 25, 2025 13:47
@ckvermaAI
Copy link
Copy Markdown
Contributor Author

@regisss @libinta Please review this change (details are available in description)

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

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.

Copy link
Copy Markdown
Collaborator

@regisss regisss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@regisss regisss merged commit 336592f into huggingface:main Apr 28, 2025
4 checks passed
astachowiczhabana added a commit to HabanaAI/optimum-habana-fork that referenced this pull request Jul 8, 2025
astachowiczhabana added a commit to HabanaAI/optimum-habana-fork that referenced this pull request Jul 8, 2025
astachowiczhabana added a commit to HabanaAI/optimum-habana-fork that referenced this pull request Jul 10, 2025
astachowiczhabana added a commit to HabanaAI/optimum-habana-fork that referenced this pull request Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants