huaweicloud/huaweicloud-skills

huawei-cloud-msmodelslim-model-analysis

Analyze candidate models before adapter implementation.

查看源码
仓库原始内容

按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。

Huawei Cloud msModelSlim Model Analysis

Overview

This skill analyzes candidate models before adapter implementation for msModelSlim.

Architecture: Implementation Source Detection → Model Type Classification → Structural Feature Analysis → Risk Assessment

Related Skills:

  • huawei-cloud-msmodelslim-model-adapt - Adapter creation based on analysis

results

Architecture Components

This skill involves the following cloud services and components:

  • msModelSlim: Huawei Cloud's model quantization framework
  • Transformers Library: Hugging Face Transformers for model loading
  • ModelScope: Model download and management platform
  • config.json: Model configuration file for analysis

Architecture Diagram:

text
┌─────────────────────────────────────────────────────────────┐
│           msModelSlim Model Analysis Skill                  │
├─────────────────────────────────────────────────────────────┤
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐ │
│  │  Model       │───▶│  Source      │───▶│  Structure   │ │
│  │  Input       │    │  Detection   │    │  Analysis    │ │
│  │  (config)    │    │              │    │              │ │
│  └──────────────┘    └──────────────┘    └──────────────┘ │
│         │                   │                   │          │
│         ▼                   ▼                   ▼          │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐ │
│  │  Type        │    │  MoE         │    │  Risk        │ │
│  │  Classification│   │  Assessment │    │  Assessment │ │
│  └──────────────┘    └──────────────┘    └──────────────┘ │
└─────────────────────────────────────────────────────────────┘

Use Cases

Typical Problem Scenarios:

  • Assessing model adaptation feasibility before creating msModelSlim adapters
  • Analyzing model structure and type classification
  • Evaluating MoE compatibility for quantization
  • Determining if a model can be quantized with msModelSlim
  • Identifying potential risks before adapter development

Typical User Phrases:

  • "Analyze my model for msModelSlim compatibility"
  • "Check if this model can be quantized"
  • "Evaluate MoE fused weights risk"
  • "Assess model adaptation feasibility"
  • "Analyze model structure for quantization"
  • "AnalysisModelmsModelSlim"
  • "ModelQuantization"
  • "CheckMoE"

Scope

Supported:

  • Decoder-only LLM
  • VLM text backbone analysis (LLM/text path only)

Not supported:

  • Non-transformers implementations
  • Multimodal generation models (image/video/audio generation)

Required Input

  • Model path or model repository identifier
  • config.json
  • Optional: modeling_*.py, model.safetensors.index.json in the model

directory

  • If files are missing locally:
  • Download non-weight files using:

modelscope download --model <org>/<model> --local_dir ./models/<name> --exclude '*.safetensors'

  • Read config.json and modeling_*.py from the download directory as input

for analysis.

Hard Requirement: Parse Implementation Source First

Must complete before any structural analysis. Agent should manually parse following these steps:

  1. Read `config.json`:
  • Get model_type
  • Get auto_map (if present)
  1. Try parsing from transformers:
  • Check if transformers library supports the model_type.
  • Check if path exists:

transformers/models/<model_type>/modeling_<model_type>.py.

  • If exists, record as transformers implementation.
  1. If not parsed, try model-local implementation:
  • Check if files pointed by auto_map exist in the model directory.
  • Check if modeling_*.py files exist in the model directory.
  • If exists, record as model-local implementation.
  1. If neither path available:
  • Stop analysis.
  • Request user to provide readable model implementation code.

Minimum Workflow

  1. Parse implementation source (complete hard requirement above).
  1. Determine model type, structural differences, and connections:
  • Type: Pure LLM / Multimodal understanding / Multimodal generation
  • Compare with common Qwen2-like LLMs, record special structural designs

(e.g., MoE, non-standard attention, SSM/hybrid blocks, additional heads or parallel branches)

  • Check special structure connections (location, dependencies,

serial/parallel/residual connections, impact on backbone traversal)

  1. Identify structural features:
  • Decoder layer class, attention/MLP module naming, forward signature
  1. Determine features affecting adaptation:
  • Layer traversal path and order
  • Whether layer-by-layer loading is needed
  • MoE fused expert weight risk
  • Quantized model dequantization script risk
  • MTP structure implementation availability and weight handling risk
  1. Output structured analysis results (refer to template below).
  1. Provide next steps:
  • Proceed to adapter creation workflow
  • Or block and explain what user needs to provide

Model Type, Structural Differences, and Connection Determination

(relative to common Qwen2)

  • Pure LLM: Text token input only, backbone is decoder-only language model.
  • Multimodal understanding: Contains vision/audio encoders, but generation

path centers on text backbone; only text portion can be analyzed and adapted.

  • Multimodal generation: Core goal is image/video/audio generation; current

workflow does not support, should block and explain reason directly.

  • Structural differences only need to record "existence + impact direction",

no deep implementation details required.

  • Connection relationships should record at minimum: which stage special

structure is located in backbone, which modules it connects to, connection type (serial/parallel/residual), and impact on traversal/forward alignment.

MoE Layout Determination

  • Non-fused MoE: Experts expanded by module/list (commonly each expert has

its own gate/up/down linear layers).

  • Fused MoE: Multiple expert weights packaged as tensor parameters, no

longer independent linear layers.

  • If any of gate/up/down stored in [..., num_experts, ...] or

[num_experts, ...] form, treat as "fused".

  • Three-dimensional expert weights (e.g., gate/up/down each fused into 3D

parameters) uniformly classified as MoE fused, with "may need unpack" marked in report.

Required Output: Analysis Report

Agent should directly generate analysis report (Markdown format), must include following elements. Refer to template below:

markdown
# Analysis Report

## Model Identification
- Model Path/Repository: {model_path}
- `model_type`: {model_type}
- `architectures`: {architectures}

## Implementation Source Analysis
- Result: `transformers` | `model-local` | `unsupported`
- Basis:
  - Resolved file path: {path}
  - Related configuration fields (`model_type`, `auto_map`): {details}

## Model Features and Specifications
- Hidden size: {hidden_size}
- Number of layers: {num_layers}
- Attention heads / KV heads: {num_heads} / {num_kv_heads}
- Analyze only VLM text portion: Yes/No

## Model Type, Structural Differences and Connections
- Model type: Pure LLM | Multimodal understanding | Multimodal generation
- Special structures vs common Qwen2: {special_structures}
- Special structure connections: {special_structure_connections}
- Impact on adaptation workflow: {structure_impact}

## Layer-by-Layer Loading Assessment
- Need layer-by-layer loading: Yes/No
- Reason: {reason}
- Constraints (memory/runtime environment): {constraints}

## MoE Assessment
- Contains MoE: Yes/No
- Layout type: No MoE | Non-fused MoE | Fused MoE
- Suspected fused keys/modules: {keys}
- Expert weight form: Independent linear layers | Packaged tensors
- Needs unpack: Yes/No

## Adaptation Impact Points
- Decoder traversal path: {traversal_path}
- Attention module naming: {attn_module}
- MLP module naming: {mlp_module}
- `visit/forward` strict alignment points: {alignment_points}

## Quantization and MTP Risk Assessment
- Model already quantized: Yes/No
- Quantization determination basis: {quant_evidence}
- Dequantization script provided: Yes/No
- Dequantization script status: {dequant_status}
- MTP structure exists: Yes/No
- MTP implementation code accessibility: Accessible/Not accessible
- MTP risk description: {mtp_risk}

## Risks and Next Steps
- Risk level: Low | Medium | High
- Blockers: {blockers}
- Recommended next steps:
  - Proceed to adapter creation workflow
  - Or request user to provide implementation code

Risk Identification and User Communication Requirements (Mandatory)

  • If identified as "model already quantized", must mark "missing dequantization

script" as blocker, explicitly requiring user to actively provide dequantization script before continuing adaptation.

  • If MTP structure identified but implementation code inaccessible, must

explicitly inform:

  • Agent may not be able to fully implement MTP structure adaptation;
  • To continue, user needs to copy MTP-related weights themselves (map

according to user-side implementation).

  • When at least one of above two risk types hits, risk level must not be

lower than "Medium".

Pass/Fail Criteria

  • Pass: Implementation source is transformers or model-local, model

type is pure LLM or multimodal understanding, and report is complete; if quantization/MTP risks hit, clear user action requirements given in report.

  • Fail: Source not parsed, unsupported implementation type, determined as

multimodal generation model, or hits "quantized model without dequantization script" blocking condition.

Enhanced Features

Automated Compatibility Checker

This skill includes an automated model compatibility checker that scans model architectures before migration:

Features:

  • Migration Blocker Detection: Identifies unsupported operators, custom

layers, and framework-specific features

  • Early Warning System: Provides early warning for known issues with

suggested workarounds

  • Compatibility Score: Generates compatibility score with detailed breakdown
  • Operator Coverage Analysis: Reports operator coverage rate for Ascend NPU

support

Compatibility Check Categories:

