Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] fix bitsandbytes import issue #24151

Merged
merged 1 commit into from
Jun 10, 2023
Merged

[tests] fix bitsandbytes import issue #24151

merged 1 commit into from
Jun 10, 2023

Conversation

stas00
Copy link
Contributor

@stas00 stas00 commented Jun 9, 2023

this test has been failing when peft library was installed since it tries to access bitsandbytes.nn

$ pip install accelerate peft bitsandbytes==0.39.0
$ RUN_SLOW="yes" pytest -sv tests/extended/test_trainer_ext.py::TestTrainerExt::test_run_seq2seq_bnb
[...]
RuntimeError: Failed to import transformers.trainer_seq2seq because of the following error (look up to see its traceback):
E           module 'bitsandbytes' has no attribute 'nn'

here is why it's happening:

  1. We push transformers/tests into sys.path when running the subprocess-based tests here
  2. but we have transformers/tests/bitsandbytes dir under transformers/tests
  3. so when you do import bitsandbytes.nn it finds the wrong bitsandbytes dir, which is not the bnb library and it breaks

So this PR renames transformers/tests/bitsandbytes to transformers/tests/bnb which removes the conflicts and the failing test.

@stas00 stas00 changed the title fix bitsandbytes import issue [tests] fix bitsandbytes import issue Jun 9, 2023
@stas00 stas00 requested a review from pacman100 June 9, 2023 23:05
@stas00 stas00 marked this pull request as ready for review June 9, 2023 23:05
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 9, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

Copy link
Contributor

@pacman100 pacman100 left a comment

Choose a reason for hiding this comment

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

Thank you @stas00 for the blazing fast deep dive and the fix! 🤗

@stas00 stas00 merged commit 0d217f4 into main Jun 10, 2023
@stas00 stas00 deleted the bnb-import-tests branch June 10, 2023 04:53
novice03 pushed a commit to novice03/transformers that referenced this pull request Jun 23, 2023
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.

4 participants