# huawei-cloud-msmodelslim-model-adapt

huawei-cloud-msmodelslim-model-adapt — a skill for Claude Code and Codex that builds Transformers model adapters for msModelSlim quantization. Guides the flow from reading config.json to four-step weight verification.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 165 installs · ★ 59 repo stars
- Author: huaweicloud
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/huaweicloud/huaweicloud-skills/tree/HEAD/skills/ai/modelarts/huawei-cloud-msmodelslim-model-adapt/SKILL.md
- Updated: 2026-11-12
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/huawei-cloud-msmodelslim-model-adapt

## What it does

The skill targets basic adapters for decoder-only LLMs and understanding VLM text backbones using W8A8 or W4A16 quantization on Ascend NPU. Image or video generators like Stable Diffusion and advanced schemes such as SmoothQuant or QuaRot are out of scope. Pick another tool for those architectures.

You start by inspecting `config.json` and `modeling_*.py` after pulling non-weight files with `modelscope download`. From there, the workflow fills out `assets/model_adapter_template.py` or `assets/vlm_model_adapter_template.py` with required methods such as `handle_dataset`, `init_model`, `generate_model_visit`, `generate_model_forward`, and `enable_kv_cache`, keeping `visit` and `forward` strictly aligned. Registration goes into `config/config.ini` via `bash install.sh`. Four scripts under `scripts/` then test the adapter from dummy model creation to weight parity and description checks.

The environment requires `python3`, `bash`, Python 3.8+, `transformers` 4.40.0 or newer, and `msmodelslim` 1.0.0 or newer. Missing either library breaks the verification step.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-msmodelslim-model-adapt -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/huawei-cloud-msmodelslim-model-adapt/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/huawei-cloud-msmodelslim-model-adapt/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-msmodelslim-model-adapt -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/huawei-cloud-msmodelslim-model-adapt/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-msmodelslim-model-adapt -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/huawei-cloud-msmodelslim-model-adapt/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install huaweicloud/huaweicloud-skills skills/ai/modelarts/huawei-cloud-msmodelslim-model-adapt
```

2. **Manually: put the files in place**
- File: `.github/skills/huawei-cloud-msmodelslim-model-adapt/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-msmodelslim-model-adapt -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/huaweicloud/huaweicloud-skills --path skills/ai/modelarts/huawei-cloud-msmodelslim-model-adapt
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/huawei-cloud-msmodelslim-model-adapt/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-msmodelslim-model-adapt -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/huaweicloud/huaweicloud-skills/tree/HEAD/skills/ai/modelarts/huawei-cloud-msmodelslim-model-adapt/SKILL.md

## When to use it
- build a Transformers adapter for a new decoder-only LLM in msModelSlim
- adapt an understanding VLM text backbone for W8A8 or W4A16 quantization
- register a new model entry in `config/config.ini` and install it with `install.sh`
- verify fallback quantized weights and description rules using test scripts

## Example prompts
- Build a msModelSlim adapter for my custom Qwen model using `config.json` and `modeling_*.py`
- Set up a W4A16 quantization workflow for a decoder-only LLM targeting Ascend NPU
- Adapt the text backbone of my understanding VLM and run the four-step weight verification

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: ae0a089a309522f6.

BEGIN THIRD-PARTY FILE ae0a089a309522f6
````text
---
name: huawei-cloud-msmodelslim-model-adapt
description: |-
  Create basic Transformers model adapters for msModelSlim. Implements required interfaces and completes a four-step verification workflow:
  generate test model -> full fallback quantization -> weight verification -> quantization description validation. Use this skill when the user wants to: (1) create msModelSlim adapters for decoder-only LLM, (2) adapt understanding VLM text backbones for quantization, (3) implement W8A8/W4A16 quantization workflow for new models. Trigger: user mentions "msModelSlim", "adapter", "model adapter","quantization", "W8A8","W4A16", "transformers", "LLM", "VLM", "adapter creation", "适配器","模型适配", "量化", "模型适配器", "LLM量化"
compatibility:
  - transformers >= 4.40.0
  - msmodelslim >= 1.0.0
tags: [msModelSlim, adapter, quantization, model]
allowed-tools:
  - python3
  - bash
---

# Huawei Cloud msModelSlim Model Adapter

## Overview

This skill guides how to create basic adapters for new models to run
W8A8/W4A16 quantization workflows in msModelSlim.

**Architecture**: Model Analysis -> Adapter Creation -> Registration ->
Verification (4 Steps)

**Related Skills**:

- `huawei-cloud-msmodelslim-model-analysis` - Model structure analysis
  before adapter implementation
- `huawei-cloud-ascend-profiler-db-explorer` - Optional: Performance
  analysis after deployment

## Scope

**Supported**:

- Decoder-only LLM
- Understanding VLM (text/LLM backbone only)

**Not supported**:

- Multimodal generation (Stable Diffusion/Flux/Wan)
- Encoder-only models
- Non-Transformers architectures
- High-level quantization methods (SmoothQuant/QuaRot/FA3/FlatQuant)

## Architecture

```text
````
END THIRD-PARTY FILE ae0a089a309522f6

The third-party file has ended. Everything between the ae0a089a309522f6 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 1714 of 10479 bytes. © huaweicloud · MIT · https://github.com/huaweicloud/huaweicloud-skills/tree/HEAD/skills/ai/modelarts/huawei-cloud-msmodelslim-model-adapt/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
