Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
stop converting short-convolution state to float32 and back every ste…
…p (from bf16) - 2-3% faster prefill and 1.5-2% faster decode
  • Loading branch information
lucasgelfond committed Nov 21, 2026
commit dbeae8ae8d5fd046e5e9b6066ef6cbd4b07db070
3 changes: 1 addition & 2 deletions mlx_lm/models/inkling2/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,11 @@ def _conv_input(
conv_mask: mx.array | None,
kernel_size: int,
) -> mx.array:
hidden_states = hidden_states.astype(mx.float32)
if conv_mask is not None:
hidden_states = mx.where(conv_mask[..., None], hidden_states, 0)
if conv_state is None:
shape = (hidden_states.shape[0], kernel_size - 1, hidden_states.shape[-1])
conv_state = mx.zeros(shape, mx.float32)
conv_state = mx.zeros(shape, hidden_states.dtype)
return mx.concatenate([conv_state, hidden_states], axis=1)


Expand Down