Record Class QwenVisionArgs

java.lang.Object
java.lang.Record
smile.llm.model.qwen.QwenVisionArgs
Record Components:
depth - ViT block count.
hiddenSize - ViT width.
intermediateSize - ViT MLP width.
numHeads - ViT attention heads.
inChannels - input channels (typically 3).
patchSize - spatial patch size.
temporalPatchSize - temporal patch size (images duplicate to fill).
spatialMergeSize - 2×2 spatial merge factor.
outHiddenSize - merger output (= text hidden size).
numPositionEmbeddings - learned 2D absolute pos-embed table length.
deepstackVisualIndexes - DeepStack layer indexes (empty = disabled).
imageTokenId - <|image_pad|> id.
videoTokenId - <|video_pad|> id.
visionStartTokenId - <|vision_start|> id.
visionEndTokenId - <|vision_end|> id.
mropeInterleaved - whether LLM RoPE uses interleaved mRoPE.
mropeSection - T/H/W section widths over half-freqs (e.g. 11,11,10).

public record QwenVisionArgs(int depth, int hiddenSize, int intermediateSize, int numHeads, int inChannels, int patchSize, int temporalPatchSize, int spatialMergeSize, int outHiddenSize, int numPositionEmbeddings, int[] deepstackVisualIndexes, int imageTokenId, int videoTokenId, int visionStartTokenId, int visionEndTokenId, boolean mropeInterleaved, int[] mropeSection) extends Record
Qwen3.8 / Qwen3.5 native vision-tower hyperparameters plus multimodal token ids.

DeepStack indexes are parsed but unused when empty (Qwen3.8-27B).

  • Constructor Details

    • QwenVisionArgs

      public QwenVisionArgs()
      Tiny defaults for unit tests.
    • QwenVisionArgs

      public QwenVisionArgs(int depth, int hiddenSize, int intermediateSize, int numHeads, int inChannels, int patchSize, int temporalPatchSize, int spatialMergeSize, int outHiddenSize, int numPositionEmbeddings, int[] deepstackVisualIndexes, int imageTokenId, int videoTokenId, int visionStartTokenId, int visionEndTokenId, boolean mropeInterleaved, int[] mropeSection)
      Creates an instance of a QwenVisionArgs record class.
      Parameters:
      depth - the value for the depth record component
      hiddenSize - the value for the hiddenSize record component
      intermediateSize - the value for the intermediateSize record component
      numHeads - the value for the numHeads record component
      inChannels - the value for the inChannels record component
      patchSize - the value for the patchSize record component
      temporalPatchSize - the value for the temporalPatchSize record component
      spatialMergeSize - the value for the spatialMergeSize record component
      outHiddenSize - the value for the outHiddenSize record component
      numPositionEmbeddings - the value for the numPositionEmbeddings record component
      deepstackVisualIndexes - the value for the deepstackVisualIndexes record component
      imageTokenId - the value for the imageTokenId record component
      videoTokenId - the value for the videoTokenId record component
      visionStartTokenId - the value for the visionStartTokenId record component
      visionEndTokenId - the value for the visionEndTokenId record component
      mropeInterleaved - the value for the mropeInterleaved record component
      mropeSection - the value for the mropeSection record component
  • Method Details

    • patchDim

      public int patchDim()
      Flattened Conv3d patch input features in * t * p * p.
      Returns:
      patch feature count (e.g. 1536).
    • headDim

      public int headDim()
      ViT head dimension.
      Returns:
      hiddenSize / numHeads.
    • hasDeepStack

      public boolean hasDeepStack()
      Returns whether DeepStack fusion is configured.
      Returns:
      true when DeepStack fusion is configured.
    • mergedTokens

      public int mergedTokens(int t, int h, int w)
      Merged vision token count for one media grid.
      Parameters:
      t - temporal patches.
      h - height patches.
      w - width patches.
      Returns:
      LLM visual token count.
    • fromHuggingFace

      public static QwenVisionArgs fromHuggingFace(String path) throws IOException
      Loads vision args and multimodal token ids from a HuggingFace config.json.
      Parameters:
      path - path to config.json.
      Returns:
      vision args, or null when no vision_config is present.
      Throws:
      IOException - if the file cannot be read.
    • fromConfig

      public static QwenVisionArgs fromConfig(tools.jackson.databind.JsonNode root)
      Parses root multimodal config (with nested vision_config).
      Parameters:
      root - HF config root.
      Returns:
      vision args.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • depth

      public int depth()
      Returns the value of the depth record component.
      Returns:
      the value of the depth record component
    • hiddenSize

      public int hiddenSize()
      Returns the value of the hiddenSize record component.
      Returns:
      the value of the hiddenSize record component
    • intermediateSize

      public int intermediateSize()
      Returns the value of the intermediateSize record component.
      Returns:
      the value of the intermediateSize record component
    • numHeads

      public int numHeads()
      Returns the value of the numHeads record component.
      Returns:
      the value of the numHeads record component
    • inChannels

      public int inChannels()
      Returns the value of the inChannels record component.
      Returns:
      the value of the inChannels record component
    • patchSize

      public int patchSize()
      Returns the value of the patchSize record component.
      Returns:
      the value of the patchSize record component
    • temporalPatchSize

      public int temporalPatchSize()
      Returns the value of the temporalPatchSize record component.
      Returns:
      the value of the temporalPatchSize record component
    • spatialMergeSize

      public int spatialMergeSize()
      Returns the value of the spatialMergeSize record component.
      Returns:
      the value of the spatialMergeSize record component
    • outHiddenSize

      public int outHiddenSize()
      Returns the value of the outHiddenSize record component.
      Returns:
      the value of the outHiddenSize record component
    • numPositionEmbeddings

      public int numPositionEmbeddings()
      Returns the value of the numPositionEmbeddings record component.
      Returns:
      the value of the numPositionEmbeddings record component
    • deepstackVisualIndexes

      public int[] deepstackVisualIndexes()
      Returns the value of the deepstackVisualIndexes record component.
      Returns:
      the value of the deepstackVisualIndexes record component
    • imageTokenId

      public int imageTokenId()
      Returns the value of the imageTokenId record component.
      Returns:
      the value of the imageTokenId record component
    • videoTokenId

      public int videoTokenId()
      Returns the value of the videoTokenId record component.
      Returns:
      the value of the videoTokenId record component
    • visionStartTokenId

      public int visionStartTokenId()
      Returns the value of the visionStartTokenId record component.
      Returns:
      the value of the visionStartTokenId record component
    • visionEndTokenId

      public int visionEndTokenId()
      Returns the value of the visionEndTokenId record component.
      Returns:
      the value of the visionEndTokenId record component
    • mropeInterleaved

      public boolean mropeInterleaved()
      Returns the value of the mropeInterleaved record component.
      Returns:
      the value of the mropeInterleaved record component
    • mropeSection

      public int[] mropeSection()
      Returns the value of the mropeSection record component.
      Returns:
      the value of the mropeSection record component