Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/trainer/test_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2398,7 +2398,7 @@ def test_bnb_adam8bit_no_bnb(self):

# Pretend that bnb does not exist, even if installed. By setting bnb to None, importing
# bnb will fail even if bnb is installed.
with patch.dict("sys.modules", {"bnb.optim": None}):
with patch.dict("sys.modules", {"bitsandbytes.optim": None}):
Copy link
Collaborator

Choose a reason for hiding this comment

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

So now bitsandbytes is invisible with this change?

Copy link
Contributor Author

@younesbelkada younesbelkada Aug 11, 2022

Choose a reason for hiding this comment

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

Yes inside this context manager bistandbytes should be invisible. Before it tried to overwrite the bnb module but it didn't existed (you can also check the lines above)

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally wasn't even sure why we needed the mock test when we have the actual library to test with. But since the effort was made to write it, I said why not.

with self.assertRaises(ValueError):
Trainer.get_optimizer_cls_and_kwargs(args)

Expand Down