Skip to content

support deepseek-v4-flash-vision-exp megatron-swift - #191

Open
z0o0ey wants to merge 7 commits into
modelscope:mainfrom
z0o0ey:main
Open

support deepseek-v4-flash-vision-exp megatron-swift#191
z0o0ey wants to merge 7 commits into
modelscope:mainfrom
z0o0ey:main

Conversation

@z0o0ey

@z0o0ey z0o0ey commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Comment on lines +249 to +254
# DSpark MTP
dspark_enabled: bool = False
dspark_block_size: int = 0
dspark_noise_token_id: int = 0
dspark_target_layer_ids: Optional[List[int]] = None
dspark_markov_rank: int = 256

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.

支持训练吗

if needs_split:
input_ids = split_cp_inputs(input_ids, getattr(packed_seq_params, 'cu_seqlens_q', None), dim=1)
if self.visual is not None and not self.config.language_model_only and input_ids is not None:
input_ids = self.visual.mask_input_ids(input_ids)

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.

检查其他模型的兼容性

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

这个分支只影响DeepSeek-V4多模态模型,目前只有DeepSeek-V4-Flash-Vision-exp模型

Comment on lines +251 to +252
dspark_block_size: int = 0
dspark_noise_token_id: int = 0

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.

检查下在哪里用到

if not self._dspark_target_hidden_states:
return
if self.config.enable_hyper_connections:
from megatron.core.transformer.hyper_connection import learned_output_contract

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.

try catch, 提示升级megatron版本

@z0o0ey

z0o0ey commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

需要实现dspark,不然vision模型的mtp层会完全随机,无法正常工作
目前dspark的逻辑链路hidden state 抓取 + main_proj 投影 这条链路是完整的,可以训练。但 Markov 预测头、噪声 token 注入、分块处理 这三个机制只有配置占位,没有对应代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants