已合并
test(distributed):add test for validate_checkpoint_id, reset, set_up_storage_reader from BroadcastingTorchSaveReader #33733
xh-zhan创建于 4月14日
test(distributed):add test for validate_checkpoint_id, reset, set_up_storage_reader from BroadcastingTorchSaveReader #33733
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 xh-zhan 的贡献)4月14日 关联了issue:[API一致性] BroadcastingTorchSaveReader的下三个API:validate_checkpoint_id、reset、set_up_storage_reader无需NPU适配
4月14日 关联了issue:[API一致性] BroadcastingTorchSaveReader的下三个API:validate_checkpoint_id、reset、set_up_storage_reader无需NPU适配
ascend-robot
4月14日 评论:
4月14日 评论:
ascend-robot
4月14日 评论:
4月14日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| test | ✅ 李伟, yuhaiyan (2/2) | ✅ 李伟 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
xh-zhan, thanks for your pull request. All authors of the commits have signed the CLA. 👍


4月14日 添加了label:ascend-cla/no
此处折叠了50条消息 查看更多
4月17日 添加了label:approvedlgtm
ascend-robot
4月17日 评论:
4月17日 评论:
4月17日 合入了pull request
ascend-robot
4月17日 评论:
4月17日 评论:
/kind feature
What does this PR do / why do we need it:
本次 PR 为
BroadcastingTorchSaveReader类中的三个核心 API 新增了单元测试用例,以确保其在torch_npu环境下的行为与 PyTorch 原生行为保持一致。测试用例路径:
test/distributed/checkpoint/test_broadcasting_reader.pyAPI 功能说明:
torch.distributed.checkpoint.format_utils.BroadcastingTorchSaveReader.validate_checkpoint_id:纯逻辑 API,用于检查给定的 checkpoint 文件路径是否存在。torch.distributed.checkpoint.format_utils.BroadcastingTorchSaveReader.reset:纯逻辑 API,用于重置BroadcastingTorchSaveReader实例的checkpoint_id属性,支持更新为新的路径或None。torch.distributed.checkpoint.format_utils.BroadcastingTorchSaveReader.set_up_storage_reader:用于设置存储读取器的元数据及协调者(coordinator)状态。包含协调者身份校验和checkpoint_id非空检查。用例完备性说明:
由于Pytorch社区无上述三个API的测试用例,故本次PR新增用例
test_broadcasting_reader.py。本次提交的测试用例覆盖了以下场景,确保 API 的健壮性:validate_checkpoint_id:TrueFalsereset:checkpoint_id正确变更None→checkpoint_id正确变更为Noneset_up_storage_reader:is_coordinator属性AssertionErrorcheckpoint_id为None时抛出AssertionError适配方案:
经分析,这三个 API 均为纯 Python 逻辑,不依赖任何 NPU 特定算子或硬件特性。本次提交 无需对 API 本身进行任何代码适配,仅增加单元测试以完成 NPU 环境下的兼容性验证。
Which issue(s) this PR fixes:
Fixes #1680
Special notes for your reviewers:
test/distributed/checkpoint/test_broadcasting_reader.pyRan 7 tests in 0.011s
OK
torch-npu仓库规范(test_开头 + 核心关键词),文件内添加了完整 API 名称和测试维度注释,便于后续检索和维护。v2.6.0,v2.7.1,v2.8.0,v2.9.0,v2.10.0,v2.11.0,master(根据赛事文档要求)。