# SlimPo **Repository Path**: xt765/SlimPo ## Basic Information - **Project Name**: SlimPo - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2026-03-01 - **Last Updated**: 2026-03-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SlimPo - 全平台边缘侧对齐框架 [![PyPI version](https://img.shields.io/pypi/v/slimpo)](https://pypi.org/project/slimpo/) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![Python](https://img.shields.io/pypi/pyversions/slimpo.svg)](https://pypi.org/project/slimpo/) [![Code style](https://img.shields.io/badge/Code%20Style-ruff-orange.svg)](https://docs.astral.sh/ruff/) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/xt765/SlimPo/blob/main/examples/notebooks/02_colab_demo.ipynb) **SlimPo** 是全平台边缘侧对齐框架,基于 SimPO 篮法优化算法,实现 Llama-3.2、Qwen-3.5-0.8B 简洁回复、JSON 格式对齐、SQL 专家对齐。 支持三大垂直场景:反废话对齐、JSON 格式化、SQL 专家对齐。 ## 核心特性 - 🚀 **硬件自适应**: 自动检测 CUDA/MLX/OpenVINO,选择最优后端 - 🔄 **三种后端**: OpenVINO (CPU优化)、CUDA (GPU加速)、MLX (Apple Silicon) - 📦 **三大 Kit**: BriefKit (反废话)、JsonKit (JSON格式)、SqlKit (SQL专家) - 🔧 **CLI 工具**: 6 个命令 - train/evaluate/export/web/detect-hardware/generate-data - 🐀 **模型导出**: GGUF/OpenVINO IR/ONNX 格式 - 🌐 **Web UI**: Gradio 交互式界面 ## 安装 ```bash pip install slimpo ``` ## 快速开始 ```python from slimpo import BriefKit, JsonKit, SqlKit, get_kit, detect_hardware # 检测硬件 print(detect_hardware()) # 使用 Kit kit = get_kit("brief", model_id="Qwen/Qwen3.5-0.8B") kit.load() result = kit.generate("什么是机器学习?") print(result.text) ``` ## Web UI 启动 Web 界面进行交互式操作: ```bash # 本地启动 slimpo web # 指定端口 slimpo web --port 8080 # 创建公网链接 slimpo web --share ``` 访问 http://localhost:7860 即可使用 Web 界面。 ## Docker 部署 ### 使用 Docker Compose(推荐) ```bash # 启动服务 docker-compose up -d # 查看日志 docker-compose logs -f # 停止服务 docker-compose down ``` ### 使用 Docker 命令 ```bash # 构建镜像 docker build -t slimpo:latest . # 运行容器 docker run -d -p 7860:7860 --name slimpo-web slimpo:latest # 带模型缓存运行 docker run -d -p 7860:7860 -v ./models:/app/models -v ./cache:/app/.cache slimpo:latest ``` ### GPU 支持 ```bash # 使用 GPU 版本 docker-compose --profile gpu up -d ``` ## CLI 命令 ```bash slimpo --help slimpo train --model Qwen/Qwen3.5-0.8B --kit brief --data data.jsonl --epochs 3 slimpo export --model ./output/brief --format openvino --output ./exported/brief_ov slimpo detect-hardware slimpo generate-data --input conversations.jsonl --kit brief --judge-model Qwen/Qwen3.5-9B --output aligned_data.jsonl slimpo web --port 7860 --share ``` ## 📚 文档 - [技术规格文档](docs/TECH_SPEC.md) - [快速入门 Notebook](examples/notebooks/01_quick_start.ipynb) - [Colab 在线体验](https://colab.research.google.com/github/xt765/SlimPo/blob/main/examples/notebooks/02_colab_demo.ipynb) ## 🔗 资源 - [SimPO 论文](https://arxiv.org/abs/2405.14734) - [OpenVINO 文档](https://docs.openvino.ai/) - [PEFT 文档](https://huggingface.co/docs/peft) - [Qwen 模型](https://github.com/QwenLM/Qwen) ## 许可证 MIT License Copyright (c) 2024 SlimPo Team Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.