ascend-ai-coding/awesome-ascend-skills/mindspeed-mm-vlm
Claude Code and agent skill by ascend-ai-coding/awesome-ascend-skills
- community
Checking that the SKILL.md file is still in the repository.
Universal VLM (vision-language understanding model) training guide for Huawei Ascend NPU using MindSpeed-MM. Covers all three framework patterns (Megatron, FSDP2, Custom trainers), weight conversion, dataset preparation (MLLM JSON format), fine-tuning, inference, and evaluation. Supports Qwen2.5VL, Qwen2VL, Qwen3VL, InternVL2.5/3/3.5, GLM4.1V, GLM4.5V, DeepSeekVL2, DeepSeekOCR, Ming, and more. Use when training or fine-tuning any multimodal understanding model on Ascend NPU.
Install
npx vskill@latest install ascend-ai-coding/awesome-ascend-skills/mindspeed-mm-vlmSKILL.md
MindSpeed-MM VLM (Vision-Language Model) Training
This Skill guides users through training multimodal understanding (VLM) models on Huawei Ascend NPU using MindSpeed-MM. It uses Qwen2.5VL-3B as the flagship example and covers the end-to-end fine-tuning workflow.
Prerequisites
Critical: For most VLMs (Qwen2.5VL, Qwen2VL, InternVL, GLM4V, DeepSeekVL2), follow the manual install flow below. Do NOT usebash scripts/install.sh— official MindSpeed-MM docs state it only fully supports Qwen3/Qwen3.5. (For Qwen3VL / Qwen3.5, use one-click install +bash examples/qwen3_5/install_extensions.sh.)
Step P1: Clone repositories
Step P2: Install PyTorch + torch_npu
Always use pre-built wheels from Ascend PyTorch Releases. Do not use pip install torch==2.7.1 — aarch64 wheels on PyPI are unreliable.
Step P3: Install MindSpeed
Step P4: Install MindSpeed-MM base dependencies
Step P5: Activate CANN environment
Step P6: Smoke test
Then proceed to Step 0 below for model-specific dependencies. For Qwen2.5VL the base is sufficient; other models need overlays (see Step 0 table).
For detailed troubleshooting and alternative install paths, see mindspeed-mm-env-setup.
Supported VLM Models
| Model | Framework | Entry Script | Sizes | Status | |
|---|---|---|---|---|---|
| Qwen2.5VL | Megatron | pretrain_vlm.py | 3B/7B/32B/72B | Released | |
| Qwen2VL | Megatron | pretrain_vlm.py | 2B/7B/72B | Released | |
| Qwen3VL | FSDP2 | pretrain_transformers.py | 8B/30B/32B/235B | Released | |
| InternVL2.5 | Megatron | pretrain_internvl.py | 4B/78B | Released | |
| InternVL3 | Megatron | pretrain_vlm.py | 8B/78B | Released | |
| InternVL3.5 | FSDP2 | pretrain_transformers.py | -- | Released | |
| GLM4.1V | Megatron | pretrain_vlm.py | 9B | Released | |
| GLM4.5V | FSDP2 | pretrain_transformers.py | -- | Released | |
| DeepSeekVL2 | Megatron | pretrain_deepseekvl.py | -- | Released | |
| DeepSeekOCR | Custom | finetune_ocr.py | -- | Prototype | |
| DeepSeekOCR2 | Custom | finetune_ocr2.py | -- | Prototype | |
| Ming | Custom | finetune_vl.py | -- | Prototype |
Entry Script Note: VLM models use different entry scripts. Check the shell script inexamples/<model_name>/for the exact command — do not assume from the model name.
How to Train Any VLM Model
The workflow for training any VLM model in MindSpeed-MM follows a universal pattern:
- Find the example: Look in
examples/<model_name>/for available shell scripts (finetune, pretrain, inference, evaluate) - Read the shell script: Identify the entry script, config files, and parallelism settings
- Check weight conversion: Determine if the model needs
mm-convert(Megatron models), DCP conversion (FSDP2 models), or uses HF weights directly (custom trainer models) - Modify config files: Update data paths and weight paths in the config files (JSON or YAML depending on the framework)
- Launch the shell script:
bash examples/<model_name>/finetune_<model>_<size>.sh
For other models, adapt the Qwen2.5VL quick start below. Use the Model Registry to look up the exact entry script, converter, and backend for your target model.
Framework Patterns
All VLM models in MindSpeed-MM follow one of three framework patterns:
Pattern 1: Megatron (Qwen2.5VL, Qwen2VL, InternVL2.5, InternVL3, GLM4.1V, DeepSeekVL2)
Pattern 2: FSDP2 (Qwen3VL, InternVL3.5, GLM4.5V)
Pattern 3: Custom Trainers (DeepSeekOCR, DeepSeekOCR2, Ming)
Quick Start: Qwen2.5VL-3B Fine-Tuning (End-to-End)
This is the flagship Megatron-pattern example. For other models, follow the same workflow structure but use configs and scripts fromexamples/<model_name>/. FSDP2 models use YAML configs instead of JSON; Custom trainer models skip weight conversion entirely. See the "Framework Patterns" section above.
Step 0: Model-Specific Dependencies
Different VLM models have different version requirements for libraries such as transformers. Some of these requirements conflict, so environment isolation is necessary.
| Model | Additional Dependencies | Notes | |
|---|---|---|---|
| Qwen2.5VL | None required | Base environment is sufficient | |
| Qwen3VL | pip install -r examples/qwen3vl/requirements.txt | Requires latest transformers; may conflict with other models | |
| DeepSeekOCR | pip install -r examples/deepseekocr/requirements.txt | Downgrades transformers to 4.46.3; must use isolated environment | |
| InternVL3 | None required | Base environment is sufficient (directory is examples/internvl3/, no extra requirements.txt) |
Important: Qwen3VL and DeepSeekOCR have conflicting transformers version requirements. If you need to support both, use separate Docker containers or conda environments. See per-model-deps.md for details.
Step 1: Weight Download and Conversion
1.1 Download HuggingFace Weights
1.2 HF to MM Format Conversion
MindSpeed-MM uses its own weight format (MM format). Weights must be converted before training.
Key parameter descriptions:
| Parameter | Description | |
|---|---|---|
--cfg.mm_dir | Output directory for converted MM format weights | |
--cfg.hf_config.hf_dir | Source HF weight directory | |
--cfg.parallel_config.llm_pp_layers | PP partitioning for LLM layers. [[36]] means all 36 layers on one device when PP=1 | |
--cfg.parallel_config.vit_pp_layers | PP partitioning for ViT layers. [[32]] means all 32 layers on one device when PP=1 | |
--cfg.parallel_config.tp_size | Tensor parallelism degree; must match the training configuration |
Important:llm_pp_layersandvit_pp_layersmust match thepipeline_num_layersin model.json. When PP > 1, you need to split the layer counts, e.g.,[[18,18]]for PP=2.
1.3 Converters for Different Models
| Model | Converter Name | Direction | Notes | |
|---|---|---|---|---|
| Qwen2.5VL | Qwen2_5_VLConverter | hf_to_mm / mm_to_hf | See example above | |
| Qwen2VL | Qwen2VLConverter | hf_to_mm / mm_to_hf | Same pattern as Qwen2.5VL | |
| Qwen3VL | Qwen3VLConverter | hf_to_dcp / dcp_to_hf | FSDP2: uses DCP format, not mm format | |
| Qwen3VL (Megatron) | Qwen3VLMegatronConverter | hf_to_mm / mm_to_hf | Alternative Megatron-path converter | |
| InternVL2.5/3 | InternVLConverter | hf_to_mm / mm_to_hf | --cfg.parallel_config.vit_pp_layers [[45]] | |
| InternVL3.5 | ExpertMergeDcpConverter | hf_to_dcp / dcp_to_hf | FSDP2 path; MoE model uses expert merge converter | |
| DeepSeekVL2 | DeepSeekVLConverter | hf_to_mm only | mm_to_hf is unimplemented (stub). Note MoE expert layers | |
| GLM4.1V | GlmConverter | hf_to_mm / mm_to_hf | Generic Megatron converter | |
| GLM4.5V | ExpertMergeDcpConverter | hf_to_dcp / dcp_to_hf | FSDP2 path; MoE model uses expert merge converter | |
| MoE models | ExpertMergeDcpConverter | merge / split | Merge/split MoE expert weights for DCP checkpoints | |
| DeepSeekOCR/OCR2 | None | -- | Uses HF weights directly; no conversion needed | |
| Ming | None | -- | Uses HF weights directly; no conversion needed |
Step 2: Dataset Preparation
VLM training uses the MLLM JSON format. This example uses COCO2017 + LLaVA-Instruct-150K.
2.1 Download Data
2.2 Convert to MLLM Format
Important: The conversion script uses hardcoded relative paths. It expects./data/llava_instruct_150k.jsonas input and./data/COCO2017/train2017/for image lookup. Run it from the MindSpeed-MM root directory, and ensure data is at./data/(or create symlinks).
Output: data/mllm_format_llava_instruct_data.json
The script converts LLaVA format (conversations/image) to MLLM format (messages/images), which is what MindSpeed-MM expects.
2.3 Data Directory Structure
Field name matching: The field names in your data JSON must match theattrsection in data.json config. Default mapping:messagesfor conversations,imagesfor image paths. Using different field names (e.g.,conversationsinstead ofmessages) will causeKeyError.
For detailed MLLM JSON format specifications, see data-format.md.
Step 3: Configuration Files
Qwen2.5VL-3B fine-tuning requires two JSON configuration files:
3.1 data.json (Data Configuration)
Path: examples/qwen2.5vl/data_3b.json
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/training/mindspeed-mm/mindspeed-mm-vlm/SKILL.md
Popularity
- Repository stars
- 161
- Repository forks
- 55
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 17 Aug 2026, 2 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ascend-ai-coding/awesome-ascend-skills/mindspeed-mm-vlm)