[Misc]Add BNB quantization for PaliGemmaForConditionalGeneration (#12237)
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
This commit is contained in:
@@ -344,10 +344,16 @@ class SiglipMLP(nn.Module):
|
||||
|
||||
self.config = config
|
||||
self.activation_fn = get_act_fn(config.hidden_act)
|
||||
|
||||
# For quantization, we require the hidden size to be a multiple of 64
|
||||
quantizable = (config.hidden_size % 64 == 0
|
||||
and config.intermediate_size % 64 == 0)
|
||||
# Special handling for BNB quantization
|
||||
if quant_config and quant_config.get_name() == "bitsandbytes":
|
||||
quantizable = True
|
||||
else:
|
||||
# For other quantization, we require the hidden size to be a
|
||||
# multiple of 64
|
||||
quantizable = (
|
||||
config.hidden_size % 64 == 0
|
||||
and config.intermediate_size % 64 == 0
|
||||
)
|
||||
self.fc1 = ColumnParallelLinear(
|
||||
config.hidden_size,
|
||||
config.intermediate_size,
|
||||
|
||||
Reference in New Issue
Block a user