Update gemma.py
This commit is contained in:
parent
47c6feaf89
commit
b174e54507
1 changed files with 16 additions and 16 deletions
|
|
@ -618,22 +618,22 @@ class FastGemmaModel(FastLlamaModel):
|
|||
|
||||
# Also patch all dtypes - BnB seems to not allocate the correct type?
|
||||
# BnB default dtype seems to be float16!
|
||||
correct_dtype = lm_head.weight.dtype
|
||||
# correct_dtype = lm_head.weight.dtype
|
||||
|
||||
for name, module in model.named_modules():
|
||||
if isinstance(module, (Bnb_Linear4bit, Peft_Linear4bit)):
|
||||
weight = module.weight
|
||||
quant_state = weight.quant_state
|
||||
# for name, module in model.named_modules():
|
||||
# if isinstance(module, (Bnb_Linear4bit, Peft_Linear4bit)):
|
||||
# weight = module.weight
|
||||
# quant_state = weight.quant_state
|
||||
|
||||
if type(quant_state) is list:
|
||||
# BnB seems to have float16 as default!
|
||||
module.weight.quant_state[2] = correct_dtype # Cast to correct dtype
|
||||
else:
|
||||
# https://github.com/TimDettmers/bitsandbytes/pull/763/files
|
||||
quant_state.dtype = correct_dtype
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
# if type(quant_state) is list:
|
||||
# # BnB seems to have float16 as default!
|
||||
# module.weight.quant_state[2] = correct_dtype # Cast to correct dtype
|
||||
# else:
|
||||
# # https://github.com/TimDettmers/bitsandbytes/pull/763/files
|
||||
# quant_state.dtype = correct_dtype
|
||||
# pass
|
||||
# pass
|
||||
# pass
|
||||
|
||||
# Add 1 to weight
|
||||
# return output * (1 + self.weight)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue