feat: Full implementation of FlagOS automation framework - #17
Open
ckxud wants to merge 37 commits into
Open
Conversation
- Add skills/ (11 skill modules for automated model migration) - Add shared/ (common utilities and context template) - Add prompts/ (pipeline scripts: run_pipeline.sh, run_batch.sh) - Add docs/ (SKILLS-OVERVIEW, field_reference, project_guide) - Add CLAUDE.md project instructions - Add start_deployment.sh interactive entry point - Merge permissions into .claude/settings.local.json
feat: migrate main changes + improve pipeline robustness
主要变更: - NPU/Ascend 适配:AICore 错误诊断、graph capture 崩溃处理 - 算子名标准化:全链路大写显示名→小写函数名转换 - 健壮性增强:端口自动递增、进程活跃度探测、环境变量安全过滤 - 路径变更:/data/ → /mnt/data/ - Plugin 发布策略:不达标时私有发布 - 崩溃重试策略:不限轮次 + 多种人工定位手段 - 跨段耗时传递:stream_filter 支持 load/save durations - MetaX GPU 检测命令更新 - generate_report 新增 summary 模式和 ledger 兼容
run_batch.sh now archives previous run data before checkpoint detection, consistent with run_pipeline.sh behavior. Updated tasks.txt with new model targets. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…expand permissions - Add `< /dev/null` to all claude invocations in run_pipeline.sh to prevent stdin interference in headless mode - Add token passing documentation to seg3/seg4 prompts - Update config.py to load all tokens (HARBOR_USER/PASSWORD, MODELSCOPE_TOKEN, HF_TOKEN) from container's /flagos-workspace/.env file - Expand settings.local.json with additional curl/network permissions and standard tool permissions (Read, Edit, Write, etc.) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
所有发布统一为私有模式,达标与否仅在总结报告中注明。 移除 config.py 中从 workflow.qualified 推导 publish.private 的逻辑, 更新 SKILL.md、CLAUDE.md 和 generate_report.py 的相关描述。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…tainers Root cause: During Hunyuan-7B-Instruct seg2, Claude read task.txt listing both models, then wasted tool calls on MiniCPM4.1-8B evaluation instead of completing steps 5/6/7 for the target model. Fixes: - Add single-model constraint to seg2 prompt (forbid reading task files, forbid operating other containers, require V1+V2 before moving on) - Hide task.txt/tasks.txt/tasks1.txt during seg2 execution - Expand seg2 completion check to verify both step 4 and step 6 - Add secondary retry if step 6 still incomplete after first retry
- eval_wrapper.py: 新增 --context-yaml/--api-base,自动从 context.yaml 读取端口 - fast_gpqa.py: model_name 为空时自动探测;输出增加 _producer 签名 - run_pipeline.sh: service_ok 兜底条件扩展(status=running/flaggems_active=true) - run_pipeline.sh: 段2跳过时 SEG2_MIN/SEC/COST 兜底默认值 - run_pipeline.sh: run_eval_if_missing 直接执行评测(校验 _producer+时间戳) - prompt: 禁止内联 evalscope,强制通过 eval_wrapper.py 执行
问题:
- 发布到 ModelScope/HuggingFace 的 README 中,容器启动命令和服务启动命令使用固定模板,与实际迁移过程中使用的命令不一致
- 不同芯片(nvidia/ascend/mthreads)的命令格式不同,应该从迁移流程中获取实际成功执行的命令
修改:
1. prompts/run_pipeline.sh
- 步骤1完成后:要求 Claude 记录实际执行的 docker run 命令到 context.yaml commands.container_run
- 步骤3完成后:要求 Claude 记录实际执行的 vllm serve 命令到 context.yaml commands.serve_start
2. skills/flagos-release/tools/src/config.py
- load_config_from_context() 优先从 context.commands 读取实际命令
- container_run_cmd: 替换镜像为 {{IMAGE}} 占位符,替换模型挂载为 -v /data:/data,移除 workspace 挂载
- serve_start_cmd: 替换模型路径为 /data/<flagrelease_name>,替换端口为 8000
- serve_infer_cmd: 使用实际模型短名替代硬编码的 "flagOS"
- 回退逻辑: commands 字段不存在时使用简化模板
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
低吞吐芯片上单题推理可能超过 5 分钟,原逻辑会误判为卡死。 现在 stall timeout 触发时先检查服务是否存活(进程 + /v1/models API), 服务正常则重置计时器继续等待,服务无响应才终止进程。
- model_short 改为从 config.model_info.source_of_model_weights 获取 - existing_harbor_image 存在时优先作为 image_target_tag,避免重新生成时间戳
超时后发送 SIGTERM,60 秒内未退出则 SIGKILL,记录为 timeout 状态并跳到下一个模型。
第399行和第471行的 update_context.py --set commands.serve_start 示例中, bash -c "..." 的内层双引号提前关闭了外层 PROMPT_SEG1="...", 导致后续文本被 shell 当作命令执行,触发 set -e 退出。
- 所有 segment --max-turns 提升到 500,防止慢机器步骤截断 - SKILL.md 服务启动示例对齐 start_service.sh - wait_for_service.sh 失败退出前清理 Triton/FlagGems 编译缓存 - seg2 结束后增加 step7 补充检查兜底
- 段4开始前保存 SEG3_HARBOR_IMAGE(步骤8已推送的镜像地址) - 兜底 Harbor 判定:crash_stopped=true 时跳过重新 commit - MS/HF 兜底前恢复 registry_url 为步骤8原始镜像
修复两个 bug: 1. 性能对比区域增加 V3/V1 optimized ratio 显示(从 context.perf.optimized_ratio_pct 读取) 2. ratio 转换阈值从 < 1 改为 < 2,修复 1.004 被显示为 1.0% 的问题(应为 100.4%) 影响范围: - 文本报告性能对比区域(lines 619-629) - JSON 报告 performance 字段(line 1009) - 算子搜索日志显示(5 处 ratio 转换逻辑) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- setup_workspace.sh: 工作空间部署修复 - SKILL.md: 综合评测文档更新 - persist_tuning_checkpoint.py: 新增调优检查点持久化工具 - diagnose_failure.py: 日志分析诊断修复 - operator_search.py: 算子搜索修复 - publish.py: 发布阶段修复 - start_service.sh / wait_for_service.sh: 服务启动修复 - tasks.txt: 任务更新
优先使用 huggingface.co,不可用时自动切换 hf-mirror.com。 用户通过 HF_ENDPOINT 环境变量指定时只用指定地址。
- 新增 flagos-offline-inference skill(离线推理/模型适配) - 新增 upload_to_platform.py 平台上传工具 - run_pipeline.sh 支持 --flagrelease-token 参数,退出时自动上传结果 - CLAUDE.md 路由表新增离线推理入口 - 新增 optimization_metrics_report.md 文档
P0: operator_search ratio计算修复、performance_ok/accuracy_ok写入校验、service_ok自动写入 P1: 启动前无条件清缓存、GPU清理docker restart降级、thinking model检测增强、Hygon DCU支持、Plugin禁止调优 P2: eval_wrapper端口注入、thinking model超时加倍、崩溃恢复必须提issue
- 引入 canonical_model_path 作为下载/挂载/serve 的统一路径 - serve_start_cmd 用正则替换 vllm serve 后的路径参数,不再依赖 container_path 字符串匹配 - container_run_cmd 确保 -v /data:/data 挂载存在 - README 模板和 builtin 模板统一使用 canonical_model_path - _prepare_template_vars 增加一致性校验,不一致时自动修正并输出警告
|
Gwendolyngily seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Merge the full implementation of the FlagOS automated migration and release framework into 0.1.0-rc2.
Main Changes
Testing