Record Class QwenVisionArgs
java.lang.Object
java.lang.Record
smile.llm.model.qwen.QwenVisionArgs
- Record Components:
depth- ViT block count.- 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 Summary
ConstructorsConstructorDescriptionTiny defaults for unit tests.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 aQwenVisionArgsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionint[]Returns the value of thedeepstackVisualIndexesrecord component.intdepth()Returns the value of thedepthrecord component.final booleanIndicates whether some other object is "equal to" this one.static QwenVisionArgsfromConfig(tools.jackson.databind.JsonNode root) Parses root multimodal config (with nestedvision_config).static QwenVisionArgsfromHuggingFace(String path) Loads vision args and multimodal token ids from a HuggingFaceconfig.json.booleanReturns whether DeepStack fusion is configured.final inthashCode()Returns a hash code value for this object.intheadDim()ViT head dimension.intReturns the value of thehiddenSizerecord component.intReturns the value of theimageTokenIdrecord component.intReturns the value of theinChannelsrecord component.intReturns the value of theintermediateSizerecord component.intmergedTokens(int t, int h, int w) Merged vision token count for one media grid.booleanReturns the value of themropeInterleavedrecord component.int[]Returns the value of themropeSectionrecord component.intnumHeads()Returns the value of thenumHeadsrecord component.intReturns the value of thenumPositionEmbeddingsrecord component.intReturns the value of theoutHiddenSizerecord component.intpatchDim()Flattened Conv3d patch input featuresin * t * p * p.intReturns the value of thepatchSizerecord component.intReturns the value of thespatialMergeSizerecord component.intReturns the value of thetemporalPatchSizerecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thevideoTokenIdrecord component.intReturns the value of thevisionEndTokenIdrecord component.intReturns the value of thevisionStartTokenIdrecord component.
-
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 aQwenVisionArgsrecord class.- Parameters:
depth- the value for thedepthrecord componenthiddenSize- the value for thehiddenSizerecord componentintermediateSize- the value for theintermediateSizerecord componentnumHeads- the value for thenumHeadsrecord componentinChannels- the value for theinChannelsrecord componentpatchSize- the value for thepatchSizerecord componenttemporalPatchSize- the value for thetemporalPatchSizerecord componentspatialMergeSize- the value for thespatialMergeSizerecord componentoutHiddenSize- the value for theoutHiddenSizerecord componentnumPositionEmbeddings- the value for thenumPositionEmbeddingsrecord componentdeepstackVisualIndexes- the value for thedeepstackVisualIndexesrecord componentimageTokenId- the value for theimageTokenIdrecord componentvideoTokenId- the value for thevideoTokenIdrecord componentvisionStartTokenId- the value for thevisionStartTokenIdrecord componentvisionEndTokenId- the value for thevisionEndTokenIdrecord componentmropeInterleaved- the value for themropeInterleavedrecord componentmropeSection- the value for themropeSectionrecord component
-
-
Method Details
-
patchDim
public int patchDim()Flattened Conv3d patch input featuresin * 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:
truewhen 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
Loads vision args and multimodal token ids from a HuggingFaceconfig.json.- Parameters:
path- path toconfig.json.- Returns:
- vision args, or
nullwhen novision_configis present. - Throws:
IOException- if the file cannot be read.
-
fromConfig
Parses root multimodal config (with nestedvision_config).- Parameters:
root- HF config root.- Returns:
- vision args.
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
depth
-
intermediateSize
public int intermediateSize()Returns the value of theintermediateSizerecord component.- Returns:
- the value of the
intermediateSizerecord component
-
numHeads
-
inChannels
public int inChannels()Returns the value of theinChannelsrecord component.- Returns:
- the value of the
inChannelsrecord component
-
patchSize
-
temporalPatchSize
public int temporalPatchSize()Returns the value of thetemporalPatchSizerecord component.- Returns:
- the value of the
temporalPatchSizerecord component
-
spatialMergeSize
public int spatialMergeSize()Returns the value of thespatialMergeSizerecord component.- Returns:
- the value of the
spatialMergeSizerecord component
-
outHiddenSize
public int outHiddenSize()Returns the value of theoutHiddenSizerecord component.- Returns:
- the value of the
outHiddenSizerecord component
-
numPositionEmbeddings
public int numPositionEmbeddings()Returns the value of thenumPositionEmbeddingsrecord component.- Returns:
- the value of the
numPositionEmbeddingsrecord component
-
deepstackVisualIndexes
public int[] deepstackVisualIndexes()Returns the value of thedeepstackVisualIndexesrecord component.- Returns:
- the value of the
deepstackVisualIndexesrecord component
-
imageTokenId
public int imageTokenId()Returns the value of theimageTokenIdrecord component.- Returns:
- the value of the
imageTokenIdrecord component
-
videoTokenId
public int videoTokenId()Returns the value of thevideoTokenIdrecord component.- Returns:
- the value of the
videoTokenIdrecord component
-
visionStartTokenId
public int visionStartTokenId()Returns the value of thevisionStartTokenIdrecord component.- Returns:
- the value of the
visionStartTokenIdrecord component
-
visionEndTokenId
public int visionEndTokenId()Returns the value of thevisionEndTokenIdrecord component.- Returns:
- the value of the
visionEndTokenIdrecord component
-
mropeInterleaved
public boolean mropeInterleaved()Returns the value of themropeInterleavedrecord component.- Returns:
- the value of the
mropeInterleavedrecord component
-
mropeSection
public int[] mropeSection()Returns the value of themropeSectionrecord component.- Returns:
- the value of the
mropeSectionrecord component
-