CategoryCheck Items
Operator SupportTransformer layers, attention, normalization
Framework FeaturesCustom ops, dynamic shapes, control flow
Weight FormatsSafetensors, PyTorch, HF format compatibility
Special StructuresMoE, MTP, hybrid architectures

Output Format:

markdown
## Compatibility Check Result
- Overall Score: XX/100
- Passed: X/XX checks
- Warning: X items require attention
- Blockers: X items preventing migration

### Detailed Results
| Check Item        | Status     | Details                           |
|-------------------|------------|-----------------------------------|
| Operator coverage | ✓ Pass     | 95% of operators supported         |
| Custom layers     | ⚠️ Warning | 2 custom ops need AscendC impl    |
| Weight format     | ✓ Pass     | Standard Hugging Face format      |

Reference Documents

checklist

acceptance criteria

Prerequisites

  • transformers >= 4.40.0 installed
  • Model code available for analysis
  • Basic understanding of model structure

Analysis Workflow

The analysis workflow follows these steps:

  1. Parse model configuration (config.json)
  2. Determine implementation source (transformers or model-local)
  3. Analyze model architecture and structural features
  4. Assess MoE layout and fused weight risks
  5. Generate structured analysis report
  6. Provide adaptation recommendations

Parameter Reference

ParameterDescriptionRequired
modelModel name or pathYes
outputAnalysis report output pathNo
detailedOutput detailed informationNo
来自同一仓库

更多 Skills

全部 Skills
huaweicloud
社区

huawei-cloud-publish-work-to-gallery

Publish user's work to the Huawei Cloud University Operations Platform (华为云高校运营平台/作品陈列馆). Use this skill whenever the user wants to publish, submit, or upload a project/work to the gallery or a training camp (训练营) on the platform — including casual phrasings like "把作品发布上去", "投稿到陈列馆", "传作品到平台", "提交作品/项目", "报名发布作品", as well as formal ones like "publish to work gallery", "submit to training camp", "upload work to the platform". Do NOT use for general dev questions, git push to GitCode alone, or platform browsing without publishing intent.

安装量
5
GitHub Stars
50
最近更新
9月23日
huaweicloud
社区

huawei-cloud-eip-cost-optimizer

Huawei Cloud EIP (Elastic IP) cost optimization skill using hcloud CLI (KooCLI). 1. List and query EIPs across regions with detailed status 2. Identify idle/unbound EIPs and generate cost optimization reports 3. Set up idle EIP monitoring with webhook/email alerts 4. Generate HTML/JSON cost analysis reports 5. Maintain operation audit logs for compliance Read-only analysis only - NO bandwidth adjustment, tag management, or EIP release/deletion. Triggers include: "EIP cost optimization", "idle EIP analysis", "EIP audit", "cost report", "EIP status query", "EIP list", "EIP monitoring", "EIP alert", "cost analysis", "idle monitoring", "operation audit", "EIP 成本优化", "闲置 EIP 分析", "EIP 审计", "成本报告", "EIP 状态查询", "EIP 查询", "EIP 列表", "EIP 监控", "EIP 告警", "成本分析", "闲置监控", "操作审计"

安装量
1
GitHub Stars
50
最近更新
9月22日
huaweicloud
社区

huawei-cloud-flexus-l-deploy-jiuwenswarm

One-click deployment of JiuwenSwarm multi-Agent collaboration platform on Huawei Cloud Flexus L instances. Usage scenarios: When users need to quickly deploy JiuwenSwarm/JiuwenClaw on Huawei Cloud Flexus L instances, when they need to automatically create cloud instances and deploy AI Agent platforms, when they need to configure model APIs and message channels (Xiaoyi/Feishu/DingTalk). Automatically create instances, deploy applications via COC, configure models and message channels. Trigger keywords: JiuwenSwarm deployment, JiuwenClaw deployment, 九问Swarm部署, 九问Claw部署, 一键部署JiuwenSwarm, AI智能体平台部署, 部署九问Swarm, 部署九问Claw,云服务器部署AI平台.

安装量
1
GitHub Stars
50
最近更新
9月22日
huaweicloud
社区

huawei-cloud-flexus-l-server-flexusagent-deployment

Deploy AI Agent development platform (Dify) on Huawei Cloud Flexus L instance, providing deployment operations, password management, MaaS model configuration, and workflow import capabilities. Trigger keywords: deploy flexusagent/一键部署Flexus AI Agent开发平台、change password/修改开发平台管理员密码、change dify password/修改dify平台密码、add maas provider/添加MaaS模型供应商、configure maas model/配置MaaS模型、view workflow/查看AI Agent工作流、import workflow/导入AI Agent工作流

安装量
1
GitHub Stars
50
最近更新
9月22日