# openclaw-npu-agent **Repository Path**: swner_admin/openclaw-npu-agent ## Basic Information - **Project Name**: openclaw-npu-agent - **Description**: OpenClaw NPU Agent - 深度学习模型NPU转换与部署框架支持将ONNX/PyTorch/TensorFlow等框架模型转换为华为Ascend、Rockchip、联发科、高通等NPU可执行格式,内置图优化、量化、自动扩缩容等企业级特性。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-19 - **Last Updated**: 2026-03-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OpenCLAW NPU Agent [![GitHub](https://img.shields.io/badge/GitHub-natureLanguageQing-blue?logo=github)](https://github.com/natureLanguageQing/openclaw-npu-agent-) [![Gitee](https://img.shields.io/badge/Gitee-swner__admin-red?logo=gitee)](https://gitee.com/swner_admin/openclaw-npu-agent) NPU模型转换智能体系统 - 将AI模型自动转换为NPU原生高可用格式。 感谢 [OpenI 启智社区](https://openi.pcl.ac.cn) 提供华为昇腾910 NPU作为实验基础。 ## 系统架构 ``` ┌─────────────────────────────────────────────────────────────────┐ │ OpenCLAW NPU Agent System │ ├─────────────────────────────────────────────────────────────────┤ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │ │ Model Parser │ │ Graph Opt │ │ NPU Codegen │ │ │ │ 模型解析器 │ │ 图优化器 │ │ 代码生成器 │ │ │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │ │ └─────────────────┴─────────────────┘ │ │ │ │ │ ┌──────┴──────┐ │ │ │ Converter │ │ │ │ 转换引擎 │ │ │ └──────┬──────┘ │ │ │ │ │ ┌────────────────────────┼────────────────────────┐ │ │ │ NPU Runtime Engine │ │ │ └──────────────────────────────────────────────────┘ │ │ │ │ │ ┌────────────────────────┼────────────────────────┐ │ │ │ HA Cluster Manager │ │ │ └──────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────┘ ``` ## 核心特性 - **多框架支持**: PyTorch、TensorFlow、ONNX、JAX、PaddlePaddle - **自动模型分析**: 识别模型结构、算子类型、计算图特征 - **NPU算子映射**: 将通用算子映射到NPU原生算子(华为昇腾优先) - **高可用架构**: 负载均衡、故障转移、弹性伸缩 - **性能优化**: 自动图优化、量化、内存优化 ## 快速开始 ### 安装 ```bash pip install -r requirements.txt ``` ### 简单转换示例 ```python from openclaw_npu_agent import ModelConverter, ConversionConfig # 创建转换器 converter = ModelConverter() # 配置转换参数 config = ConversionConfig( source_framework="pytorch", target_npu="ascend", optimization_level=3, precision="fp16", soc_version="Ascend910" ) # 执行转换 result = converter.convert("model.pt", config, "output.npu") if result.success: print(f"转换成功!耗时: {result.duration_ms}ms") else: print(f"转换失败: {result.error_message}") ``` ### 集群部署 启动Master节点: ```bash python -m agent.master.api_server --host 0.0.0.0 --port 8080 ``` 启动Worker节点: ```bash python -m agent.worker.converter_worker \ --worker-id worker-01 \ --master http://master:8080 \ --npu-type ascend \ --npu-count 8 ``` ## 技术栈 | 组件 | 技术方案 | |------|---------| | 核心框架 | Python 3.11+ / C++ 17 | | 图优化 | MLIR / TVM Relay兼容 | | RPC通信 | gRPC + Protobuf | | 服务协调 | etcd / Consul | | 监控 | Prometheus + Grafana | | 容器化 | Docker + Kubernetes | ## 目录结构 ``` openclaw-npu-agent/ ├── core/ # 核心库 │ ├── ir/ # 中间表示 │ ├── parser/ # 模型解析器 │ ├── optimizer/ # 图优化 │ ├── codegen/ # 代码生成 │ └── runtime/ # 运行时 ├── agent/ # 智能体服务 │ ├── master/ # 主控节点 │ └── worker/ # 工作节点 ├── ha/ # 高可用组件 ├── tests/ # 测试 ├── examples/ # 示例 └── configs/ # 配置 ``` ## 支持的NPU | NPU类型 | 状态 | 说明 | |---------|------|------| | 华为昇腾910 | ✅ 已实现 | CANN 7.0+ | | Rockchip RKNN | 🚧 计划中 | | | MediaTek NeuroPilot | 🚧 计划中 | | | Qualcomm QNN | 🚧 计划中 | | ## 许可证 MIT License ## 致谢 特别感谢 **OpenI 启智社区** 提供华为昇腾910 NPU作为本项目的实验基础。 启智社区是中国领先的人工智能开源社区,提供算力支持和开源协作平台。 - 官网: https://openi.pcl.ac.cn