Skip to content

kali20gakki/msAgent / skills/quantizer/quantization-accuracy-tuning-orchestrator

quantization-accuracy-tuning-orchestrator

Verified

End-to-end automated model quantization and accuracy tuning workflow. Use when user asks for automated model quantization and accuracy tuning, e.g. "自动量化", "量化调优", "一键量化", "精度调优", etc. 当用户给出多卡(≥2 卡)卡号时,量化阶段通过 EP 并行适配(msmodelslim-ep-parallel-adaptation)保证多卡 EP 并行,调优主流程仍在本 Skill。

scripts/finalize_practice_repo.py

View on GitHub
# -------------------------------------------------------------------------
# This file is part of the MindStudio project.
# Copyright (c) 2026 Huawei Technologies Co.,Ltd.
#
# MindStudio is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
#          http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# -------------------------------------------------------------------------

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Finalize practice repo (replaces MCP practice_repo_finalize)."""

from __future__ import annotations

import argparse
import sys
from pathlib import Path
from typing import Any, Dict

# ---------------------------------------------------------------------------
# Bootstrap: add shared library to sys.path before any cross-skill imports
# ---------------------------------------------------------------------------
_common_dir = Path(__file__).resolve().parents[2] / "msmodelslim-tools-common" / "scripts"
if str(_common_dir) not in sys.path:
    sys.path.insert(0, str(_common_dir))

from script_utils import emit_result, ensure_msmodelslim  # noqa: E402
from shared import get_lab_practice_dir  # noqa: E402


def practice_repo_finalize(
    model_type: str,
    model_path: str,
    final_practice_path: str,
    trust_remote_code: bool = False,
) -> Dict[str, Any]:
    from msmodelslim.app.auto_tuning.model_info_interface import ModelInfoInterface
    from msmodelslim.core.practice import PracticeConfig
    from msmodelslim.infra.yaml_practice_manager import YamlPracticeManager
    from msmodelslim.model import PluginModelFactory
    from msmodelslim.utils.config import msmodelslim_config
    from msmodelslim.utils.security import yaml_safe_load

    try:
        custom_practice_dir = msmodelslim_config.env_vars.custom_practice_repo
        custom_practice_path = Path(custom_practice_dir) if custom_practice_dir else None

        practice_manager = YamlPracticeManager(
            official_config_dir=get_lab_practice_dir(),
            custom_config_dir=custom_practice_path,
        )
        model_adapter = PluginModelFactory().create(model_type, Path(model_path), trust_remote_code)
        practice_dict = yaml_safe_load(final_practice_path)
        practice_obj = PracticeConfig.model_validate(practice_dict)
        if practice_manager.is_saving_supported() and isinstance(model_adapter, ModelInfoInterface):
            practice_manager.save_practice(
                model_pedigree=model_adapter.get_model_pedigree(),
                practice=practice_obj,
            )
        return {"ok": True, "message": "practice repo finalized"}
    except Exception as exc:
        return {"ok": False, "error": str(exc)}


def main() -> int:
    parser = argparse.ArgumentParser(description="Save final Practice YAML to practice repository.")
    parser.add_argument("--model-type", required=True)
    parser.add_argument("--model-path", required=True)
    parser.add_argument("--final-practice-path", required=True)
    parser.add_argument("--trust-remote-code", action="store_true")
    args = parser.parse_args()

    ensure_msmodelslim()
    return emit_result(
        practice_repo_finalize(
            model_type=args.model_type,
            model_path=args.model_path,
            final_practice_path=args.final_practice_path,
            trust_remote_code=args.trust_remote_code,
        )
    )


if __name__ == "__main__":
    sys.exit(main())
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall