Repository navigation
Support MOSS-VL - #9944
Merged
Merged
Support MOSS-VL#9944
Conversation
meichangsu1
reviewed
Aug 19, 2026
meichangsu1
reviewed
Aug 19, 2026
meichangsu1
reviewed
Aug 19, 2026
Contributor
Author
PR #9944 更新说明一、关于本次 push:SP 支持撤出本 PR本次更新将 sequence parallel 支持整体撤出本 PR,改动范围严格限定为:
SP 支持后续将整理为独立 PR 提交。 撤回后本 PR 的范围:模型/模板接入 + 两个 MOSS-VL 必需的通用小修复( 二、回复 tastelikefeet 的 review(
|
tastelikefeet
approved these changes
Aug 21, 2026
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR type
PR information
Add MOSS-VL (8B,
model_type=moss_vl) as a first-class multimodal model for the Transformers backend. The model ships as remote code (48-layer LLM with vision cross-attention every 4 layers, 27-layer ViT with deep-stack features, merger, and a barenn.Parameterseparator token); this PR integrates it without copying the model implementation.Supported
swift infer(image/video) andswift sft: LoRA (target_modules=all-linear) and full-parameterfreeze_vit/freeze_aligner/freeze_llmon the real module boundaries; LoRA target scanning skips the bareseparator_token, LoRA-LLM saves it by exact name (and the loader exposes it through a BC property so the generic unfreeze path can reach it)labels_spans(binary strategies only; non-binary loss-scale raises explicitly)MaxLengthErrorNon-goals for this PR: sequence parallel (
--sequence_parallel_size > 1raises explicitly; support is planned as a follow-up PR),packing=true/ padding-free, Megatron/TP/PP/CP, RLHF, vLLM/lmdeploy/SGLang, quantization, streaming video.Generic changes, and why each is required by this model
Both are behavior-preserving for existing models and carry regression tests.
find_all_linearsskips non-Module paths when scanning LoRA targets: MOSS-VL'sseparator_tokenis a barenn.Parameter(not annn.Module); the previous scan crashed on it.lora_llmmatches aligner parameters whose names terminate at the prefix (f'.{name}'.endswith(f'.{prefix}')): required to save the trainable bareseparator_tokenin LoRA-LLM checkpoints — the oldf'.{prefix}.' in namematch never hits leaf parameters, silently dropping them fromvit.safetensors. Strictly additive: parameters under module-type prefixes always extend past the prefix, so existing models match exactly as before.Tests: 16 lightweight tests (no 8B weight download): registration, template/processor golden alignment, collator padding, mixed-media batches, truncation contract, LoRA scanning,
lora_llmname matching, SP rejection.pre-commit run --all-filespasses.Requires:
transformers>=4.57.1,<5,torchcodec(0.7.x for torch 2.8),joblib.Experiment results
--freeze_aligner falsewith LoRA trains cleanly;lora_llmtrains with ViT/aligner unfrozen, savesseparator_tokenintovit.safetensors, and a zero-LR resume reproduces it bit-exactlyOpenMOSS-Team/MOSS-VL-Instruct-0708,lmms-lab/VideoChatGPT)