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.
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
4-bit QLoRA via bitsandbytes (4-bit base model + LoRA) #23479
4-bit QLoRA via bitsandbytes (4-bit base model + LoRA) #23479
Changes from 12 commits
596b1c0
e66d556
5cdc176
0773ae5
24c49e5
68b8ba4
03b4d78
524be44
06cf851
42e1095
2525aee
cb7e54a
90412ab
0e6015b
866886c
4c5ebf1
170812b
6e0d3ac
1582692
1f25846
56110ec
80396d0
d4b4e4d
6263752
831fc4a
b42644a
9cd4319
d68e564
e8dcb57
ad30995
f1b2ab6
8b2e43d
84cd0b3
61d2993
33dde75
1d830b5
5c1a5e0
2f15b6e
617b58c
ea7175d
aac113d
e43237d
13c86fd
c72f302
7b1b1e6
cf393cf
f19d80c
ba287ff
1030921
1cae462
25f762e
2f43dc1
a63b649
49501db
4642523
a6ba77b
27cdff6
b2bc3ab
976f7d0
9c4946e
6f4f4dc
5359b59
0c0bb65
f4a2a0b
13a2ad7
0b05092
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in the Accelerate PR, is this not necessary anymore in the current released version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was never needed in the first place. The problem with this is that it does not allow for other data types which are necessary for mixed-precision 4-bit training.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this should be re-visited - it currently breaks some tests for existing 8bit integration for the following reason:
model_8bit = AutoModelForCausalLM.from_pretrained(self.model_name, load_in_8bit=True, device_map="auto")
as before this PR, they would get a model that is first converted in float16, then casted in float16, meaning that all the non-Linear layers would be casted in fp16, including embedding layers, etc.As some existing systems relies on that I would replace that warning with an information that says that if torch_dtype is not set, it would let the non Linear modules in the current dtype.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a proper warning message!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_loaded_in_kbit
is not a good name. All models are lodaded in a certain kbit precision for k in {4, 8, 16, 32}.is_quantized
would be more adapted.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this function.