Skip to content

Commit

Permalink
fix padding type casting
Browse files Browse the repository at this point in the history
  • Loading branch information
Blaizzy committed Nov 26, 2024
1 parent 88c31b4 commit 0b002a9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mlx_vlm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ def _pad_vision_model(model: nn.Module, vision_size: int, divisor: int = 64) ->
)

if new_out != out_features or new_in != in_features:
new_weight = mx.zeros((new_out, new_in))
new_bias = mx.zeros((new_out))
new_weight = mx.zeros((new_out, new_in), dtype=module.weight.dtype)
new_bias = mx.zeros((new_out), dtype=module.bias.dtype)

new_weight[:out_features, :in_features] = module.weight
module.weight = new_weight
Expand Down

0 comments on commit 0b002a9

Please sign in to comment.