| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
skip ci failed testcase Co-authored-by: XianglongZeng<zengxianglong1@huawei.com> # message auto-generated for no-merge-commit merge: !36279 merge master into master skip ci failed testcase Created-by: probiotics_53 Commit-by: XianglongZeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 https://gitcode.com/Ascend/op-plugin/pull/4958合入受阻,下掉一批与此次修改无关的门禁失败用例: ## 1. _afd/test_attention_worker_schedule File "/workspace/CODE/pytorch_ut/test/_afd/test_attention_worker_schedule.py", line 4, in <module> import torchair ModuleNotFoundError: No module named 'torchair' [ERROR] ERR99999 UNKNOWN applicaiton exception ## 2. _afd/test_ffn_worker_schedule 同上:ModuleNotFoundError: No module named 'torchair' + ERR99999 UNKNOWN ## 3. custom_ops/test_npu_multi_head_attention File "/workspace/CODE/pytorch_ut/test/custom_ops/test_npu_multi_head_attention.py", line 98 self.assertRtolEqual(cpu_result, npu_result) AssertionError: result error 精度比较失败(NPU 和 CPU 计算结果差异超阈值)。 ## 4. distributed/pipelining/test_schedule(2 个 error) ERROR [0.288s]: test_grad_with_split_b_w schedule._load_actions(...) AttributeError: '_PipelineScheduleRuntime' object has no attribute '_load_actions' ERROR [0.058s]: test_grad_with_v_schedule torch.distributed.init_process_group(...) _PipelineScheduleRuntime API 缺失 _load_actions 方法,distributed 接口不兼容。 ## 5. nn/test_module_hooks File "/workspace/CODE/pytorch_ut/test/nn/test_module_hooks.py", line 1487 with self.assertRaisesRegex(RuntimeError, "Output 0 of BackwardHookFunctionBackward is " AssertionError: expected: "Output 0 of BackwardHookFunctionBackward is a view..." got: "Output 0 of BackwardHookFunction is a view..." PyTorch 报错信息中类名变更(BackwardHookFunctionBackward → BackwardHookFunction),正则匹配失败。 ## 6. test_multiprocessing_api File "/workspace/CODE/pytorch_ut/test/test_multiprocessing_api.py", line 215 self.assertTrue(torch.equal(npu_tensor.cpu(), reconstructed_npu.cpu())) AssertionError: False is not true 多进程 tensor 序列化/反序列化后数据不一致。 ## 7. test_ops _complex(3 个 error,同一根因) RuntimeError: _index_put_impl_:IndexPutKernelNpuOpApi.cpp:82 call aclnnIndexPutImpl failed, error code is 161002 AclNN_Parameter_Error(EZ1001): Tensor self not implemented for DT_COMPLEX64, should be in dtype support list [DT_FLOAT, DT_INT32, DT_INT64, ...] ACL 底层 aclnnIndexPutImpl 不支持 complex64/complex128 数据类型。 ## 总结 | # | 测试 | 根因 | 与 0d CPU tensor 修改关系 | |---|------|------|:--:| | 1 | attention_worker_schedule | 环境缺 torchair 包 | 无关 | | 2 | ffn_worker_schedule | 环境缺 torchair 包 | 无关 | | 3 | multi_head_attention | 精度差异 | 无关 | | 4 | test_schedule | distributed API _load_actions 缺失 | 无关 | | 5 | module_hooks | PyTorch 错误消息类名变更 | 无关 | | 6 | multiprocessing_api | 多进程 tensor 序列化不一致 | 无关 | | 7 | test_ops _complex | ACL 不支持 complex dtype | 无关 | https://gitcode.com/Ascend/op-plugin/pull/4958 涉及的 15 个 test_base_ops/ 测试全部 **success**。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36279 | 3 个月前 | |
【fix】batcnnorm_check_fix Co-authored-by: 1479518308<cuiduo1@huawei.com> # message auto-generated for no-merge-commit merge: !36325 merge master into master 【fix】batcnnorm_check_fix Created-by: cuiduo Commit-by: 1479518308 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 为batcnnorm修改校验位置,适配NestedTensor以对其社区 # 【资料变更】 > 不涉及 # 【接口变更】 > 不涉及 # 【功能验证】 > 本地验证pass # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36325 | 3 个月前 | |
skip ci failed testcase Co-authored-by: XianglongZeng<zengxianglong1@huawei.com> # message auto-generated for no-merge-commit merge: !36488 merge master into master skip ci failed testcase Created-by: probiotics_53 Commit-by: XianglongZeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 ### 1. allocator/test_pluggable_allocator_extensions.py — TestPluggableAllocator.setUpClass **报错日志:** acl.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. acl_op_compiler.cpp:1:10: fatal error: acl/acl_op_compiler.h: No such file or directory 1 | #include "acl/acl_op_compiler.h" | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. acl_tdt.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. In file included from pluggable_allocator_extensions.cpp:5: torch_npu/include/third_party/acl/inc/acl/acl_base.h:14:10: fatal error: acl/acl_base_rt.h: No such file or directory 14 | #include "acl/acl_base_rt.h" | ^~~~~~~~~~~~~~~~~~~ subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '16']' returned non-zero exit status 1. RuntimeError: Error building extension 'pluggable_allocator_extensions' **报错原因:** CI 环境缺少 ACL 开发头文件(acl/acl_base_rt.h、acl/acl.h、acl/acl_op_compiler.h),导致 setUpClass 中 JIT 编译 C++ 扩展 pluggable_allocator_extensions 失败。与 0D tensor 修改**无关**。 **跳过方式:** 在 TestPluggableAllocator 类上添加 @unittest.skip 装饰器。 --- ### 2. test_npu_expandable_segments.py — TestPluggableAllocator.setUpClass **报错日志:** acl.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. acl_op_compiler.cpp:1:10: fatal error: acl/acl_op_compiler.h: No such file or directory 1 | #include "acl/acl_op_compiler.h" | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. acl_tdt.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. In file included from pluggable_allocator_extensions.cpp:5: torch_npu/include/third_party/acl/inc/acl/acl_base.h:14:10: fatal error: acl/acl_base_rt.h: No such file or directory 14 | #include "acl/acl_base_rt.h" | ^~~~~~~~~~~~~~~~~~~ subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '16']' returned non-zero exit status 1. RuntimeError: Error building extension 'pluggable_allocator_extensions' **报错原因:** 与用例 1 完全相同,CI 环境缺少 ACL 头文件,JIT 编译失败。与 0D tensor 修改**无关**。 **跳过方式:** 在 TestPluggableAllocator 类上添加 @unittest.skip 装饰器。 --- ### 3. test_sanitizer_pluggable_allocator.py — TestSanitizerPluggableAllocator.setUpClass **报错日志:** acl.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. acl_op_compiler.cpp:1:10: fatal error: acl/acl_op_compiler.h: No such file or directory 1 | #include "acl/acl_op_compiler.h" | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. acl_tdt.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. In file included from pluggable_allocator_extensions.cpp:5: torch_npu/include/third_party/acl/inc/acl/acl_base.h:14:10: fatal error: acl/acl_base_rt.h: No such file or directory 14 | #include "acl/acl_base_rt.h" | ^~~~~~~~~~~~~~~~~~~ subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '16']' returned non-zero exit status 1. RuntimeError: Error building extension 'sanitizer_pluggable_allocator_extensions' **报错原因:** 与用例 1、2 完全相同,CI 环境缺少 ACL 头文件,JIT 编译失败。与 0D tensor 修改**无关**。 **跳过方式:** 在 TestSanitizerPluggableAllocator 类上添加 @unittest.skip 装饰器。 ### 4. distributed/pipelining/test_schedule_multiproc.py — CustomSchedulesTest + ScheduleTest **报错日志(CustomSchedulesTest):** RuntimeError: Exception in worker process: ... File "test_schedule_multiproc.py", line 939, in test_non_symmetric_stage_ids out = schedule.step(x, target=target, losses=losses) File "schedules.py", line 1554, in step self._step_microbatches(...) File "schedules.py", line 1579, in _step_microbatches self._initialize_stages(arg_mbs[0], kwarg_mbs[0]) File "schedules.py", line 1461, in _initialize_stages _wait_batch_p2p(_batch_p2p(all_ops)) File "schedules.py", line 490, in _batch_p2p return dist.batch_isend_irecv(p2p_ops) File "torch_npu/distributed/distributed_c10d.py", line 119, in _batch_isend_irecv p2p_op.op( File "distributed_c10d.py", line 2419, in isend return group.send([tensor], group_dst, tag) RuntimeError: create_config:../torch_npu/csrc/distributed/HCCLUtils.cpp:140 HCCL function error: hcclCommInitRootInfoConfig(...), error code is 1 [ERROR] ERR02200 DIST call hccl api failed. [PID: 38352] Communication_Error_Ranktable_Detect(EI0015): Failed to collect cluster information of the communicator based on rootInfo detection. Reason: No rank in the communicator can connect to the root node within the timeout period. List of unconnected ranks: "[1,]". **报错日志(ScheduleTest):** RuntimeError: Exception in worker process: ... File "test_schedule_multiproc.py", line 388, in test_eval_inference_mode schedule.eval(x) File "schedules.py", line 400, in eval return self.step(*args, target=target, losses=losses, **kwargs) ... RuntimeError: create_config:../torch_npu/csrc/distributed/HCCLUtils.cpp:140 HCCL function error: hcclCommInitRootInfoConfig(...), error code is 1 [ERROR] ERR02200 DIST call hccl api failed. [PID: 38939] Communication_Error_Ranktable_Detect(EI0015): Failed to collect cluster information of the communicator based on rootInfo detection. Reason: No rank in the communicator can connect to the root node within the timeout period. List of unconnected ranks: "[1,2,3,]". **报错原因:** HCCL 分布式通信初始化失败(hcclCommInitRootInfoConfig 返回 error code 1),rank 节点无法在超时时间内连接到 root 节点。这是 CI 环境的网络/HCCL 配置问题,与 0D tensor 修改**无关**。 **跳过方式:** 在 ScheduleTest 类上添加 @unittest.skip 装饰器。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36488 | 3 个月前 | |
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35539 merge code_check_lintrunner into master fix: lintrunner --all-files --take NEWLINE -a Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 文件必须以 LF 换行符结尾,不允许 CRLF(DOS 换行),执行: lintrunner --all-files --take NEWLINE -a # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35539 | 3 个月前 | |
| 2 年前 | ||
[Feature] transfer_to_npu adapt cuda_default_generators Co-authored-by: l30044004<louyujing@huawei.com> # message auto-generated for no-merge-commit merge: !34215 merge master into master [Feature] transfer_to_npu adapt cuda_default_generators Created-by: louyujing Commit-by: l30044004 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> https://gitcode.com/Ascend/pytorch/issues/1789 - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) torch.cuda.default_generators在NPU上需要迁移为torch_npu.npu.default_generators,且必须是设备init完成之后 使用torch_npu.npu._lazy_call的方式,在设备init完成之后,才使patch生效 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!34215 | 4 个月前 | |
[Feature]rename head file and add cmake for libtorch_npu | 2 年前 | |
feat support device parameters for aoti test Co-authored-by: huangyunlong2022<huangyunlong4@h-partners.com> # message auto-generated for no-merge-commit merge: !36118 merge 2.13shim_td into master feat support device parameters for aoti test Created-by: huangyunlong2022 Commit-by: huangyunlong2022 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 包含device的算子用例支持传device # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36118 | 3 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
test(distributed): add test for EtcdStore APIs Co-authored-by: zf_zhang<sjzz0306@outlook.com> # message auto-generated for no-merge-commit merge: !34909 merge test-elastic-etcdstore-pytorch-master into master test(distributed): add test for EtcdStore APIs Created-by: zf_zhang Commit-by: zf_zhang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**https://gitcode.com/Ascend/pytorch/issues/1676?ref=&did=3850294#tid-3850294**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 用例设计原则 本次验证结合官方用例复用与自定义用例补充的方式,遵循 “最小化、核心化、针对性” 原则,核心思路为: * 补充缺失用例:针对torch.distributed.elastic.rendezvous.etcd_store.EtcdStore;torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.set;torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.get;torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.add;torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.wait;torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.check等六个API的缺失用例,以及torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.set_timeout和集成场景设置,我们设计了精简且详细的测试用例,覆盖了EtcdStore类的所有核心功能 * 聚焦核心功能:我们验证了这些 API 的基础操作以及功能,确保结果反映 API 本身适配状态; * 轻量化设计:单个测试方法仅验证一个核心功能点,逻辑清晰、执行高效,便于问题定位。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 * torch.distributed.elastic.rendezvous.etcd_store.EtcdStore: 我们围绕EtcdStore的连接可靠性、前缀规范化及超时机制,设计了基于真实 etcd 环境的初始化与行为一致性测试用例。 * torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.set 和 torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.get: 我们围绕EtcdStore对不同数据类型的兼容性、覆写语义、异常处理、特殊字符支持及阻塞/超时行为,设计了全面验证 set/get 正确性与并发语义的测试用例。 * torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.add: 我们围绕EtcdStore.add的初始化与累加语义、相减与幂等性、以及高并发场景下的原子性与一致性,设计了覆盖功能正确性与并发安全性的 add 测试用例。 * torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.wait: 我们针对 EtcdStore.wait,设计了多线程延迟写入验证正常阻塞返回、全局与覆盖超时触发异常、以及部分 key 存在时超时失败的测试用例。 * torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.check: 我们针对 EtcdStore.check,设计了覆盖key的全部存在、部分存在、全部不存在、空列表边界及单个key 场景的非阻塞检查行为测试用例。 * torch.distributed.elastic.rendezvous.etcd_store.EtcdStore.check: 我们针对 EtcdStore.set_timeout,设计了验证默认超时生效、零超时立即返回以及对 get 和 wait 行为产生影响的测试用例。 此外,我们还针对 EtcdStore 集成场景,设计了多节点并发 rendezvous 协调流程与高并发混合操作压力测试,验证其同步一致性与稳定性。 * 用例合理性说明:自定义用例虽简洁,但具备充分有效性与合理性。 * 自定义用例精准补全:EtcdStore自定义用例聚焦无官方用例覆盖的所有核心功能,贴合实际业务使用方式,验证结果具备业务参考价值; * 适配操作最小化:只对EtcdStore类的核心功能进行验证。 * 符合官方规范:自定义用例基于 PyTorch 官方测试框架开发,使用原生断言方法,与官方用例测试标准保持一致;  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [ ] 代码注释完备,正确记录错误日志 - [ ] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!34909 | 3 个月前 | |
[fix] dynamo原生支持record_stream | 3 个月前 | |
| 2 年前 | ||
| 1 年前 | ||
[api] add symbolic_shapes compatibility coverage Co-authored-by: baoxuebin_2026<xuebin@isrc.iscas.ac.cn> # message auto-generated for no-merge-commit merge: !35685 merge codex/symbolic-shapes-api-master-r2 into master [api] add symbolic_shapes compatibility coverage Created-by: baoxuebin_2026 Commit-by: baoxuebin_2026 Merged-by: ascend-robot Description: # 【合入来源】 > [#1612](https://gitcode.com/Ascend/pytorch/issues/1612) - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 公开issue:暂无单独公开 issue 链接,本次提交对应 torch.fx.experimental.symbolic_shapes 相关 API 测试补齐任务。 # 【修改背景】 本次任务聚焦 torch.fx.experimental.symbolic_shapes 相关接口的测试补齐与行为验证。 结合目标分支实际情况核查后发现,不同版本间 symbolic_shapes 模块存在一定差异。为保证测试内容与目标分支当前实际能力一致,本次 PR 仅补充可在目标版本稳定验证的以下能力: - symbolic_shapes.DimConstraints.add - symbolic_shapes.DimConstraints.add_equality 本次任务范围为 test/ 目录下测试用例开发与验证,不涉及 torch_npu/ 目录下实现逻辑修改。 # 【资料支持情况核查】 已结合配套资料补齐任务,对 torch.fx 相关资料声明进行了同步核查。 核查结论: 1. symbolic_shapes 相关内容需要结合目标版本实际能力进行说明。 2. 本测试 PR 仅负责补齐用例与行为验证,资料补齐由配套资料 PR 单独提交。 3. 本次 PR 的测试范围已与当前代码实际可验证能力保持一致,避免“资料声明”和“测试验证”口径不一致。 # 【修改方案】 1. 新增测试文件 test/fx/test_symbolic_shapes_api.py: - 文件顶部补充了用途说明,明确该文件用于承载 torch.fx.experimental.symbolic_shapes 同类 API 的兼容性验证; - 该文件按同类 API 归并设计,便于后续继续扩展 symbolic_shapes 相关测试; - 当前覆盖: - DimConstraints.add - DimConstraints.add_equality 2. 本次采用最小化修改方案: - 仅新增 test/ 下测试文件; - 不修改 torch_npu/ 目录下代码; - 不引入与本次任务无关的功能改动。 # 【测试文件说明】 本次新增 test/fx/test_symbolic_shapes_api.py,原因如下: 1. 该文件面向 torch.fx.experimental.symbolic_shapes 同类接口,便于后续持续扩展,不将同主题 API 分散到多个无关文件中。 2. 文件顶部已增加用途说明,明确其验证范围、分组原则和可扩展性。 3. 当前修改属于“新增测试用例文件”,已按 reviewer 要求补充文件说明,保证后续可维护性。 # 【资料变更】 测试 PR 本身不直接修改资料文件;资料补齐由配套资料 PR 单独提交。 本 PR 仅负责测试补齐与验证,确保测试范围与当前版本实际能力一致。 # 【接口变更】 不涉及。 未修改用户可见接口,也未修改跨仓接口行为。 # 【功能验证】 验证场景: 1. DimConstraints.add 对 trivial / univariate / multivariate 场景验证 2. DimConstraints.add_equality 对 static / symbolic 场景验证 测试方法: bash cd /data/pytorch TORCH_DEVICE_BACKEND_AUTOLOAD=1 python3.11 test/fx/test_symbolic_shapes_api.py -v  See merge request: Ascend/pytorch!35685 | 3 个月前 | |
test(jit):add test for ScriptFunction,ScriptFunction.get_debug_state,ScriptFunction.save,and ScriptFunction.save_to_buffer Co-authored-by: fengwu154<1067935138@qq.com> # message auto-generated for no-merge-commit merge: !35412 merge test-torch-jit-ScriptFunction-master into master test(jit):add test for ScriptFunction,ScriptFunction.get_debug_state,ScriptFunction.save,and ScriptFunction.save_to_buffer Created-by: fengwu154 Commit-by: fengwu154 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 https://gitcode.com/Ascend/pytorch/issues/1904 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 1. ** get_debug_state 适配** - 使用 PyTorch 内置的 enable_profiling_mode_for_profiling_tests() 上下文强制启用 profiling executor。 - 执行两次函数(一次 profile,一次 optimize),确保优化计划生成。 - 通过 GRAPH_EXECUTOR 常量判断执行器模式,非 profiling 模式自动跳过测试。 2. **save 适配** - API 签名仅接受字符串路径,因此使用 tempfile.TemporaryDirectory 创建临时文件,避免对文件系统的污染。 3. **save_to_buffer 适配** - 验证返回类型为 bytes,并通过 io.BytesIO 模拟文件流加载,与保存前输出一致。 - **原测试缺口**:test_jit.py 虽大量使用 ScriptFunction,但缺少对其类型、save_to_buffer 及 save 直接路径的专门测试;get_debug_state 仅在特定测试中偶现调用,未系统验证。 - **新增覆盖**: - 类型断言:确保 @torch.jit.script 生成的函数为 torch.jit.ScriptFunction 实例。 - 调试状态:验证在 profiling 模式下两次执行后可获得有效状态对象。 - 序列化闭环:通过 save_to_buffer → load 和 save(file) → load 验证序列化后语义等价。 - **边界适配**:get_debug_state 通过 @unittest.skipIf(GRAPH_EXECUTOR != ProfilingMode.PROFILING, ...) 仅在有 profiling 执行器的环境中运行,避免内部断言错误。 - 新增测试文件 test/jit/test_jit_ScriptFunction.py。 - 实现 4 个测试用例,覆盖 ScriptFunction 类型、调试状态获取、内存序列化与文件序列化。 - 使用条件跳过(@unittest.skipIf)适配不同执行器模式(profiling / simple / legacy)。 - 不依赖外部文件,所有测试可在任意环境运行。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 root@devserver-fae-mirrors:/home/aicc/wf/api/2.7.1/pytorch/test# python test_jit_ScriptFunction.py .... ---------------------------------------------------------------------- Ran 4 tests in 10.120s OK 覆盖版本: v2.7.1 v2.9.0 v2.10.0 v2.11.0 v2.12.0 master # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35412 | 3 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
[bugfix][master]fix aclgraph testcase Co-authored-by: y30062407<handsome0324@163.com> # message auto-generated for no-merge-commit merge: !36473 merge master_wtd into master [bugfix][master]fix aclgraph testcase Created-by: yangch0324 Commit-by: y30062407 Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 **问题根因:** test_npu_fused_infer_attention_score_v2 测试用例中,softmax_lse 输出张量的预分配 shape 与算子实际输出 shape 不匹配。 具体而言: - 测试代码中 softmax_lse 被硬编码分配为 torch.empty(1, dtype=torch.float16, device="npu"),shape 为 (1,) - 但 npu_fused_infer_attention_score_v2 在 return_softmax_lse=False 时,算子实际返回的 softmax_lse shape 为 (0,)(空张量,因为不需要计算 softmax LSE) - 执行 self.assertEqual(softmax_lse.cpu(), res_src[1].cpu()) 时,assertEqual 先比较 shape,发现 torch.Size([1]) != torch.Size([0]),导致断言失败 **对比 v1 的正确做法:** v1 测试(如 test_ifa_update)使用 torch.empty_like(res_src[1], dtype=torch.float16, device="npu") 来分配 softmax_lse,自动匹配 res_src[1] 的实际 shape,不存在此问题。 **修改内容:** 将 v2 相关测试中所有硬编码的 torch.empty(1, ...) 改为 torch.empty_like(res_src[1], ...),与 v1 做法保持一致,共涉及 4 处: 1. test_npu_fused_infer_attention_score_v2(第228行):torch.empty(1,...) → torch.empty_like(res_src[1],...) 2. test_ifa_v2_update_with_auto_dispatch_capture(第163行):torch.empty(1,...) → torch.empty_like(res_src[1],...) 3. test_ifa_v2_update_with_non_out_and_auto_dispatch_capture(第192行):torch.empty(1,...) → torch.empty_like(res_src[1],...) 4. test_npu_fused_infer_attention_score_v2_no_reset(第408行):torch.empty(1,...) → torch.empty_like(res_src[1],...) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 **测试场景:** NPU ACL Graph Update 相关测试用例 **测试方法:** 执行修改后的测试用例,验证 softmax_lse 的 shape 与 res_src[1] 一致,断言不再报错 bash pytest test/npu/test_aclgraph_update.py::TestIFAAclgraphUpdate::test_npu_fused_infer_attention_score_v2 -v **验证点:** - test_npu_fused_infer_attention_score_v2:return_softmax_lse=False 时 softmax_lse shape 为 (0,),与 res_src[1] 一致,断言通过 - test_ifa_v2_update_with_auto_dispatch_capture:同上 - test_ifa_v2_update_with_non_out_and_auto_dispatch_capture:同上 - test_npu_fused_infer_attention_score_v2_no_reset:同上(当前被 skip,取消 skip 后也应通过)  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36473 | 3 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
AI assist developer for python dt master Co-authored-by: aksksks<mengzichao@h-partners.com> # message auto-generated for no-merge-commit merge: !26538 merge master into master AI assist developer for python dt master Created-by: aksksks Commit-by: aksksks Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > > /kind bug > /kind task > /kind feature **What does this PR do / why do we need it**: **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!26538 | 9 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
skip ci failed testcase Co-authored-by: XianglongZeng<zengxianglong1@huawei.com> # message auto-generated for no-merge-commit merge: !36279 merge master into master skip ci failed testcase Created-by: probiotics_53 Commit-by: XianglongZeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 https://gitcode.com/Ascend/op-plugin/pull/4958合入受阻,下掉一批与此次修改无关的门禁失败用例: ## 1. _afd/test_attention_worker_schedule File "/workspace/CODE/pytorch_ut/test/_afd/test_attention_worker_schedule.py", line 4, in <module> import torchair ModuleNotFoundError: No module named 'torchair' [ERROR] ERR99999 UNKNOWN applicaiton exception ## 2. _afd/test_ffn_worker_schedule 同上:ModuleNotFoundError: No module named 'torchair' + ERR99999 UNKNOWN ## 3. custom_ops/test_npu_multi_head_attention File "/workspace/CODE/pytorch_ut/test/custom_ops/test_npu_multi_head_attention.py", line 98 self.assertRtolEqual(cpu_result, npu_result) AssertionError: result error 精度比较失败(NPU 和 CPU 计算结果差异超阈值)。 ## 4. distributed/pipelining/test_schedule(2 个 error) ERROR [0.288s]: test_grad_with_split_b_w schedule._load_actions(...) AttributeError: '_PipelineScheduleRuntime' object has no attribute '_load_actions' ERROR [0.058s]: test_grad_with_v_schedule torch.distributed.init_process_group(...) _PipelineScheduleRuntime API 缺失 _load_actions 方法,distributed 接口不兼容。 ## 5. nn/test_module_hooks File "/workspace/CODE/pytorch_ut/test/nn/test_module_hooks.py", line 1487 with self.assertRaisesRegex(RuntimeError, "Output 0 of BackwardHookFunctionBackward is " AssertionError: expected: "Output 0 of BackwardHookFunctionBackward is a view..." got: "Output 0 of BackwardHookFunction is a view..." PyTorch 报错信息中类名变更(BackwardHookFunctionBackward → BackwardHookFunction),正则匹配失败。 ## 6. test_multiprocessing_api File "/workspace/CODE/pytorch_ut/test/test_multiprocessing_api.py", line 215 self.assertTrue(torch.equal(npu_tensor.cpu(), reconstructed_npu.cpu())) AssertionError: False is not true 多进程 tensor 序列化/反序列化后数据不一致。 ## 7. test_ops _complex(3 个 error,同一根因) RuntimeError: _index_put_impl_:IndexPutKernelNpuOpApi.cpp:82 call aclnnIndexPutImpl failed, error code is 161002 AclNN_Parameter_Error(EZ1001): Tensor self not implemented for DT_COMPLEX64, should be in dtype support list [DT_FLOAT, DT_INT32, DT_INT64, ...] ACL 底层 aclnnIndexPutImpl 不支持 complex64/complex128 数据类型。 ## 总结 | # | 测试 | 根因 | 与 0d CPU tensor 修改关系 | |---|------|------|:--:| | 1 | attention_worker_schedule | 环境缺 torchair 包 | 无关 | | 2 | ffn_worker_schedule | 环境缺 torchair 包 | 无关 | | 3 | multi_head_attention | 精度差异 | 无关 | | 4 | test_schedule | distributed API _load_actions 缺失 | 无关 | | 5 | module_hooks | PyTorch 错误消息类名变更 | 无关 | | 6 | multiprocessing_api | 多进程 tensor 序列化不一致 | 无关 | | 7 | test_ops _complex | ACL 不支持 complex dtype | 无关 | https://gitcode.com/Ascend/op-plugin/pull/4958 涉及的 15 个 test_base_ops/ 测试全部 **success**。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36279 | 3 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
TORCH MAIN SYNC: switch to release candidate of torch 2.12 update Co-authored-by: chansinging<chenxingying2@huawei.com> Co-authored-by: Chansinging<1183520536@qq.com> # message auto-generated for no-merge-commit merge: !35103 merge main_sync_0509 into master TORCH MAIN SYNC: switch to release candidate of torch 2.12 update Created-by: chansinging Commit-by: Chansinging;chansinging Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 同步社区演进,例行更新 lintrunner规避,见[issue](https://gitcode.com/Ascend/pytorch/issues/1865) # 【修改方案】 出包参考社区改动,https://github.com/pytorch/pytorch/pull/177570/ # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 本地A3服务器和ci流水线已跑通测试  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35103 | 3 个月前 | |
| 1 年前 | ||
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35539 merge code_check_lintrunner into master fix: lintrunner --all-files --take NEWLINE -a Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 文件必须以 LF 换行符结尾,不允许 CRLF(DOS 换行),执行: lintrunner --all-files --take NEWLINE -a # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35539 | 3 个月前 | |
| 2 年前 | ||
Update to v2.13.0 Co-authored-by: Chansinging<1183520536@qq.com> # message auto-generated for no-merge-commit merge: !35159 merge main_sync_20260510 into master Update to v2.13.0 Created-by: chansinging Commit-by: Chansinging Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 [版本升级](https://gitcode.com/Ascend/pytorch/issues/1923) - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 社区演进和版本升级 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】  # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35159 | 3 个月前 | |
| 2 年前 | ||
| 1 年前 | ||
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
add test case for event elapsed_time Co-authored-by: chenkun<chenkun82@huawei.com> # message auto-generated for no-merge-commit merge: !26731 merge master_event_ut into master add test case for event elapsed_time Created-by: kuhn7 Commit-by: chenkun Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > > /kind bug > /kind task > /kind feature **What does this PR do / why do we need it**: **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!26731 | 9 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
| 1 年前 | ||
| 1 年前 | ||
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
add_test Co-authored-by: sunhaolun<sunhaolun3@huawei.com> # message auto-generated for no-merge-commit merge: !33714 merge master into master add_test Created-by: sunhaolun Commit-by: sunhaolun Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 为以下API增加用例功能 Tensor.copy_ Tensor.narrow torch.cat torch.chunk torch._chunk_cat # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 新增文件 test_cat.py test_chunk.py test_chunk_cat.py test_copy_.py test_narrow.py # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33714 | 4 个月前 | |
add_test Co-authored-by: sunhaolun<sunhaolun3@huawei.com> # message auto-generated for no-merge-commit merge: !33714 merge master into master add_test Created-by: sunhaolun Commit-by: sunhaolun Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 为以下API增加用例功能 Tensor.copy_ Tensor.narrow torch.cat torch.chunk torch._chunk_cat # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 新增文件 test_cat.py test_chunk.py test_chunk_cat.py test_copy_.py test_narrow.py # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33714 | 4 个月前 | |
add_test Co-authored-by: sunhaolun<sunhaolun3@huawei.com> # message auto-generated for no-merge-commit merge: !33714 merge master into master add_test Created-by: sunhaolun Commit-by: sunhaolun Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 为以下API增加用例功能 Tensor.copy_ Tensor.narrow torch.cat torch.chunk torch._chunk_cat # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 新增文件 test_cat.py test_chunk.py test_chunk_cat.py test_copy_.py test_narrow.py # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33714 | 4 个月前 | |
add_test Co-authored-by: sunhaolun<sunhaolun3@huawei.com> # message auto-generated for no-merge-commit merge: !33714 merge master into master add_test Created-by: sunhaolun Commit-by: sunhaolun Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 为以下API增加用例功能 Tensor.copy_ Tensor.narrow torch.cat torch.chunk torch._chunk_cat # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 新增文件 test_cat.py test_chunk.py test_chunk_cat.py test_copy_.py test_narrow.py # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33714 | 4 个月前 | |
| 2 年前 | ||
| 2 年前 | ||
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
test(hub): add test cases for torch.hub.help and torch.hub._get_torch_home APIs Co-authored-by: xiemingda1002<xiemingda1002@163.com> # message auto-generated for no-merge-commit merge: !34071 merge add-test-hub-help-api-master into master test(hub): add test cases for torch.hub.help and torch.hub._get_torch_home APIs Created-by: xiemingda1002 Commit-by: xiemingda1002 Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**https://gitcode.com/Ascend/pytorch/issues/1703**</font>\ - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 一、API 功能说明 torch.hub.help 和 torch.hub._get_torch_home 是 PyTorch hub 模块中用于文档查询和路径管理的辅助 API,功能说明如下: 1. torch.hub.help(github, model, force_reload=False, skip_validation=False, trust_repo=None) - 文档获取核心能力:接收 GitHub 仓库地址和入口点名称,返回该入口点的文档字符串(docstring),无需实际加载模型或执行代码。 - 远程仓库解析核心能力:支持 "owner/repo[:branch]" 格式的仓库地址,自动解析并获取 hubconf.py 中定义的入口点函数的文档。 - 安全机制支持:通过 skip_validation 参数可跳过 GitHub API 验证(避免 rate limit),trust_repo 参数控制仓库信任策略(False/True/check/None)。 - 无状态调用:多次调用 help 不会产生副作用,不修改缓存状态,不影响后续 load 等操作,不下载仓库代码。 - 返回值灵活性:返回字符串类型文档或 None(若入口点函数未定义 docstring),支持用户预览模型使用说明。 - 典型用途:在加载模型前查看入口点的参数说明、使用示例、依赖信息等。 2. torch.hub._get_torch_home() - 路径解析核心能力:根据环境变量 TORCH_HOME 或默认路径 ~/.cache/torch 确定 torch home 目录。 - 环境变量优先级机制:优先读取 TORCH_HOME 环境变量,若未设置则依次检查 XDG_CACHE_HOME/torch、~/.cache/torch。 - 内部 API 特性:作为 get_dir() 的底层实现,不直接暴露给用户,但可通过 hub 模块访问(用于测试或调试)。 - 路径标准化处理:返回的路径经过 os.path.expanduser 处理,支持 ~ 符号展开,确保路径可用性。 - 返回值:字符串类型路径,非空且为绝对路径。 上述 API 均为纯 Python 层实现,不涉及张量计算,仅负责文档查询和路径解析。 二、测试文件 test/test_hub_api.py 完整验证该 API 的原因 本测试文件针对 PyTorch 社区原生 test/test_hub.py 覆盖不足的 torch.hub.help / _get_torch_home API 进行补充验证,确保昇腾 NPU 环境下功能完整可用: 1. torch.hub.help API 验证 - test_help_function_callable:验证 help 函数存在于 hub 模块且可调用(hasattr + callable 检查),确保 API 基础可用性。 - test_help_returns_none_without_docstring:严格验证 help 函数在入口点无 docstring 时返回 None。使用 mock 本地仓库进行测试,无需外部网络依赖。 - test_help_returns_docstring_with_content:严格验证 help 函数在入口点有 docstring 时返回有效的字符串内容。使用 mock 本地仓库进行测试,检查返回值类型为 str、非空、且包含预期关键字 "EfficientNet"。 2. torch.hub._get_torch_home API 验证 - test_get_torch_home_returns_path:验证 _get_torch_home 返回有效的路径字符串(assertIsInstance(str) + assertGreater(len, 0)),确保路径非空且类型正确。 - test_get_torch_home_with_env_variable:验证 TORCH_HOME 环境变量能正确影响返回路径,使用 tempfile.TemporaryDirectory 创建临时目录作为测试路径,覆盖自定义路径场景。测试后恢复原始环境变量状态(os.environ.pop 或 restore),避免污染其他测试。 3. 测试隔离性保障 - setUp 机制:TestHubHelp 类在 setUp 中创建 mock 本地仓库目录,写入 hubconf.py 文件,包含有/无 docstring 的两个入口点函数。 - tearDown 机制:每个测试后清理临时目录,确保测试用例间无状态污染。 - 独立性设计:两个测试类(TestHubHelp、TestHubGetTorchHome)独立,无共享状态。 - 零外部依赖:使用 unittest.mock.patch 模拟 _get_cache_or_reload,避免对 GitHub 外部仓库的依赖,测试更快、更可靠,适合 CI 环境。 测试完整性 所有用例覆盖 API 的基础功能验证、接口存在性检查、环境变量交互、测试隔离性保障,完整覆盖昇腾 NPU 适配所需的最小功能集合。 三、昇腾 NPU 适配说明(解释为什么无需 NPU 适配) torch.hub.help 和 torch.hub._get_torch_home 均具备硬件无关性、纯 Python 层实现、无底层算子依赖三大核心特征,决定了其无需针对昇腾 NPU 做适配,具体分析: 1. 纯 Python 层抽象,无硬件相关逻辑 - help API 硬件无关性:仅负责解析远程仓库的 hubconf.py 并提取文档字符串,是「文档查询」的纯 Python 抽象接口,不涉及任何硬件相关的计算、存储、通信逻辑。 - _get_torch_home API 硬件无关性:仅负责读取环境变量和构建路径字符串,依赖 os.path 模块进行路径处理,无任何硬件相关的逻辑或依赖。 - 设备无关设计:两个 API 的核心逻辑与 CPU/GPU/NPU 等硬件架构完全解耦,在任意硬件环境下行为一致。 2. 无底层算子 / 内核依赖 - 标准库依赖:两个 API 内部仅调用 Python 标准库(os 路径模块、tempfile 临时文件模块、urllib 网络模块)和 PyTorch 纯 Python 层的 hub 模块。 - 无硬件扩展依赖:未依赖 CUDA/NPU 等硬件相关的扩展库、内核函数或底层驱动。 - help 的远程解析机制:基于 GitHub URL 和 Python import 机制,与硬件架构无关。 - _get_torch_home 的路径处理机制:基于 os.path.expanduser 和 os.getenv,纯文件系统操作。 3. 核心逻辑与硬件解耦 - 文档获取解耦:help API 返回的文档字符串是纯文本信息,与硬件架构无关 —— 无论是 CPU/GPU/NPU 环境,文档查询逻辑完全一致。 - 路径解析解耦:_get_torch_home 返回的路径是通用文件系统路径,不包含任何硬件相关字段(如设备 ID、内存地址),昇腾 NPU 环境下可直接复用。 - 无张量操作:两个 API 均不涉及张量的创建、计算或迁移,测试用例中无 tensor 相关代码,无需 NPU 设备支持。 结论 torch.hub.help 和 torch.hub._get_torch_home 均是「硬件无关的纯 Python 层抽象」,核心逻辑不耦合任何特定硬件。测试用例无需导入 torch_npu,API 本身无需适配修改,可直接复用。 # 【资料变更】 刷新2.7.1版本下有多个版本资料。 1、torch.hub._get_torch_home API该API昇腾支持,但是在文档中并无描述,因此需要增加。 文档修改PR链接:https://gitcode.com/Ascend/pytorch/pull/34365 # 【接口变更】 不涉及 # 【功能验证】 测试文件路径:test/test_hub_api.py 本地验证结果:  所有测试用例执行通过。torch.hub.help 和 torch.hub._get_torch_home API 核心功能验证正常。 两个 API 均为纯 Python 层实现,不涉及张量操作,无需 NPU 设备适配。测试用例无需导入 torch_npu,API 本身可在任意硬件环境稳定运行。验证结果表明,torch.hub.help 和 torch.hub._get_torch_home 在昇腾 NPU 环境下功能正常可用,无需修改源码。 # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签:test(hub) - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!34071 | 4 个月前 | |
| 2 年前 | ||
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
fix(nn): fix test for jit api: torch.jit.script、torch.jit.trace、torch.jit.save、torch.jit.load Co-authored-by: dinglaiping<1016581171@qq.com> # message auto-generated for no-merge-commit merge: !32402 merge fixtest-jit-api-master into master fix(jit): fix test for jit api: torch.jit.script、torch.jit.trace、torch.jit.save、torch.jit.load Created-by: dinglaiping Commit-by: dinglaiping Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**https://gitcode.com/Ascend/pytorch/issues/1597**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] issue/工单 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 2.7.1及以上版本提示additional_module_tests、new_module_tests和module_tests找不到,要把additional_module_tests换成get_all_nn_module_tests并且删除new_module_tests和module_tests,最后在调用的时候使用get_all_nn_module_tests()。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 整体结论: 本次验证基于torch-npu 官方test_jit.py用例全量复用的方式,在完成最小化的文件、代码、环境适配后,于 NPU环境下完成torch.jit.script、torch.jit.trace、torch.jit.save、torch.jit.load四个核心 API 的全量验证,所有指定的测试方法均执行成功。验证结果表明,torch-npu 官方 JIT 用例可完整覆盖四个 API 的核心功能,使用官网用例完成 NPU 适配验证已足够;四个 API 在 NPU环境下的基础能力、协同逻辑均正常可用,完全满足 NPU 场景下模型编译优化、序列化部署、跨设备迁移、推理执行的实际业务需求。 1. torch.jit.script:官方用例中函数重复脚本化操作正常,脚本化模型的序列化 / 反序列化无数据丢失,NPU 设备下编译后模型的参数、设备属性与原模型保持一致,编译优化逻辑正常生效; 2. torch.jit.trace:官方用例中追踪化过程可完整保留模型的 train/eval 状态,字典类型可正常作为示例输入完成追踪,NPU 设备下追踪化模型的前向传播执行正常,输出结果与原模型一致; 3. torch.jit.save:官方用例中模型可成功保存至 zip 压缩包格式,保存过程中可完整保留 NPU 设备信息与模型全状态(参数、缓冲区、计算图),序列化过程无数据遗漏或损坏; 4. torch.jit.load:官方用例中可成功还原模型保存时的 NPU 设备信息,模型中自定义方法可正常导入并调用,zip 压缩包格式的模型可正确解析,加载后模型可直接在 NPU 上推理,执行结果与保存前模型一致。 运行日志: root@hostname-fqv42:~/torchnpuapi/torch-npu/2.7.1/pytorch/test# python -m unittest test_jit.TestJit.test_restore_device test_jit.TestJit.test_import_method test_jit.TestJit.test_torch_load_zipfile_check test_jit.TestScript.test_repeated_script_on_function test_jit.TestJit.test_script_fn_pkl test_jit.TestJit.test_trace_retains_train test_jit.TestFrontend.test_dictionary_as_example_inputs_for_jit_trace -v monkeytype is not installed. Skipping tests for Profile-Directed Typing test_restore_device (test_jit.TestJit.test_restore_device) ... ok test_import_method (test_jit.TestJit.test_import_method) ... ok test_torch_load_zipfile_check (test_jit.TestJit.test_torch_load_zipfile_check) ... ok test_repeated_script_on_function (test_jit.TestScript.test_repeated_script_on_function) ... ok test_script_fn_pkl (test_jit.TestJit.test_script_fn_pkl) ... ok test_trace_retains_train (test_jit.TestJit.test_trace_retains_train) ... ok test_dictionary_as_example_inputs_for_jit_trace (test_jit.TestFrontend.test_dictionary_as_example_inputs_for_jit_trace) ... ok ---------------------------------------------------------------------- Ran 7 tests in 0.104s OK root@hostname-fqv42:~/torchnpuapi/torch-npu/2.7.1/pytorch/test# # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!32402 | 5 个月前 | |
[feat] Add test cases for verifying torch.jit.ScriptModule hook API on NPU Co-authored-by: hxm_<ha_m@foxmail.com> # message auto-generated for no-merge-commit merge: !35821 merge master into master [feat] Add test cases for verifying torch.jit.ScriptModule hook API on NPU Created-by: hxm_ Commit-by: hxm_ Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 issue连接:https://gitcode.com/Ascend/pytorch/issues/1723 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 ## 一、背景说明 1. 通过 torch.jit.script()创建的模型是RecursiveScriptModule实例,与测试目的不符,所以本次测试模型均通过继承torch.jit.ScriptModule创建。 2. torch.jit.ScriptModule 继承自 torch.nn.Module,在 __init__ 执行完毕后通过 torch.jit.ScriptModule .init_then_script() 将模块编译为 TorchScript,内部持有 torch.jit.ScriptModule ._actual_script_module(RecursiveScriptModule 实例)作为 C++ 侧代理。编译过程只迁移参数/子模块/缓冲区的存储,不替换类上的方法,也不影响 hook 相关属性(torch.jit.ScriptModule ._backward_hooks、torch.jit.ScriptModule ._backward_pre_hooks 等),因此大部分 hook API 在 ScriptModule 子类上行为与普通 Module 一致。 3. torch.jit.ScriptModule .register_full_backward_hook 例外的原因:该方法内部会设置 self._is_full_backward_hook = True,该属性赋值被 ScriptModule.__setattr__ 代理到 C++ 侧后,因类型不匹配(C++ 侧期望 NoneType)导致 RuntimeError。这是pytorch自身的bug。 ## 二、API 功能说明 ### 1. torch.jit.ScriptModule.register_full_backward_hook(hook, prepend=False) -> RemovableHandle 在模块上注册反向传播后置 hook。hook 签名为 hook(module, grad_input, grad_output) -> tuple[Tensor] or None,在模块梯度计算完成时被调用,可返回新的 grad_input 替代原有值。prepend=True 时 hook 在已有 hook 之前执行。返回 RemovableHandle 用于移除 hook。 ### 2. torch.jit.ScriptModule.register_full_backward_pre_hook(hook, prepend=False) -> RemovableHandle 在模块上注册反向传播前置 hook。hook 签名为 hook(module, grad_output) -> tuple[Tensor] or None,在模块梯度计算之前被调用,可返回新的 grad_output 影响后续梯度计算。prepend=True 时 hook 在已有 hook 之前执行。返回 RemovableHandle 用于移除 hook。 ### 3. torch.jit.ScriptModule.register_load_state_dict_pre_hook(hook) -> RemovableHandle 在 load_state_dict 调用前触发 hook。hook 签名为 hook(module, state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs) -> None,可用于在加载前对 state_dict 进行预处理。返回 RemovableHandle 用于移除 hook。 ### 4. torch.jit.ScriptModule.register_load_state_dict_post_hook(hook) -> RemovableHandle 在 load_state_dict 调用后触发 hook。hook 签名为 hook(module, incompatible_keys) -> None,incompatible_keys 包含 missing_keys 和 unexpected_keys,可原地修改。返回 RemovableHandle 用于移除 hook。 ### 5. torch.jit.ScriptModule.register_state_dict_pre_hook(hook) -> RemovableHandle 在 state_dict 调用前触发 hook。hook 签名为 hook(module, prefix, keep_vars) -> None,可用于在序列化前执行预处理。返回 RemovableHandle 用于移除 hook。 ### 6. torch.jit.ScriptModule.register_state_dict_post_hook(hook) -> RemovableHandle 在 state_dict 调用后触发 hook。hook 签名为 hook(module, state_dict, prefix, local_metadata) -> None,可原地修改 state_dict。返回 RemovableHandle 用于移除 hook。 ## 三、测试用例说明 ### 1. torch.jit.ScriptModule.register_full_backward_hook | 用例 | 说明 | |------|------| | test_register_full_backward_hook_raises | 验证调用 register_full_backward_hook 时抛出 RuntimeError | ### 2. torch.jit.ScriptModule.register_full_backward_pre_hook | 用例 | 说明 | |------|------| | test_register_full_backward_pre_hook_called | 验证 hook 在反向传播时被调用 | | test_register_full_backward_pre_hook_modify_grad | 验证 hook 返回修改后的 grad_output 可影响梯度计算(返回全零梯度,输入梯度为零) | | test_register_full_backward_pre_hook_prepend | 验证 prepend=True 时 hook 在已有 hook 之前执行 | | test_register_full_backward_pre_hook_remove | 验证 handle.remove() 后 hook 不再触发 | ### 3. torch.jit.ScriptModule.register_load_state_dict_pre_hook & torch.jit.ScriptModule.register_load_state_dict_post_hook | 用例 | 说明 | |------|------| | test_load_state_dict_pre_hook_fires_before_module_and_post_hook | 验证完整时序 pre_hook -> module(load_state_dict) -> post_hook,post_hook 先注册证明调用顺序与注册顺序无关;pre_hook 修改 state_dict 为全零,post_hook 检查权重已加载为零,证明 module 在 pre 和 post 之间执行 | | test_register_load_state_dict_pre_hook_called | 验证 pre_hook 在 load_state_dict 时被调用,接收到正确的 prefix 参数 | | test_register_load_state_dict_pre_hook_with_module | 验证 pre_hook 接收到的 module 参数就是当前模型实例 | | test_register_load_state_dict_pre_hook_remove | 验证 handle.remove() 后 pre_hook 不再触发 | | test_register_load_state_dict_post_hook_called | 验证 post_hook 在 load_state_dict 后被调用 | | test_register_load_state_dict_post_hook_with_module | 验证 post_hook 接收到的 module 参数就是当前模型实例 | | test_register_load_state_dict_post_hook_remove | 验证 handle.remove() 后 post_hook 不再触发 | ### 4. torch.jit.ScriptModule.register_state_dict_pre_hook & torch.jit.ScriptModule.register_state_dict_post_hook | 用例 | 说明 | |------|------| | test_state_dict_pre_hook_fires_before_module_and_post_hook | 验证完整时序 pre_hook -> module(state_dict) -> post_hook,post_hook 先注册证明调用顺序与注册顺序无关;post_hook 检查 state_dict 已包含模型参数,证明 module 在 pre 和 post 之间执行 | | test_register_state_dict_pre_hook_called | 验证 pre_hook 在 state_dict 时被调用,接收到正确的 prefix 参数 | | test_register_state_dict_pre_hook_with_module | 验证 pre_hook 接收到的 module 参数就是当前模型实例 | | test_register_state_dict_pre_hook_remove | 验证 handle.remove() 后 pre_hook 不再触发 | | test_register_state_dict_post_hook_called | 验证 post_hook 在 state_dict 后被调用,接收到正确的 prefix 参数 | | test_register_state_dict_post_hook_with_module | 验证 post_hook 接收到的 module 参数就是当前模型实例 | | test_register_state_dict_post_hook_remove | 验证 handle.remove() 后 post_hook 不再触发 | # 【资料变更】 torch.jit.ScriptModule.register_load_state_dict_pre_hook、torch.jit.ScriptModule.register_state_dict_post_hook API昇腾支持,但是在文档中并无描述,因此需要增加。 其他API昇腾支持,且在文档中有描述,无需添加。 文档修改PR链接:https://gitcode.com/Ascend/pytorch/pull/35840 # 【接口变更】 不涉及 # 【功能验证】 | 接口 | 状态 | 说明 | |------|------|------| | torch.jit.ScriptModule.register_full_backward_hook | 不可用 | 调用时抛出 RuntimeError | | torch.jit.ScriptModule.register_full_backward_pre_hook | 可用 | 正常注册并触发,支持修改 grad_output、prepend 顺序控制、handle 移除 | | torch.jit.ScriptModule.register_load_state_dict_pre_hook | 可用 | 在 load_state_dict 前触发,可接收 module 参数,支持 handle 移除 | | torch.jit.ScriptModule.register_load_state_dict_post_hook | 可用 | 在 load_state_dict 后触发,可接收 module 参数,支持 handle 移除 | | torch.jit.ScriptModule.register_state_dict_pre_hook | 可用 | 在 state_dict 前触发,可接收 module 参数,支持 handle 移除 | | torch.jit.ScriptModule.register_state_dict_post_hook | 可用 | 在 state_dict 后触发,可接收 module 参数,支持 handle 移除 | 测试日志 ======================================== Python代码多环境测试开始 测试脚本: /root/torch-2.11/test_script_module_hooks.py 测试时间: Fri Apr 24 06:37:57 AM UTC 2026 ======================================== 检测到已激活的虚拟环境,先取消激活... ---------------------------------------- 测试环境: torch-2.7.1 虚拟环境: /root/torch-2.7.1/.venv/bin/activate 日志文件: /root/torch-2.11/logs/test_2.7.1_20260424_063757.log ---------------------------------------- 测试环境: torch-2.7.1 退出码: 0 状态: 成功 ✅ 详细日志: /root/torch-2.11/logs/test_2.7.1_20260424_063757.log 完成测试: torch-2.7.1 (退出码: 0) ---------------------------------------- 测试环境: torch-2.8 虚拟环境: /root/torch-2.8/.venv/bin/activate 日志文件: /root/torch-2.11/logs/test_2.8_20260424_063757.log ---------------------------------------- 测试环境: torch-2.8 退出码: 0 状态: 成功 ✅ 详细日志: /root/torch-2.11/logs/test_2.8_20260424_063757.log 完成测试: torch-2.8 (退出码: 0) ---------------------------------------- 测试环境: torch-2.9 虚拟环境: /root/torch-2.9/.venv/bin/activate 日志文件: /root/torch-2.11/logs/test_2.9_20260424_063757.log ---------------------------------------- 测试环境: torch-2.9 退出码: 0 状态: 成功 ✅ 详细日志: /root/torch-2.11/logs/test_2.9_20260424_063757.log 完成测试: torch-2.9 (退出码: 0) ---------------------------------------- 测试环境: torch-2.10 虚拟环境: /root/torch-2.10/.venv/bin/activate 日志文件: /root/torch-2.11/logs/test_2.10_20260424_063757.log ---------------------------------------- 测试环境: torch-2.10 退出码: 0 状态: 成功 ✅ 详细日志: /root/torch-2.11/logs/test_2.10_20260424_063757.log 完成测试: torch-2.10 (退出码: 0) ---------------------------------------- 测试环境: torch-2.11 虚拟环境: /root/torch-2.11/.venv/bin/activate 日志文件: /root/torch-2.11/logs/test_2.11_20260424_063757.log ---------------------------------------- 测试环境: torch-2.11 退出码: 0 状态: 成功 ✅ 详细日志: /root/torch-2.11/logs/test_2.11_20260424_063757.log 完成测试: torch-2.11 (退出码: 0) ======================================== 测试完成总结 总测试环境数: 5 完成时间: Fri Apr 24 06:39:05 AM UTC 2026 成功测试数: 5 失败测试数: 0 所有详细日志保存在: /root/torch-2.11/logs 主日志文件: /root/torch-2.11/logs/test_results_20260424_063757.log ======================================== pytorch 2.12 ../root/.local/share/uv/python/cpython-3.12.13-linux-aarch64-gnu/lib/python3.12/multiprocessing/popen_fork.py:66: DeprecationWarning: This process (pid=3985006) is multi-threaded, use of fork() may lead to deadlocks in the child. self.pid = os.fork() [W515 03:02:03.790319610 NPUCachingAllocator.cpp:199] Warning: The current CANN and Soc versions require processing for 32 padding size, with memory allocation. (function operator()) [W515 03:02:11.756102926 IscloseKernelNpu.cpp:34] Warning: Device do not support double dtype of rtol and atol now, dtype cast repalce with float. (function operator()) .................... ---------------------------------------------------------------------- Ran 21 tests in 18.055s OK # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35821 | 3 个月前 | |
| 2 年前 | ||
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
| 2 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
| 2 年前 | ||
add_test Co-authored-by: sunhaolun<sunhaolun3@huawei.com> # message auto-generated for no-merge-commit merge: !33714 merge master into master add_test Created-by: sunhaolun Commit-by: sunhaolun Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 为以下API增加用例功能 Tensor.copy_ Tensor.narrow torch.cat torch.chunk torch._chunk_cat # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 新增文件 test_cat.py test_chunk.py test_chunk_cat.py test_copy_.py test_narrow.py # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!33714 | 4 个月前 | |
| 1 年前 | ||
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
fix(nn): fix test for nn api: torch.nn.ParameterDict, torch.nn.ParameterList, torch.nn.Sequential Co-authored-by: dinglaiping<1016581171@qq.com> # message auto-generated for no-merge-commit merge: !32060 merge fixtest-nn-api-master into master fix(nn): fix test for nn api: torch.nn.ParameterDict, torch.nn.ParameterList, torch.nn.Sequential Created-by: dinglaiping Commit-by: dinglaiping Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**https://gitcode.com/Ascend/pytorch/issues/1585**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] issue/工单 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. 2.6.0版本提示skipIfMps找不到,要换成skipIfMPS。 2. 2.7及以上版本skipIfMps找不到,换成skipIfMPS;new_module_tests找不到,需要把导入new_module_tests改成导入get_new_module_tests并在调用的地方换成get_new_module_tests();tf32_on_and_off找不到,删掉导入,并在调用tf32_is_not_fp32()的地方换成调用torch.cuda.is_tf32_supported() # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 整体结论: 本次验证通过修复官网test_nn.py用例文件,验证3个API,功能正常: ParameterDict:官方用例中键值对索引、新增、删除、遍历等操作均正常,容器内所有参数设备统一为npu:0,无设备漂移问题; ParameterList:官方用例中数字索引、append新增、遍历等操作均正常,参数设备一致性与长度校验均通过,有序管理能力正常; Sequential:官方用例中getitem/setitem/delitem/append/insert/extend/pop等所有核心操作均正常执行,操作后子模块设备均保持为npu:0,动态扩展与元素管理能力完整。 运行日志: [root@hostname-fqv42 torchnpuapi]# docker exec -it test bash root@hostname-fqv42:/home# cd /root/torchnpuapi root@hostname-fqv42:~/torchnpuapi# python -m unittest test_nn_npu27.TestNN.test_ParameterList test_nn_npu27.TestNN.test_ParameterDict test_nn_npu27.TestNN.test_Sequential_getitem test_nn_npu27.TestNN.test_Sequential_setitem test_nn_npu27.TestNN.test_Sequential_delitem test_nn_npu27.TestNN.test_Sequential_append test_nn_npu27.TestNN.test_Sequential_insert test_nn_npu27.TestNN.test_Sequential_extend test_nn_npu27.TestNN.test_Sequential_pop -v test_ParameterList (test_nn_npu27.TestNN.test_ParameterList) ... ok test_ParameterDict (test_nn_npu27.TestNN.test_ParameterDict) ... ok test_Sequential_getitem (test_nn_npu27.TestNN.test_Sequential_getitem) ... ok test_Sequential_setitem (test_nn_npu27.TestNN.test_Sequential_setitem) ... ok test_Sequential_delitem (test_nn_npu27.TestNN.test_Sequential_delitem) ... ok test_Sequential_append (test_nn_npu27.TestNN.test_Sequential_append) ... ok test_Sequential_insert (test_nn_npu27.TestNN.test_Sequential_insert) ... ok test_Sequential_extend (test_nn_npu27.TestNN.test_Sequential_extend) ... ok test_Sequential_pop (test_nn_npu27.TestNN.test_Sequential_pop) ... ok ---------------------------------------------------------------------- Ran 9 tests in 0.057s OK root@hostname-fqv42:~/torchnpuapi# # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!32060 | 5 个月前 | |
| 2 年前 | ||
[fix]add getMemoryFraction attribute for torch._C Co-authored-by: weixin_47897441<wuyouqi1@h-partners.com> # message auto-generated for no-merge-commit merge: !30619 merge master into master [fix]add getMemoryFraction attribute for torch._C Created-by: weixin_47897441 Commit-by: weixin_47897441 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 : torch._C不支持_npu_getMemoryFraction - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 1、NPUCachingAllocator中新增getMemoryFraction方法及虚函数声明,Module中注册_npu_getMemoryFraction绑定; 2、在torch_npu.npu和torch_npu.npu.memory中实现并暴露get_per_process_memory_fraction接口,支持指定设备,调用底层 C++ 接口; 3、新增该接口的测试用例; 4、将该接口及底层Cpp绑定加入Dynamo追踪规则,完成适配。 # 【资料变更】 > 不涉及 # 【接口变更】 > 否 # 【功能验证】 > UT用例测试通过:python test_npu.py -v -k test_get_per_process_memory_fraction  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!30619 | 5 个月前 | |
skip ci failed testcase Co-authored-by: XianglongZeng<zengxianglong1@huawei.com> # message auto-generated for no-merge-commit merge: !36488 merge master into master skip ci failed testcase Created-by: probiotics_53 Commit-by: XianglongZeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 ### 1. allocator/test_pluggable_allocator_extensions.py — TestPluggableAllocator.setUpClass **报错日志:** acl.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. acl_op_compiler.cpp:1:10: fatal error: acl/acl_op_compiler.h: No such file or directory 1 | #include "acl/acl_op_compiler.h" | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. acl_tdt.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. In file included from pluggable_allocator_extensions.cpp:5: torch_npu/include/third_party/acl/inc/acl/acl_base.h:14:10: fatal error: acl/acl_base_rt.h: No such file or directory 14 | #include "acl/acl_base_rt.h" | ^~~~~~~~~~~~~~~~~~~ subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '16']' returned non-zero exit status 1. RuntimeError: Error building extension 'pluggable_allocator_extensions' **报错原因:** CI 环境缺少 ACL 开发头文件(acl/acl_base_rt.h、acl/acl.h、acl/acl_op_compiler.h),导致 setUpClass 中 JIT 编译 C++ 扩展 pluggable_allocator_extensions 失败。与 0D tensor 修改**无关**。 **跳过方式:** 在 TestPluggableAllocator 类上添加 @unittest.skip 装饰器。 --- ### 2. test_npu_expandable_segments.py — TestPluggableAllocator.setUpClass **报错日志:** acl.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. acl_op_compiler.cpp:1:10: fatal error: acl/acl_op_compiler.h: No such file or directory 1 | #include "acl/acl_op_compiler.h" | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. acl_tdt.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. In file included from pluggable_allocator_extensions.cpp:5: torch_npu/include/third_party/acl/inc/acl/acl_base.h:14:10: fatal error: acl/acl_base_rt.h: No such file or directory 14 | #include "acl/acl_base_rt.h" | ^~~~~~~~~~~~~~~~~~~ subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '16']' returned non-zero exit status 1. RuntimeError: Error building extension 'pluggable_allocator_extensions' **报错原因:** 与用例 1 完全相同,CI 环境缺少 ACL 头文件,JIT 编译失败。与 0D tensor 修改**无关**。 **跳过方式:** 在 TestPluggableAllocator 类上添加 @unittest.skip 装饰器。 --- ### 3. test_sanitizer_pluggable_allocator.py — TestSanitizerPluggableAllocator.setUpClass **报错日志:** acl.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. acl_op_compiler.cpp:1:10: fatal error: acl/acl_op_compiler.h: No such file or directory 1 | #include "acl/acl_op_compiler.h" | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. acl_tdt.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. In file included from pluggable_allocator_extensions.cpp:5: torch_npu/include/third_party/acl/inc/acl/acl_base.h:14:10: fatal error: acl/acl_base_rt.h: No such file or directory 14 | #include "acl/acl_base_rt.h" | ^~~~~~~~~~~~~~~~~~~ subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '16']' returned non-zero exit status 1. RuntimeError: Error building extension 'sanitizer_pluggable_allocator_extensions' **报错原因:** 与用例 1、2 完全相同,CI 环境缺少 ACL 头文件,JIT 编译失败。与 0D tensor 修改**无关**。 **跳过方式:** 在 TestSanitizerPluggableAllocator 类上添加 @unittest.skip 装饰器。 ### 4. distributed/pipelining/test_schedule_multiproc.py — CustomSchedulesTest + ScheduleTest **报错日志(CustomSchedulesTest):** RuntimeError: Exception in worker process: ... File "test_schedule_multiproc.py", line 939, in test_non_symmetric_stage_ids out = schedule.step(x, target=target, losses=losses) File "schedules.py", line 1554, in step self._step_microbatches(...) File "schedules.py", line 1579, in _step_microbatches self._initialize_stages(arg_mbs[0], kwarg_mbs[0]) File "schedules.py", line 1461, in _initialize_stages _wait_batch_p2p(_batch_p2p(all_ops)) File "schedules.py", line 490, in _batch_p2p return dist.batch_isend_irecv(p2p_ops) File "torch_npu/distributed/distributed_c10d.py", line 119, in _batch_isend_irecv p2p_op.op( File "distributed_c10d.py", line 2419, in isend return group.send([tensor], group_dst, tag) RuntimeError: create_config:../torch_npu/csrc/distributed/HCCLUtils.cpp:140 HCCL function error: hcclCommInitRootInfoConfig(...), error code is 1 [ERROR] ERR02200 DIST call hccl api failed. [PID: 38352] Communication_Error_Ranktable_Detect(EI0015): Failed to collect cluster information of the communicator based on rootInfo detection. Reason: No rank in the communicator can connect to the root node within the timeout period. List of unconnected ranks: "[1,]". **报错日志(ScheduleTest):** RuntimeError: Exception in worker process: ... File "test_schedule_multiproc.py", line 388, in test_eval_inference_mode schedule.eval(x) File "schedules.py", line 400, in eval return self.step(*args, target=target, losses=losses, **kwargs) ... RuntimeError: create_config:../torch_npu/csrc/distributed/HCCLUtils.cpp:140 HCCL function error: hcclCommInitRootInfoConfig(...), error code is 1 [ERROR] ERR02200 DIST call hccl api failed. [PID: 38939] Communication_Error_Ranktable_Detect(EI0015): Failed to collect cluster information of the communicator based on rootInfo detection. Reason: No rank in the communicator can connect to the root node within the timeout period. List of unconnected ranks: "[1,2,3,]". **报错原因:** HCCL 分布式通信初始化失败(hcclCommInitRootInfoConfig 返回 error code 1),rank 节点无法在超时时间内连接到 root 节点。这是 CI 环境的网络/HCCL 配置问题,与 0D tensor 修改**无关**。 **跳过方式:** 在 ScheduleTest 类上添加 @unittest.skip 装饰器。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36488 | 3 个月前 | |
| 1 年前 | ||
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
add record_stream sanitizer Co-authored-by: bellatan<tanmei2@huawei.com> Co-authored-by: hb_hubin<hubin79@huawei.com> # message auto-generated for no-merge-commit merge: !34841 merge record_stream_sanitizer into master add record_stream sanitizer Created-by: bellatan Commit-by: bellatan;hb_hubin Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 本地验证 1. test/npu/test_sanitizer.py  2. test/npu/test_sanitizer_record_stream.py  3. test/test_npu_sanitizer.py  4. test/test_sanitizer_pluggable_allocator.py  5. ci结果 ·UT_ARM_A2_Part_01:test/test_npu_sanitizer.py,pass  ·UT_ARM_A2_Part_02:test/npu/test_sanitizer.py,pass;test/test_sanitizer_pluggable_allocator.py pass  ·UT_ARM_A2_Part_03:test/npu/test_sanitizer_record_stream.py,pass  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!34841 | 3 个月前 | |
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
skip ci failed testcase Co-authored-by: XianglongZeng<zengxianglong1@huawei.com> # message auto-generated for no-merge-commit merge: !36488 merge master into master skip ci failed testcase Created-by: probiotics_53 Commit-by: XianglongZeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 ### 1. allocator/test_pluggable_allocator_extensions.py — TestPluggableAllocator.setUpClass **报错日志:** acl.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. acl_op_compiler.cpp:1:10: fatal error: acl/acl_op_compiler.h: No such file or directory 1 | #include "acl/acl_op_compiler.h" | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. acl_tdt.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. In file included from pluggable_allocator_extensions.cpp:5: torch_npu/include/third_party/acl/inc/acl/acl_base.h:14:10: fatal error: acl/acl_base_rt.h: No such file or directory 14 | #include "acl/acl_base_rt.h" | ^~~~~~~~~~~~~~~~~~~ subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '16']' returned non-zero exit status 1. RuntimeError: Error building extension 'pluggable_allocator_extensions' **报错原因:** CI 环境缺少 ACL 开发头文件(acl/acl_base_rt.h、acl/acl.h、acl/acl_op_compiler.h),导致 setUpClass 中 JIT 编译 C++ 扩展 pluggable_allocator_extensions 失败。与 0D tensor 修改**无关**。 **跳过方式:** 在 TestPluggableAllocator 类上添加 @unittest.skip 装饰器。 --- ### 2. test_npu_expandable_segments.py — TestPluggableAllocator.setUpClass **报错日志:** acl.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. acl_op_compiler.cpp:1:10: fatal error: acl/acl_op_compiler.h: No such file or directory 1 | #include "acl/acl_op_compiler.h" | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. acl_tdt.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. In file included from pluggable_allocator_extensions.cpp:5: torch_npu/include/third_party/acl/inc/acl/acl_base.h:14:10: fatal error: acl/acl_base_rt.h: No such file or directory 14 | #include "acl/acl_base_rt.h" | ^~~~~~~~~~~~~~~~~~~ subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '16']' returned non-zero exit status 1. RuntimeError: Error building extension 'pluggable_allocator_extensions' **报错原因:** 与用例 1 完全相同,CI 环境缺少 ACL 头文件,JIT 编译失败。与 0D tensor 修改**无关**。 **跳过方式:** 在 TestPluggableAllocator 类上添加 @unittest.skip 装饰器。 --- ### 3. test_sanitizer_pluggable_allocator.py — TestSanitizerPluggableAllocator.setUpClass **报错日志:** acl.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. acl_op_compiler.cpp:1:10: fatal error: acl/acl_op_compiler.h: No such file or directory 1 | #include "acl/acl_op_compiler.h" | ^~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. acl_tdt.cpp:1:10: fatal error: acl/acl.h: No such file or directory 1 | #include "acl/acl.h" | ^~~~~~~~~~~ compilation terminated. In file included from pluggable_allocator_extensions.cpp:5: torch_npu/include/third_party/acl/inc/acl/acl_base.h:14:10: fatal error: acl/acl_base_rt.h: No such file or directory 14 | #include "acl/acl_base_rt.h" | ^~~~~~~~~~~~~~~~~~~ subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '16']' returned non-zero exit status 1. RuntimeError: Error building extension 'sanitizer_pluggable_allocator_extensions' **报错原因:** 与用例 1、2 完全相同,CI 环境缺少 ACL 头文件,JIT 编译失败。与 0D tensor 修改**无关**。 **跳过方式:** 在 TestSanitizerPluggableAllocator 类上添加 @unittest.skip 装饰器。 ### 4. distributed/pipelining/test_schedule_multiproc.py — CustomSchedulesTest + ScheduleTest **报错日志(CustomSchedulesTest):** RuntimeError: Exception in worker process: ... File "test_schedule_multiproc.py", line 939, in test_non_symmetric_stage_ids out = schedule.step(x, target=target, losses=losses) File "schedules.py", line 1554, in step self._step_microbatches(...) File "schedules.py", line 1579, in _step_microbatches self._initialize_stages(arg_mbs[0], kwarg_mbs[0]) File "schedules.py", line 1461, in _initialize_stages _wait_batch_p2p(_batch_p2p(all_ops)) File "schedules.py", line 490, in _batch_p2p return dist.batch_isend_irecv(p2p_ops) File "torch_npu/distributed/distributed_c10d.py", line 119, in _batch_isend_irecv p2p_op.op( File "distributed_c10d.py", line 2419, in isend return group.send([tensor], group_dst, tag) RuntimeError: create_config:../torch_npu/csrc/distributed/HCCLUtils.cpp:140 HCCL function error: hcclCommInitRootInfoConfig(...), error code is 1 [ERROR] ERR02200 DIST call hccl api failed. [PID: 38352] Communication_Error_Ranktable_Detect(EI0015): Failed to collect cluster information of the communicator based on rootInfo detection. Reason: No rank in the communicator can connect to the root node within the timeout period. List of unconnected ranks: "[1,]". **报错日志(ScheduleTest):** RuntimeError: Exception in worker process: ... File "test_schedule_multiproc.py", line 388, in test_eval_inference_mode schedule.eval(x) File "schedules.py", line 400, in eval return self.step(*args, target=target, losses=losses, **kwargs) ... RuntimeError: create_config:../torch_npu/csrc/distributed/HCCLUtils.cpp:140 HCCL function error: hcclCommInitRootInfoConfig(...), error code is 1 [ERROR] ERR02200 DIST call hccl api failed. [PID: 38939] Communication_Error_Ranktable_Detect(EI0015): Failed to collect cluster information of the communicator based on rootInfo detection. Reason: No rank in the communicator can connect to the root node within the timeout period. List of unconnected ranks: "[1,2,3,]". **报错原因:** HCCL 分布式通信初始化失败(hcclCommInitRootInfoConfig 返回 error code 1),rank 节点无法在超时时间内连接到 root 节点。这是 CI 环境的网络/HCCL 配置问题,与 0D tensor 修改**无关**。 **跳过方式:** 在 ScheduleTest 类上添加 @unittest.skip 装饰器。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36488 | 3 个月前 | |
| 2 年前 | ||
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
| 2 年前 | ||
| 1 年前 | ||
Skip failing torch official TestCase tests and disable unsupported test cases Co-authored-by: yuhaiyan<yuhaiyan8@huawei.com> Co-authored-by: yuhaiyan8<yuhaiyan8@h-partners.com> # message auto-generated for no-merge-commit merge: !32140 merge cherry-pick-mr-32139-1774073503832-auto into master Skip failing torch official TestCase tests and disable unsupported test cases Created-by: yuhaiyan Commit-by: yuhaiyan;yuhaiyan8 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 1. 暂时跳过失败用例 2. 已提单跟进修复 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [ ] 代码注释完备,正确记录错误日志 - [ ] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!32140 | 4 个月前 | |
| 2 年前 | ||
[feat]TensorTo support preserve_format consistent with GPU Co-authored-by: chenshuai<chenshuai81@huawei.com> # message auto-generated for no-merge-commit merge: !35355 merge cherry-pick-mr-34696-1778549007272-auto into master [feat]TensorTo support preserve_format consistent with GPU Created-by: culechan Commit-by: culechan;chenshuai Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 1、NPU上tensorto支持preserve_format模式。行为逻辑上对齐pytorch原生框架 2、增加preserve_format模式相关的测试用例 # 【资料变更】 不涉及,原生API表格中未体现这部分内容 # 【接口变更】 Tensor.to默认使用且支持preserve_format模式 # 【功能验证】   # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35355 | 3 个月前 | |
Update test_torch.py Co-authored-by: yuhaiyan<yuhaiyan8@huawei.com> # message auto-generated for no-merge-commit merge: !27371 merge master-dev2 into master Update test_torch.py Created-by: yuhaiyan Commit-by: yuhaiyan Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > > /kind bug > /kind task > /kind feature **What does this PR do / why do we need it**: **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!27371 | 8 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 3 个月前 | |
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
[fix] add _npu_dtype_cast_backward sharding strategy Co-authored-by: zqwenn<zhangqiongwen@huawei.com> # message auto-generated for no-merge-commit merge: merge master_npu_dtype_cast_backsard_register_sharding into master [fix] add _npu_dtype_cast_backward sharding strategy Created-by: zqwenn Commit-by: zqwenn Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > > /kind bug > /kind task > /kind feature **What does this PR do / why do we need it**: **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!25308 | 11 个月前 | |
| 2 年前 | ||
Update onnx_test_common.py Co-authored-by: yuhaiyan<yuhaiyan8@huawei.com> # message auto-generated for no-merge-commit merge: merge master-dev1 into master Update onnx_test_common.py Created-by: yuhaiyan Commit-by: yuhaiyan Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > > /kind bug > /kind task > /kind feature **What does this PR do / why do we need it**: **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!25485 | 11 个月前 | |
| 2 年前 | ||
【feat】mstx support push and pop Co-authored-by: mei-feiyao<meifeiyao@h-partners.com> # message auto-generated for no-merge-commit merge: !36205 merge rangem into master 【feat】mstx support push and pop Created-by: mei-feiyao Commit-by: mei-feiyao Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\https://gitcode.com/Ascend/pytorch/issues/2033 > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 对齐社区nvtx模块,补全接口,包括如下: 1、range_push、range_pop:线程粒度的打range点接口,内部走mstx库实现打点,用户可通过torch_npu.profiler接口配置mstx=True或者msproftx=True(待废弃)的方式采集tx打点数据; 2、annotate类:用户可通过with torch_npu.npu.mstx.annotate(message="xxxx", stream=xxxx, domain="tttt")的方式或者@torch_npu.npu.mstx.annotate(message="xxxx", stream=xxxx, domain="tttt")装饰器的方式对目标代码段或者目标函数进行打点,内部会在开始和结束的阶段分别调用range_push和range_pop # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 是。涉及新增接口,已联系资料同学补充资料 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 本需求只涉及新增接口,不涉及已有接口变更 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 1、UT测试验证新增接口; 2、模型代码增加调用新增的打点接口,并通过profiler采集打点数据,观察打点数据正常 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36205 | 3 个月前 | |
| 2 年前 | ||
| 2 年前 |
简介
test目录为PTA相关的测试用例。
安装依赖
pip3 install -r requirements.txt
补全脚本
该操作需要联网
cd test
bash get_synchronized_files.sh
通过以上操作,会自动补齐testfiles_synchronized.txt和testfolder_synchronized.txt中的文件或文件夹。
跳过失败用例
export DISABLED_TESTS_FILE=./unsupported_test_cases/.pytorch-disabled-tests.json
如果不是在test目录下运行测试用例,需要传入.pytorch-disabled-tests.json的绝对路径。
执行方式
执行单个测试脚本
运行以test开头的文件。以test_autocast.py为例:
方式一:
python test_autocast.py
方式二:
python run_test.py -i test_autocast
说明:部分以test开头的脚本不是直接运行的脚本,比如jit中的测试脚本是通过test_jit.py执行的。
执行具体的用例
通过-k参数传入具体的用例名。以test_autocast.py为例:
方式一:
python test_autocast.py -v -k test_autocast_nn_fp32
方式二:
python run_test.py -v -i test_autocast -- -k test_autocast_nn_fp32
执行全量UT的方式
# 进入到test目录的上一级
cd ../
运行非分布式全量用例:
python ci/access_control_test.py --all
运行分布式全量用例:
python ci/access_control_test.py --distributed
FAQ
-
报错:"dictionary changed size during interation".
如果python 环境是3.8.1版本,报错在unitest/case.py中,可考虑是sys.modules被修改导致的。第三方包可能会有对sys.modules的修改,比如beartype。 此问题为python 3.8.1版本/3.9.0版本的已知bug,可按照 https://github.com/python/cpython/issues/73806 中修改方式修改,将
for v in sys.modules.values()改为for v in list(sys.modules.values())可用于复现问题的用例:
python test_jit.py -v -k test_annotated_empty_dict -
test_public_bindings.py 用例的功能
该用例是为了校验接口的公开规范性,如果该用例报错,请确认报错的接口是否要公开,并按照报错的提示进行修改。