Skip to content

[Cherry-Pick][Loader] Add values natural order check to layers grouped validation#7822

Open
bukejiyu wants to merge 1 commit into
PaddlePaddle:release/online/20260415from
bukejiyu:cp/47a3cff6-add-values-check
Open

[Cherry-Pick][Loader] Add values natural order check to layers grouped validation#7822
bukejiyu wants to merge 1 commit into
PaddlePaddle:release/online/20260415from
bukejiyu:cp/47a3cff6-add-values-check

Conversation

@bukejiyu
Copy link
Copy Markdown
Collaborator

@bukejiyu bukejiyu commented May 14, 2026

Motivation

💡 If this PR is a Cherry Pick, the PR title needs to follow the format by adding the [Cherry-Pick] label at the very beginning and appending the original PR ID at the end. For example, [Cherry-Pick][CI] Add check trigger and logic(#5191)

💡 如若此PR是Cherry Pick,PR标题需遵循格式,在最开始加上[Cherry-Pick]标签,以及最后面加上原PR ID,例如[Cherry-Pick][CI] Add check trigger and logic(#5191)

Modifications

Usage or Command

Accuracy Tests

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented May 14, 2026

Thanks for your contribution!

@bukejiyu bukejiyu changed the title Add values natural order check to layers grouped validation [Cherry-Pick][Loader] Add values natural order check to layers grouped validation May 14, 2026
Copy link
Copy Markdown

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Paddle-CI-Agent | pr_review | 2026-05-14 20:28:35

📋 Review 摘要

PR 概述:在 get_all_weights_file 中新增 values 自然序校验,确保 is_layers_are_grouped 标志同时满足 keys 分组和 values 自然序两个条件。
变更范围fastdeploy/model_executor/load_weight_utils.py
影响面 Tag[Loader]

📝 PR 规范检查

PR 存在两处不合规:① Cherry-Pick 标题缺少原始 PR 编号;② Motivation/Modifications 等描述章节内容为空。

标题建议(可直接复制):

  • [Cherry-Pick][Loader] Add values natural order check to layers grouped validation(#原PR号)

PR 描述建议(可直接复制,必须复刻 checklist §D2 模板的完整结构):

## Motivation`weight_map` 的 values(safetensors 分片文件名)不满足自然序时,`layers_are_grouped` 仅检查 keys 分组而不检查文件名顺序,可能导致在不应使用逐文件迭代器的场景下误用 `safetensors_weights_iterator`,从而引发权重加载顺序错误。本次变更在 layers 分组检查之外,增加对 values 自然序的校验。

## Modifications
- 新增 `values_are_naturally_ordered(values)` 函数(`load_weight_utils.py`):检查 weight_map 的 values 列表是否满足自然序
- 修改 `get_all_weights_file` 函数中多文件 safetensors 分支:将 `is_layers_are_grouped` 改为 `is_keys_grouped AND is_values_naturally_ordered` 的联合判断

## Usage or Command
N/A

## Accuracy Tests
N/A

## Checklist

- [x] Add at least a tag in the PR title.
  - Tag list: [`[FDConfig]`,`[APIServer]`,`[Engine]`, `[Scheduler]`, `[PD Disaggregation]`, `[Executor]`, `[Graph Optimization]`, `[Speculative Decoding]`, `[RL]`, `[Models]`, `[Quantization]`, `[Loader]`, `[OP]`, `[KVCache]`, `[DataProcessor]`, `[BugFix]`, `[Docs]`, `[CI]`, `[Optimization]`, `[Feature]`, `[Benchmark]`, `[Others]`, `[XPU]`, `[HPU]`, `[GCU]`, `[DCU]`, `[Iluvatar]`, `[Metax]`]
  - You can add new tags based on the PR content, but the semantics must be clear.
- [ ] Format your code, run `pre-commit` before commit.
- [ ] Add unit tests. Please write the reason in this PR if no unit tests.
- [ ] Provide accuracy results.
- [x] If the current PR is submitting to the `release` branch, make sure the PR has been submitted to the `develop` branch, then cherry-pick it to the `release` branch with the `[Cherry-Pick]` PR tag.

问题

级别 文件 概述
❓ 疑问 fastdeploy/model_executor/load_weight_utils.py:541 变量名 is_keys_orderslayers_are_grouped 函数语义不匹配,建议改为 is_keys_grouped

总体评价

逻辑变更合理,补充了文件名自然序校验,提升了分组判断的健壮性。建议补充 PR 描述信息并修正 Cherry-Pick 标题格式(需补充原始 PR 编号)。

keys = list(weight_map.keys())
is_layers_are_grouped = layers_are_grouped(keys)
values = list(weight_map.values())
is_keys_orders = layers_are_grouped(keys)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ 疑问 变量名 is_keys_orders 语义略显模糊,与 layers_are_grouped 函数名所表达的"分组"含义不一致。

建议改为 is_keys_grouped 与函数名保持一致:

is_keys_grouped = layers_are_grouped(keys)
is_values_naturally_ordered = values_are_naturally_ordered(values)
is_layers_are_grouped = is_keys_grouped and is_values_naturally_ordered

@PaddlePaddle-bot
Copy link
Copy Markdown

🤖 Paddle-CI-Agent | ci_status_monitor | 2026-05-14 20:40:08

CI报告基于以下代码生成(30分钟更新一次):


1 任务总览

⏳ CI 进行中,Required 任务尚未完成(1个运行中,1个等待中),请等待结果。

总执行(rerun次数) 总任务 ✅ 通过 ❌ 失败 ⏳ 运行中 ⏸️ 等待中 跳过
17(0) 17 12 1 3 1 0

2 任务状态汇总

2.1 Required任务 : 0/2 通过

必选任务阻塞合并,失败需优先处理。

状态 任务 耗时 根因 修复建议 日志 重跑
xpu_8cards_case_test / run_xpu_8cards_cases - 运行中 - Job -
⏸️ xpu_4cards_case_test / run_xpu_4cards_cases - 等待中 - - -

2.2 可选任务 — 12/15 通过

可选任务不阻塞合并,失败仅供参考。

状态 任务 耗时 日志 重跑
Trigger Jenkins for PR 8m55s Job -
FD-Build-Linux / fd-build - Job -
Run iluvatar Tests / run_iluvatar_cases - Job -
其余 12 个可选任务通过 - - -

3 失败详情(仅 required)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants