Skip to content
Open
Changes from all commits
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
4 changes: 4 additions & 0 deletions Libraries/MLXVLM/Models/Qwen35.swift
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,10 @@ enum Qwen35Language {
imageGridTHW: [THW]? = nil,
videoGridTHW: [THW]? = nil
) -> LMOutput {
// Ensure inputs is 2D [batch, seq]. Text-only callers (e.g.
// WiredMemoryUtils, TokenIterator) may pass 1D token arrays.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if that is incorrect (as in this is the bug). I would expect the shape to always be [B, S].

So:

  • are these paths buggy in that they allow 1d arrays?
  • if not, perhaps the callers should ensure the correct shape -- otherwise this is a one-off fix for a single model

let inputs = inputs.ndim == 1 ? inputs.expandedDimensions(axis: 0) : inputs

if pixelValues != nil {
precomputedPositionIds = nil
ropeDeltas = nil
Expand Down