mindspore 2.6.0__cp310-cp310-win_amd64.whl → 2.7.0__cp310-cp310-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mindspore might be problematic. Click here for more details.

Files changed (455) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
  3. mindspore/Newtonsoft.Json.dll +0 -0
  4. mindspore/__init__.py +2 -2
  5. mindspore/_c_dataengine.cp310-win_amd64.pyd +0 -0
  6. mindspore/_c_expression.cp310-win_amd64.pyd +0 -0
  7. mindspore/_c_mindrecord.cp310-win_amd64.pyd +0 -0
  8. mindspore/_checkparam.py +42 -11
  9. mindspore/_extends/builtin_operations.py +3 -3
  10. mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
  11. mindspore/_extends/optimize/cell_utils.py +96 -0
  12. mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
  13. mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
  14. mindspore/_extends/parse/__init__.py +3 -3
  15. mindspore/_extends/parse/compile_config.py +44 -22
  16. mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -2
  17. mindspore/_extends/parse/parser.py +64 -83
  18. mindspore/_extends/parse/resources.py +39 -0
  19. mindspore/_extends/parse/standard_method.py +47 -14
  20. mindspore/_extends/parse/trope.py +8 -1
  21. mindspore/_extends/pijit/__init__.py +1 -2
  22. mindspore/_extends/pijit/pijit_func_white_list.py +2 -5
  23. mindspore/amp.py +4 -22
  24. mindspore/atlprov.dll +0 -0
  25. mindspore/avcodec-59.dll +0 -0
  26. mindspore/avdevice-59.dll +0 -0
  27. mindspore/avfilter-8.dll +0 -0
  28. mindspore/avformat-59.dll +0 -0
  29. mindspore/avutil-57.dll +0 -0
  30. mindspore/boost/adasum.py +1 -1
  31. mindspore/boost/boost_cell_wrapper.py +4 -4
  32. mindspore/c1.dll +0 -0
  33. mindspore/c1xx.dll +0 -0
  34. mindspore/c2.dll +0 -0
  35. mindspore/common/__init__.py +43 -12
  36. mindspore/common/_grad_function.py +2 -1
  37. mindspore/common/_pijit_context.py +28 -7
  38. mindspore/common/_stub_tensor.py +1 -209
  39. mindspore/common/_tensor_cpp_method.py +1 -1
  40. mindspore/common/_tensor_docs.py +177 -52
  41. mindspore/common/_utils.py +9 -1
  42. mindspore/common/api.py +338 -208
  43. mindspore/common/dtype.py +108 -57
  44. mindspore/common/dump.py +11 -16
  45. mindspore/common/dynamic_shape/__init__.py +0 -0
  46. mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +17 -23
  47. mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
  48. mindspore/common/file_system.py +59 -9
  49. mindspore/common/generator.py +2 -3
  50. mindspore/common/hook_handle.py +33 -5
  51. mindspore/common/jit_config.py +1 -1
  52. mindspore/common/jit_trace.py +84 -105
  53. mindspore/common/np_dtype.py +3 -3
  54. mindspore/common/parameter.py +27 -29
  55. mindspore/common/recompute.py +5 -7
  56. mindspore/common/sparse_tensor.py +0 -3
  57. mindspore/common/symbol.py +0 -1
  58. mindspore/common/tensor.py +84 -133
  59. mindspore/communication/_comm_helper.py +46 -4
  60. mindspore/communication/management.py +79 -7
  61. mindspore/context.py +47 -38
  62. mindspore/dataset/__init__.py +1 -1
  63. mindspore/dataset/audio/transforms.py +1 -1
  64. mindspore/dataset/core/config.py +38 -4
  65. mindspore/dataset/engine/datasets.py +350 -322
  66. mindspore/dataset/engine/datasets_user_defined.py +69 -23
  67. mindspore/dataset/engine/iterators.py +2 -2
  68. mindspore/dataset/engine/obs/config_loader.py +2 -2
  69. mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
  70. mindspore/dataset/transforms/c_transforms.py +2 -2
  71. mindspore/dataset/transforms/py_transforms.py +7 -3
  72. mindspore/dataset/transforms/transforms.py +10 -6
  73. mindspore/dataset/vision/__init__.py +1 -1
  74. mindspore/dataset/vision/py_transforms.py +8 -8
  75. mindspore/dataset/vision/transforms.py +17 -5
  76. mindspore/dataset/vision/utils.py +632 -21
  77. mindspore/dataset/vision/validators.py +1 -0
  78. mindspore/device_context/ascend/device.py +1 -1
  79. mindspore/device_context/ascend/op_tuning.py +35 -1
  80. mindspore/device_context/gpu/__init__.py +2 -2
  81. mindspore/device_context/gpu/device.py +1 -1
  82. mindspore/device_context/gpu/op_precision.py +4 -2
  83. mindspore/device_context/gpu/op_tuning.py +6 -3
  84. mindspore/device_manager.py +16 -9
  85. mindspore/dnnl.dll +0 -0
  86. mindspore/dpcmi.dll +0 -0
  87. mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +5 -4
  88. mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
  89. mindspore/experimental/optim/adadelta.py +13 -20
  90. mindspore/experimental/optim/adagrad.py +15 -22
  91. mindspore/experimental/optim/adam.py +17 -24
  92. mindspore/experimental/optim/adamax.py +14 -22
  93. mindspore/experimental/optim/adamw.py +28 -34
  94. mindspore/experimental/optim/asgd.py +15 -25
  95. mindspore/experimental/optim/lr_scheduler.py +27 -45
  96. mindspore/experimental/optim/nadam.py +14 -24
  97. mindspore/experimental/optim/optimizer.py +13 -23
  98. mindspore/experimental/optim/radam.py +18 -24
  99. mindspore/experimental/optim/rmsprop.py +14 -25
  100. mindspore/experimental/optim/rprop.py +15 -26
  101. mindspore/experimental/optim/sgd.py +9 -19
  102. mindspore/hal/__init__.py +4 -4
  103. mindspore/hal/contiguous_tensors_handle.py +2 -2
  104. mindspore/hal/memory.py +1 -0
  105. mindspore/include/api/cell.h +65 -5
  106. mindspore/include/api/cfg.h +24 -7
  107. mindspore/include/api/context.h +1 -0
  108. mindspore/include/api/delegate.h +10 -2
  109. mindspore/include/api/dual_abi_helper.h +100 -19
  110. mindspore/include/api/graph.h +14 -1
  111. mindspore/include/api/kernel.h +16 -3
  112. mindspore/include/api/kernel_api.h +9 -1
  113. mindspore/include/api/metrics/accuracy.h +9 -0
  114. mindspore/include/api/model.h +8 -1
  115. mindspore/include/api/model_group.h +4 -0
  116. mindspore/include/api/model_parallel_runner.h +2 -0
  117. mindspore/include/api/status.h +48 -10
  118. mindspore/include/api/types.h +8 -3
  119. mindspore/include/c_api/model_c.h +0 -58
  120. mindspore/include/c_api/tensor_c.h +0 -26
  121. mindspore/include/dataset/constants.h +9 -0
  122. mindspore/include/dataset/vision_ascend.h +1 -1
  123. mindspore/jpeg62.dll +0 -0
  124. mindspore/mindrecord/tools/cifar10.py +61 -11
  125. mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
  126. mindspore/mindspore_backend_common.dll +0 -0
  127. mindspore/mindspore_backend_manager.dll +0 -0
  128. mindspore/mindspore_common.dll +0 -0
  129. mindspore/mindspore_core.dll +0 -0
  130. mindspore/mindspore_cpu_res_manager.dll +0 -0
  131. mindspore/mindspore_dump.dll +0 -0
  132. mindspore/mindspore_frontend.dll +0 -0
  133. mindspore/mindspore_glog.dll +0 -0
  134. mindspore/mindspore_memory_pool.dll +0 -0
  135. mindspore/mindspore_ms_backend.dll +0 -0
  136. mindspore/mindspore_ops.dll +0 -0
  137. mindspore/mindspore_ops_host.dll +0 -0
  138. mindspore/mindspore_ops_kernel_common.dll +0 -0
  139. mindspore/mindspore_profiler.dll +0 -0
  140. mindspore/mindspore_pyboost.dll +0 -0
  141. mindspore/mindspore_pynative.dll +0 -0
  142. mindspore/mindspore_res_manager.dll +0 -0
  143. mindspore/mindspore_runtime_pipeline.dll +0 -0
  144. mindspore/mint/__init__.py +4 -44
  145. mindspore/mint/distributed/__init__.py +5 -0
  146. mindspore/mint/distributed/distributed.py +425 -19
  147. mindspore/mint/nn/__init__.py +1 -1
  148. mindspore/mint/nn/functional.py +53 -6
  149. mindspore/mint/nn/layer/_functions.py +163 -294
  150. mindspore/mint/nn/layer/activation.py +8 -6
  151. mindspore/mint/nn/layer/conv.py +125 -101
  152. mindspore/mint/nn/layer/normalization.py +11 -25
  153. mindspore/mint/optim/adam.py +19 -18
  154. mindspore/mint/optim/adamw.py +14 -8
  155. mindspore/mint/optim/sgd.py +5 -5
  156. mindspore/msobj140.dll +0 -0
  157. mindspore/mspdb140.dll +0 -0
  158. mindspore/mspdbcore.dll +0 -0
  159. mindspore/mspdbst.dll +0 -0
  160. mindspore/mspft140.dll +0 -0
  161. mindspore/msvcdis140.dll +0 -0
  162. mindspore/msvcp140_1.dll +0 -0
  163. mindspore/msvcp140_2.dll +0 -0
  164. mindspore/msvcp140_atomic_wait.dll +0 -0
  165. mindspore/msvcp140_codecvt_ids.dll +0 -0
  166. mindspore/nn/cell.py +488 -620
  167. mindspore/nn/grad/cell_grad.py +11 -12
  168. mindspore/nn/layer/activation.py +36 -36
  169. mindspore/nn/layer/basic.py +74 -77
  170. mindspore/nn/layer/channel_shuffle.py +4 -4
  171. mindspore/nn/layer/combined.py +4 -2
  172. mindspore/nn/layer/conv.py +86 -85
  173. mindspore/nn/layer/dense.py +9 -7
  174. mindspore/nn/layer/embedding.py +50 -52
  175. mindspore/nn/layer/image.py +38 -40
  176. mindspore/nn/layer/math.py +111 -112
  177. mindspore/nn/layer/normalization.py +56 -44
  178. mindspore/nn/layer/pooling.py +58 -63
  179. mindspore/nn/layer/rnn_cells.py +33 -33
  180. mindspore/nn/layer/rnns.py +56 -56
  181. mindspore/nn/layer/thor_layer.py +74 -73
  182. mindspore/nn/layer/transformer.py +11 -1
  183. mindspore/nn/learning_rate_schedule.py +20 -20
  184. mindspore/nn/loss/loss.py +79 -81
  185. mindspore/nn/optim/adam.py +2 -4
  186. mindspore/nn/optim/adasum.py +2 -2
  187. mindspore/nn/optim/lamb.py +1 -3
  188. mindspore/nn/optim/optimizer.py +1 -1
  189. mindspore/nn/optim/tft_wrapper.py +2 -3
  190. mindspore/nn/optim/thor.py +2 -2
  191. mindspore/nn/probability/distribution/_utils/utils.py +2 -2
  192. mindspore/nn/probability/distribution/exponential.py +2 -1
  193. mindspore/nn/probability/distribution/poisson.py +2 -1
  194. mindspore/nn/sparse/sparse.py +3 -3
  195. mindspore/nn/wrap/cell_wrapper.py +73 -42
  196. mindspore/nn/wrap/grad_reducer.py +37 -52
  197. mindspore/nn/wrap/loss_scale.py +72 -74
  198. mindspore/numpy/array_creations.py +7 -7
  199. mindspore/numpy/fft.py +1 -1
  200. mindspore/numpy/math_ops.py +1 -1
  201. mindspore/numpy/utils_const.py +1 -1
  202. mindspore/opencv_core452.dll +0 -0
  203. mindspore/opencv_imgcodecs452.dll +0 -0
  204. mindspore/opencv_imgproc452.dll +0 -0
  205. mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
  206. mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
  207. mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
  208. mindspore/ops/_op_impl/cpu/__init__.py +1 -0
  209. mindspore/{experimental/es/__init__.py → ops/_op_impl/cpu/joinedstr_op.py} +12 -6
  210. mindspore/ops/_vmap/vmap_array_ops.py +6 -13
  211. mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
  212. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +29 -10
  213. mindspore/ops/auto_generate/gen_extend_func.py +5 -55
  214. mindspore/ops/auto_generate/gen_ops_def.py +753 -273
  215. mindspore/ops/auto_generate/gen_ops_prim.py +1687 -958
  216. mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
  217. mindspore/ops/composite/__init__.py +10 -0
  218. mindspore/ops/composite/base.py +9 -5
  219. mindspore/ops/composite/multitype_ops/__init__.py +12 -1
  220. mindspore/ops/composite/multitype_ops/_compile_utils.py +132 -108
  221. mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
  222. mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
  223. mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
  224. mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
  225. mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
  226. mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
  227. mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
  228. mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
  229. mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
  230. mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
  231. mindspore/ops/function/__init__.py +4 -1
  232. mindspore/ops/function/_add_attr_func.py +11 -6
  233. mindspore/ops/function/array_func.py +17 -100
  234. mindspore/ops/function/debug_func.py +8 -5
  235. mindspore/ops/function/grad/grad_func.py +5 -13
  236. mindspore/ops/function/math_func.py +65 -399
  237. mindspore/ops/function/nn_func.py +44 -61
  238. mindspore/ops/function/other_func.py +4 -1
  239. mindspore/ops/function/random_func.py +31 -4
  240. mindspore/ops/functional.py +2 -3
  241. mindspore/ops/functional_overload.py +486 -18
  242. mindspore/ops/op_info_register.py +21 -0
  243. mindspore/ops/operations/__init__.py +5 -2
  244. mindspore/ops/operations/_custom_ops_utils.py +675 -8
  245. mindspore/ops/operations/_inner_ops.py +14 -18
  246. mindspore/ops/operations/_sequence_ops.py +1 -1
  247. mindspore/ops/operations/array_ops.py +4 -50
  248. mindspore/ops/operations/comm_ops.py +186 -41
  249. mindspore/ops/operations/custom_ops.py +244 -175
  250. mindspore/ops/operations/debug_ops.py +55 -4
  251. mindspore/ops/operations/image_ops.py +13 -13
  252. mindspore/ops/operations/manually_defined/ops_def.py +27 -28
  253. mindspore/ops/operations/math_ops.py +8 -9
  254. mindspore/ops/operations/nn_ops.py +6 -7
  255. mindspore/ops/primitive.py +9 -20
  256. mindspore/ops/tensor_method.py +52 -11
  257. mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
  258. mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
  259. mindspore/ops_generate/api/functions_cc_generator.py +58 -10
  260. mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
  261. mindspore/ops_generate/common/base_generator.py +14 -0
  262. mindspore/ops_generate/common/gen_constants.py +7 -2
  263. mindspore/ops_generate/common/gen_utils.py +0 -19
  264. mindspore/ops_generate/common/op_proto.py +11 -4
  265. mindspore/ops_generate/common/template.py +88 -11
  266. mindspore/ops_generate/gen_ops.py +1 -1
  267. mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
  268. mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
  269. mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
  270. mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
  271. mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
  272. mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
  273. mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -16
  274. mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
  275. mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
  276. mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
  277. mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
  278. mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
  279. mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
  280. mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
  281. mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
  282. mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
  283. mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
  284. mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
  285. mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
  286. mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
  287. mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
  288. mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
  289. mindspore/parallel/_auto_parallel_context.py +9 -17
  290. mindspore/parallel/_cell_wrapper.py +106 -40
  291. mindspore/parallel/_parallel_serialization.py +4 -3
  292. mindspore/parallel/_ps_context.py +4 -6
  293. mindspore/parallel/_tensor.py +167 -12
  294. mindspore/parallel/_transformer/moe.py +1 -1
  295. mindspore/parallel/_transformer/transformer.py +17 -12
  296. mindspore/parallel/_utils.py +5 -11
  297. mindspore/parallel/auto_parallel.py +33 -12
  298. mindspore/parallel/checkpoint_convert.py +3 -3
  299. mindspore/parallel/checkpoint_transform.py +5 -1
  300. mindspore/parallel/cluster/process_entity/_api.py +88 -49
  301. mindspore/parallel/cluster/process_entity/_utils.py +95 -7
  302. mindspore/parallel/cluster/run.py +48 -7
  303. mindspore/parallel/function/__init__.py +8 -1
  304. mindspore/parallel/function/reshard_func.py +7 -6
  305. mindspore/parallel/nn/__init__.py +15 -2
  306. mindspore/parallel/nn/parallel_cell_wrapper.py +50 -14
  307. mindspore/parallel/nn/parallel_grad_reducer.py +7 -14
  308. mindspore/parallel/shard.py +9 -23
  309. mindspore/parallel/transform_safetensors.py +468 -174
  310. mindspore/pgodb140.dll +0 -0
  311. mindspore/pgort140.dll +0 -0
  312. mindspore/profiler/__init__.py +2 -1
  313. mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
  314. mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
  315. mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +3 -0
  316. mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
  317. mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
  318. mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
  319. mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
  320. mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
  321. mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
  322. mindspore/profiler/analysis/task_manager.py +1 -1
  323. mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
  324. mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
  325. mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +10 -9
  326. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +43 -23
  327. mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
  328. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
  329. mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
  330. mindspore/profiler/common/constant.py +16 -0
  331. mindspore/profiler/common/msprof_cmd_tool.py +2 -2
  332. mindspore/profiler/common/path_manager.py +9 -0
  333. mindspore/profiler/common/profiler_context.py +50 -29
  334. mindspore/profiler/common/profiler_info.py +0 -16
  335. mindspore/profiler/common/profiler_meta_data.py +1 -0
  336. mindspore/profiler/common/profiler_op_analyse.py +239 -0
  337. mindspore/profiler/common/profiler_output_path.py +23 -8
  338. mindspore/profiler/common/profiler_parameters.py +128 -35
  339. mindspore/profiler/dynamic_profile/__init__.py +0 -0
  340. mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
  341. mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
  342. mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
  343. mindspore/profiler/dynamic_profiler.py +374 -338
  344. mindspore/profiler/envprofiler.py +42 -12
  345. mindspore/profiler/experimental_config.py +112 -7
  346. mindspore/profiler/mstx.py +33 -12
  347. mindspore/profiler/platform/__init__.py +2 -3
  348. mindspore/profiler/platform/cpu_profiler.py +10 -4
  349. mindspore/profiler/platform/npu_profiler.py +30 -20
  350. mindspore/profiler/profiler.py +218 -154
  351. mindspore/profiler/profiler_action_controller.py +65 -77
  352. mindspore/profiler/profiler_interface.py +2 -2
  353. mindspore/profiler/schedule.py +10 -4
  354. mindspore/rewrite/common/config.py +1 -0
  355. mindspore/rewrite/common/namer.py +1 -0
  356. mindspore/rewrite/common/namespace.py +1 -0
  357. mindspore/rewrite/node/node.py +31 -11
  358. mindspore/rewrite/parsers/assign_parser.py +1 -1
  359. mindspore/rewrite/symbol_tree/symbol_tree.py +2 -2
  360. mindspore/run_check/_check_version.py +7 -10
  361. mindspore/runtime/__init__.py +8 -6
  362. mindspore/runtime/event.py +10 -4
  363. mindspore/runtime/executor.py +87 -45
  364. mindspore/runtime/memory.py +22 -30
  365. mindspore/runtime/thread_bind_core.py +299 -165
  366. mindspore/safeguard/rewrite_obfuscation.py +12 -13
  367. mindspore/swresample-4.dll +0 -0
  368. mindspore/swscale-6.dll +0 -0
  369. mindspore/tbbmalloc.dll +0 -0
  370. mindspore/tinyxml2.dll +0 -0
  371. mindspore/train/_utils.py +9 -5
  372. mindspore/train/amp.py +43 -23
  373. mindspore/train/callback/__init__.py +5 -5
  374. mindspore/train/callback/_callback.py +2 -1
  375. mindspore/train/callback/_checkpoint.py +4 -14
  376. mindspore/train/callback/_flops_collector.py +11 -7
  377. mindspore/train/callback/_landscape.py +0 -1
  378. mindspore/train/callback/_train_fault_tolerance.py +72 -18
  379. mindspore/train/data_sink.py +15 -6
  380. mindspore/train/dataset_helper.py +14 -5
  381. mindspore/train/model.py +49 -47
  382. mindspore/train/serialization.py +168 -126
  383. mindspore/train/summary/summary_record.py +13 -2
  384. mindspore/train/train_thor/model_thor.py +2 -2
  385. mindspore/turbojpeg.dll +0 -0
  386. mindspore/utils/__init__.py +3 -2
  387. mindspore/utils/dryrun.py +0 -6
  388. mindspore/utils/runtime_execution_order_check.py +162 -78
  389. mindspore/utils/sdc_detect.py +68 -0
  390. mindspore/utils/utils.py +14 -17
  391. mindspore/vcmeta.dll +0 -0
  392. mindspore/vcruntime140.dll +0 -0
  393. mindspore/vcruntime140_1.dll +0 -0
  394. mindspore/version.py +1 -1
  395. {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/METADATA +5 -4
  396. {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/RECORD +400 -439
  397. mindspore/_deprecated/jit.py +0 -198
  398. mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
  399. mindspore/communication/_hccl_management.py +0 -297
  400. mindspore/experimental/es/embedding_service.py +0 -891
  401. mindspore/experimental/es/embedding_service_layer.py +0 -581
  402. mindspore/profiler/common/validator/__init__.py +0 -14
  403. mindspore/profiler/common/validator/validate_path.py +0 -84
  404. mindspore/profiler/parser/__init__.py +0 -14
  405. mindspore/profiler/parser/aicpu_data_parser.py +0 -272
  406. mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
  407. mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
  408. mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
  409. mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
  410. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
  411. mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
  412. mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
  413. mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
  414. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
  415. mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
  416. mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
  417. mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
  418. mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
  419. mindspore/profiler/parser/ascend_flops_generator.py +0 -116
  420. mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
  421. mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
  422. mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
  423. mindspore/profiler/parser/ascend_memory_generator.py +0 -185
  424. mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
  425. mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
  426. mindspore/profiler/parser/ascend_op_generator.py +0 -334
  427. mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
  428. mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
  429. mindspore/profiler/parser/base_timeline_generator.py +0 -483
  430. mindspore/profiler/parser/container.py +0 -229
  431. mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
  432. mindspore/profiler/parser/flops_parser.py +0 -531
  433. mindspore/profiler/parser/framework_enum.py +0 -111
  434. mindspore/profiler/parser/framework_parser.py +0 -464
  435. mindspore/profiler/parser/framework_struct.py +0 -61
  436. mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
  437. mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
  438. mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
  439. mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
  440. mindspore/profiler/parser/hccl_parser.py +0 -573
  441. mindspore/profiler/parser/hwts_log_parser.py +0 -122
  442. mindspore/profiler/parser/integrator.py +0 -526
  443. mindspore/profiler/parser/memory_usage_parser.py +0 -277
  444. mindspore/profiler/parser/minddata_analyzer.py +0 -800
  445. mindspore/profiler/parser/minddata_parser.py +0 -186
  446. mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
  447. mindspore/profiler/parser/op_intermediate_parser.py +0 -149
  448. mindspore/profiler/parser/optime_parser.py +0 -250
  449. mindspore/profiler/parser/profiler_info.py +0 -213
  450. mindspore/profiler/parser/step_trace_parser.py +0 -666
  451. mindspore/utils/hooks.py +0 -81
  452. /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
  453. {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/WHEEL +0 -0
  454. {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/entry_points.txt +0 -0
  455. {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/top_level.txt +0 -0
@@ -71,7 +71,7 @@ class PyboostOverloadFunctionsGenerator(BaseGenerator):
71
71
  '${arg_handler_processor}\n'
72
72
  'MS_LOG(INFO) << "Call Tensor${class_name}";\n'
73
73
  'auto res = ${pyboost_base_func_name}_OP(${prim_name}, parse_args.src_types_, ${convert_args});\n'
74
- 'trace::Capture(parse_args.arg_list_, "${class_name}", &res);\n'
74
+ 'trace::Capture(parse_args.arg_list_, mindspore::prim::kPrim${class_name}, &res);\n'
75
75
  'return res;\n'
76
76
  )
77
77
  self.callback_python_template = Template(
@@ -68,7 +68,7 @@ def get_index(index: int):
68
68
  return "kIndex" + str(index)
69
69
 
70
70
 
71
- def get_convert_type_str(dtype: str, optional):
71
+ def get_convert_type_str(dtype: str, optional, use_basic_type=False):
72
72
  """
73
73
  Convert type
74
74
  """
@@ -106,16 +106,30 @@ def get_convert_type_str(dtype: str, optional):
106
106
  'list[bool]': 'ToBoolListOptional<py::list>',
107
107
  'list[tensor]': 'ToTensorListOptional<py::list>',
108
108
  }
109
+ basic_optional_type_convert = {
110
+ 'tuple[int]': "ToBasicIntVectorOptional",
111
+ 'list[int]': "ToBasicIntVectorOptional",
112
+ 'int': "ToBasicIntOptional",
113
+ }
114
+ basic_type_convert = {
115
+ 'tuple[int]': "ToBasicIntVector",
116
+ 'list[int]': "ToBasicIntVector",
117
+ 'int': "ToBasicInt",
118
+ }
109
119
  if optional:
120
+ if use_basic_type and dtype in basic_optional_type_convert:
121
+ return basic_optional_type_convert[dtype]
110
122
  if dtype in optional_type_convert:
111
123
  return optional_type_convert[dtype]
112
124
  raise TypeError(f"""Unsupported convert optional type {dtype} for args.""")
125
+ if use_basic_type and dtype in basic_type_convert:
126
+ return basic_type_convert[dtype]
113
127
  if dtype in native_type_convert:
114
128
  return native_type_convert[dtype]
115
129
  raise TypeError(f"""Unsupported convert type {dtype} for args.""")
116
130
 
117
131
 
118
- def get_input_args_type_str(dtype: str, optional):
132
+ def get_input_args_type_str(dtype: str, optional, use_basic_type=False):
119
133
  """
120
134
  Convert type
121
135
  """
@@ -153,17 +167,52 @@ def get_input_args_type_str(dtype: str, optional):
153
167
  'list[bool]': 'std::optional<ValueTuplePtr>',
154
168
  'list[tensor]': 'std::optional<ValueTuplePtr>',
155
169
  }
170
+ basic_optional_type_convert = {
171
+ 'tuple[int]': "std::optional<std::vector<int64_t>>",
172
+ 'list[int]': "std::optional<std::vector<int64_t>>",
173
+ 'int': "std::optional<int64_t>",
174
+ }
175
+ basic_type_convert = {
176
+ 'tuple[int]': "std::vector<int64_t>",
177
+ 'list[int]': "std::vector<int64_t>",
178
+ 'int': "int64_t",
179
+ }
156
180
  if optional:
181
+ if use_basic_type and dtype in basic_optional_type_convert:
182
+ return basic_optional_type_convert[dtype]
157
183
  if dtype in optional_type:
158
184
  return optional_type[dtype]
159
185
  raise TypeError(f"""Unknown optional type {dtype} for args.""")
186
+ if use_basic_type and dtype in basic_type_convert:
187
+ return basic_type_convert[dtype]
160
188
  if dtype in native_type:
161
189
  return native_type[dtype]
162
190
  raise TypeError(f"""Unknown type {dtype} for args.""")
163
191
 
164
192
 
193
+ def basic_type_convert_str(dtype: str, optional):
194
+ """
195
+ Convert type
196
+ """
197
+ optional_type = {
198
+ 'tuple[int]': "ToBasicIntVectorOptional",
199
+ 'list[int]': "ToBasicIntVectorOptional",
200
+ 'int': "ToBasicIntOptional",
201
+ }
202
+ native_type = {
203
+ 'tuple[int]': "ToBasicIntVector",
204
+ 'list[int]': "ToBasicIntVector",
205
+ 'int': "ToBasicInt",
206
+ }
207
+ if optional:
208
+ if dtype in optional_type:
209
+ return optional_type[dtype]
210
+ if dtype in native_type:
211
+ return native_type[dtype]
212
+ return ""
213
+
165
214
 
166
- def get_value_convert_type_str(dtype: str, optional):
215
+ def get_value_convert_type_str(dtype: str, optional, use_basic_type=False):
167
216
  """
168
217
  Convert type
169
218
  """
@@ -193,10 +242,24 @@ def get_value_convert_type_str(dtype: str, optional):
193
242
  'tuple[bool]': 'ToValueTupleOptional',
194
243
  'tuple[tensor]': 'ToValueTupleOptional',
195
244
  }
245
+ basic_optional_type_convert = {
246
+ 'tuple[int]': "ToBasicIntVectorOptional",
247
+ 'list[int]': "ToBasicIntVectorOptional",
248
+ 'int': "ToBasicIntOptional",
249
+ }
250
+ basic_type_convert = {
251
+ 'tuple[int]': "ToBasicIntVector",
252
+ 'list[int]': "ToBasicIntVector",
253
+ 'int': "ToBasicInt",
254
+ }
196
255
  if optional:
256
+ if use_basic_type and dtype in basic_optional_type_convert:
257
+ return basic_optional_type_convert[dtype]
197
258
  if dtype in optional_type_convert:
198
259
  return optional_type_convert[dtype]
199
260
  raise TypeError(f"""Unsupported convert optional type {dtype} for args.""")
261
+ if use_basic_type and dtype in basic_type_convert:
262
+ return basic_type_convert[dtype]
200
263
  if dtype in native_type_convert:
201
264
  return native_type_convert[dtype]
202
265
  raise TypeError(f"""Unsupported convert type {dtype} for args.""")
@@ -212,7 +275,7 @@ def tuple_input_to_cpp_type(dtype: str):
212
275
  'tuple[int]': 'int64_t',
213
276
  'tuple[float]': 'float',
214
277
  'tuple[bool]': 'bool',
215
- 'tuple[str]': 'string',
278
+ 'tuple[str]': 'std::string',
216
279
  'tuple[tensor]': 'mindspore::tensor::TensorPtr',
217
280
  'list[int]': 'int64_t',
218
281
  'list[float]': 'float',
@@ -227,12 +290,44 @@ def number_input_to_cpp_type(dtype: str):
227
290
  'int': 'int64_t',
228
291
  'float': 'float',
229
292
  'bool': 'bool',
230
- 'str': 'string'
293
+ 'str': 'std::string'
231
294
  }
232
295
  return types_map.get(dtype)
233
296
 
234
297
 
235
- def get_input_dtype(dtype: str, optional):
298
+ def input_dtype_to_cpp_type(dtype: str, optional):
299
+ """
300
+ Map input dtype to cpp dtype
301
+ """
302
+ type_convert = {
303
+ 'int': 'int64_t',
304
+ 'float': 'float',
305
+ 'bool': 'bool',
306
+ 'number': 'mindspore::ScalarPtr',
307
+ 'str': 'std::string',
308
+ 'tensor': 'mindspore::tensor::TensorPtr',
309
+ 'tuple[int]': 'std::vector<int64_t>',
310
+ 'tuple[float]': 'std::vector<float>',
311
+ 'tuple[bool]': 'std::vector<bool>',
312
+ 'tuple[tensor]': 'std::vector<mindspore::tensor::TensorPtr>',
313
+ 'list[int]': 'std::vector<int64_t>',
314
+ 'list[float]': 'std::vector<float>',
315
+ 'list[bool]': 'std::vector<bool>',
316
+ 'list[tensor]': 'std::vector<mindspore::tensor::TensorPtr>',
317
+ }
318
+ optional_tensor_type_convert = {
319
+ 'tensor': 'std::optional<mindspore::tensor::TensorPtr>',
320
+ 'tuple[tensor]': 'std::vector<mindspore::tensor::TensorPtr>',
321
+ 'list[tensor]': 'std::vector<mindspore::tensor::TensorPtr>'
322
+ }
323
+ if optional and dtype in optional_tensor_type_convert:
324
+ return optional_tensor_type_convert[dtype]
325
+ if dtype in type_convert:
326
+ return type_convert[dtype]
327
+ raise TypeError(f"""Unsupported dtype {dtype} for args.""")
328
+
329
+
330
+ def get_input_dtype(dtype: str, optional, use_basic_type=False):
236
331
  """
237
332
  Convert type
238
333
  """
@@ -244,7 +339,7 @@ def get_input_dtype(dtype: str, optional):
244
339
  'bool': 'mindspore::BoolImmPtr',
245
340
  'number': 'mindspore::ScalarPtr',
246
341
  'str': 'mindspore::StringImmPtr',
247
- 'tensor': 'mindspore::tensor::BaseTensorPtr',
342
+ 'tensor': 'mindspore::tensor::TensorPtr',
248
343
  'tuple[int]': value_tuple,
249
344
  'tuple[float]': value_tuple,
250
345
  'tuple[bool]': value_tuple,
@@ -261,16 +356,30 @@ def get_input_dtype(dtype: str, optional):
261
356
  'bool': 'std::optional<mindspore::BoolImmPtr>',
262
357
  'number': 'std::optional<mindspore::ScalarPtr>',
263
358
  'str': 'std::optional<mindspore::StringImmPtr>',
264
- 'tensor': 'std::optional<mindspore::tensor::BaseTensorPtr>',
359
+ 'tensor': 'std::optional<mindspore::tensor::TensorPtr>',
265
360
  'tuple[int]': value_tuple_optional,
266
361
  'tuple[float]': value_tuple_optional,
267
362
  'tuple[bool]': value_tuple_optional,
268
363
  'tuple[tensor]': value_tuple_optional,
269
364
  }
365
+ basic_optional_type_convert = {
366
+ 'tuple[int]': "std::optional<std::vector<int64_t>>",
367
+ 'list[int]': "std::optional<std::vector<int64_t>>",
368
+ 'int': "std::optional<int64_t>",
369
+ }
370
+ basic_type_convert = {
371
+ 'tuple[int]': "std::vector<int64_t>",
372
+ 'list[int]': "std::vector<int64_t>",
373
+ 'int': "int64_t",
374
+ }
270
375
  if optional:
376
+ if use_basic_type and dtype in basic_optional_type_convert:
377
+ return basic_optional_type_convert[dtype]
271
378
  if dtype in optional_type_convert:
272
379
  return optional_type_convert[dtype]
273
380
  raise TypeError(f"""Unsupported convert optional type {dtype} for args.""")
381
+ if use_basic_type and dtype in basic_type_convert:
382
+ return basic_type_convert[dtype]
274
383
  if dtype in type_convert:
275
384
  return type_convert[dtype]
276
385
  raise TypeError(f"""Unsupported convert type {dtype} for args.""")
@@ -343,7 +452,7 @@ def get_tuple_input_convert(arg_name, arg_type):
343
452
  """
344
453
  cpp_type = tuple_input_to_cpp_type(arg_type)
345
454
  if cpp_type == "mindspore::tensor::TensorPtr":
346
- cpp_type = "mindspore::tensor::BaseTensorPtr"
455
+ cpp_type = "mindspore::tensor::TensorPtr"
347
456
  return f"std::vector<{cpp_type}> {arg_name}_vector = ConvertValueTupleToVector<{cpp_type}>({arg_name});\n"
348
457
 
349
458
 
@@ -37,15 +37,6 @@ class TensorPyCppGenerator(BaseGenerator):
37
37
  '{"${snake_api_name}"'
38
38
  ', (PyCFunction)TensorMethod${pascal_api_name}_CPyWrapper, METH_VARARGS | METH_KEYWORDS},'
39
39
  )
40
- self.stubtensor_api_def_template = Template(
41
- 'py::cpp_function TensorMethod${snake_api_name}_wrapper(\n'
42
- ' [](const py::object& self, const py::args& args, const py::kwargs& kwargs) {\n'
43
- ' return TensorMethod${pascal_api_name}(self, args, kwargs);\n'
44
- ' },\n'
45
- ' py::is_method(stubTensorClass)\n'
46
- ');\n'
47
- 'stubTensorClass.attr("${snake_api_name}") = TensorMethod${snake_api_name}_wrapper;'
48
- )
49
40
 
50
41
  def generate(self, work_path, tensor_method_protos, alias_func_mapping):
51
42
  """
@@ -61,7 +52,6 @@ class TensorPyCppGenerator(BaseGenerator):
61
52
  """
62
53
  wrapper_defs = []
63
54
  tensor_api_defs = []
64
- stubtensor_api_defs = []
65
55
  for api_name, _ in tensor_method_protos.items():
66
56
  pascal_api_name = pyboost_utils.format_func_api_name(api_name)
67
57
  snake_api_name = api_name
@@ -72,12 +62,6 @@ class TensorPyCppGenerator(BaseGenerator):
72
62
  pascal_api_name=pascal_api_name
73
63
  )
74
64
  )
75
- stubtensor_api_defs.append(
76
- self.stubtensor_api_def_template.replace(
77
- snake_api_name=snake_api_name,
78
- pascal_api_name=pascal_api_name
79
- )
80
- )
81
65
  if api_name in alias_func_mapping:
82
66
  alias_api_names = alias_func_mapping[api_name]
83
67
  for alias_api_name in alias_api_names:
@@ -88,19 +72,12 @@ class TensorPyCppGenerator(BaseGenerator):
88
72
  pascal_api_name=pascal_api_name
89
73
  )
90
74
  )
91
- stubtensor_api_defs.append(
92
- self.stubtensor_api_def_template.replace(
93
- snake_api_name=snake_api_name,
94
- pascal_api_name=pascal_api_name
95
- )
96
- )
97
75
 
98
76
  # delete the ' \' for the last wrapper macro definition
99
77
  wrapper_defs[-1] = wrapper_defs[-1][:-2]
100
78
 
101
79
  file_str = self.TENSOR_PY_CC_TEMPLATE.replace(
102
- tensor_api_defs=tensor_api_defs,
103
- stubtensor_api_defs=stubtensor_api_defs
80
+ tensor_api_defs=tensor_api_defs
104
81
  )
105
82
  save_file(
106
83
  os.path.join(work_path, K.TENSOR_PY_CC_PATH),
@@ -81,6 +81,7 @@ class _PipelineScheduler:
81
81
  PIPELINE_SEQPIPE = "seqpipe"
82
82
  PIPELINE_SEQVPP = "seqvpp"
83
83
  PIPELINE_SEQSMARTVPP = "seqsmartvpp"
84
+ PIPELINE_ZBV = "zero_bubble_v"
84
85
 
85
86
 
86
87
  class _AutoParallelContext:
@@ -434,13 +435,6 @@ class _AutoParallelContext:
434
435
  """
435
436
  self.check_context_handle()
436
437
  run_mode = context.get_context("mode")
437
- if run_mode == context.PYNATIVE_MODE and parallel_mode not in (
438
- context.ParallelMode.DATA_PARALLEL, context.ParallelMode.STAND_ALONE,
439
- context.ParallelMode.AUTO_PARALLEL):
440
- raise ValueError(f"Pynative only supports STAND_ALONE, DATA_PARALLEL and AUTO_PARALLEL using"
441
- f" sharding_propagation under shard function"
442
- f" for ParallelMode, "
443
- f"but got {parallel_mode.upper()}.")
444
438
  ret = self._context_handle.set_parallel_mode(parallel_mode)
445
439
  if ret is False:
446
440
  raise ValueError("The context configuration parameter 'parallel_mode' only support 'stand_alone', "
@@ -604,9 +598,6 @@ class _AutoParallelContext:
604
598
  if not isinstance(dim, int):
605
599
  raise TypeError("For 'set_auto_parallel_context', the element of argument "
606
600
  "'dataset_strategy' must be int type, but got the type : {} .".format(type(dim)))
607
- if context.get_context('mode') == context.PYNATIVE_MODE:
608
- raise ValueError("In PyNative mode, the setting value of 'dataset_strategy' must be either 'full_batch' "
609
- f"or 'data_parallel', but got {dataset_strategy}.")
610
601
  self._dataset_strategy_using_str = False
611
602
  self._context_handle.set_dataset_strategy(dataset_strategy)
612
603
 
@@ -646,9 +637,6 @@ class _AutoParallelContext:
646
637
  return "full_batch"
647
638
  return "data_parallel"
648
639
  dataset_strategy = self._context_handle.get_dataset_strategy()
649
- if context.get_context('mode') == context.PYNATIVE_MODE:
650
- raise ValueError("In PyNative mode, the value of 'dataset_strategy' must be either 'full_batch' "
651
- f"or 'data_parallel', but got the setting value is {dataset_strategy}.")
652
640
  return dataset_strategy
653
641
 
654
642
  def set_grad_accumulation_step(self, grad_accumulation_step):
@@ -662,7 +650,7 @@ class _AutoParallelContext:
662
650
  raise ValueError("The interface is deprecated. To use gradient accumulation, "
663
651
  "please use GradAccumulationCell in mindspore.nn.wrap.cell_wrapper.")
664
652
  self.check_context_handle()
665
- Validator.check_positive_int(grad_accumulation_step)
653
+ Validator.check_positive_int(grad_accumulation_step, prim_name='grad_accumulation_step')
666
654
  self._context_handle.set_grad_accumulation_step(grad_accumulation_step)
667
655
 
668
656
  def get_grad_accumulation_step(self):
@@ -998,9 +986,13 @@ class _AutoParallelContext:
998
986
  _PipelineScheduler.PIPELINE_GPIPE,
999
987
  _PipelineScheduler.PIPELINE_SEQPIPE,
1000
988
  _PipelineScheduler.PIPELINE_SEQVPP,
989
+ _PipelineScheduler.PIPELINE_SEQSMARTVPP,
990
+ _PipelineScheduler.PIPELINE_ZBV,
1001
991
  _PipelineScheduler.PIPELINE_SEQSMARTVPP])
1002
- if not pipeline_config[pp_interleave] and pipeline_config[pp_scheduler] != _PipelineScheduler.PIPELINE_1F1B:
1003
- raise ValueError(f"When pipeline_interleave is False, {pp_scheduler} is not supported")
992
+ scheduler_val = pipeline_config[pp_scheduler]
993
+ if not pipeline_config[pp_interleave] and scheduler_val != _PipelineScheduler.PIPELINE_1F1B:
994
+ raise TypeError(f"When pipeline_interleave is False, {scheduler_val!r} is not supported, "
995
+ "only '1f1b' is allowed.")
1004
996
 
1005
997
  self._context_handle.set_pipeline_scheduler(pipeline_config[pp_scheduler])
1006
998
 
@@ -1070,7 +1062,7 @@ class _AutoParallelContext:
1070
1062
 
1071
1063
  if threshold_name in parallel_optimizer_config:
1072
1064
  Validator.check_non_negative_int(
1073
- parallel_optimizer_config[threshold_name])
1065
+ parallel_optimizer_config[threshold_name], prim_name=threshold_name)
1074
1066
  self._context_handle.set_parallel_optimizer_threshold(
1075
1067
  parallel_optimizer_config[threshold_name])
1076
1068
 
@@ -26,7 +26,7 @@ from mindspore.ops.operations.comm_ops import AllGather
26
26
  from mindspore.communication import GlobalComm, get_rank
27
27
  from mindspore.common import jit
28
28
  from mindspore.communication import create_group, destroy_group, get_group_size
29
- from mindspore.communication._comm_helper import _get_group_map
29
+ from mindspore.communication._comm_helper import _get_group_map, _remove_group_info
30
30
  from mindspore.train._utils import get_parameter_redundancy, remove_param_redundancy
31
31
  from mindspore.parallel.shard import Layout
32
32
 
@@ -119,20 +119,18 @@ def destroy_allgather_cell():
119
119
 
120
120
  def _chang_parallel_context(origin_dataset_strategy):
121
121
  """Change the original parallel state."""
122
- if context.get_context("mode") == context.GRAPH_MODE:
123
- context.set_auto_parallel_context(parallel_mode="hybrid_parallel")
124
- if origin_dataset_strategy != "data_parallel":
125
- context.set_auto_parallel_context(dataset_strategy="data_parallel")
122
+ context.set_auto_parallel_context(parallel_mode="hybrid_parallel")
123
+ if origin_dataset_strategy != "data_parallel":
124
+ context.set_auto_parallel_context(dataset_strategy="data_parallel")
126
125
 
127
126
 
128
127
  def _restore_parallel_context(origin_parallel_mode, origin_dataset_strategy):
129
128
  """Restore the original parallel state."""
130
- if context.get_context("mode") == context.GRAPH_MODE:
131
- context.set_auto_parallel_context(parallel_mode=origin_parallel_mode)
132
- if origin_dataset_strategy != "data_parallel":
133
- if origin_dataset_strategy is not None and isinstance(origin_dataset_strategy, list):
134
- origin_dataset_strategy = tuple(tuple(ds_item) for ds_item in origin_dataset_strategy)
135
- context.set_auto_parallel_context(dataset_strategy=origin_dataset_strategy)
129
+ context.set_auto_parallel_context(parallel_mode=origin_parallel_mode)
130
+ if origin_dataset_strategy != "data_parallel":
131
+ if origin_dataset_strategy is not None and isinstance(origin_dataset_strategy, list):
132
+ origin_dataset_strategy = tuple(tuple(ds_item) for ds_item in origin_dataset_strategy)
133
+ context.set_auto_parallel_context(dataset_strategy=origin_dataset_strategy)
136
134
 
137
135
 
138
136
  def _get_group_name(group_map, group):
@@ -166,11 +164,92 @@ def _remove_param_not_load(param_name, param_not_load):
166
164
  param_not_load.remove(param_name)
167
165
 
168
166
 
169
- def _single_parameter_broadcast(net, layout, param_not_load=None):
167
+ def _get_param_index_in_group(total_param_loaded, group, param):
168
+ """Get param_index in group."""
169
+ param_rank_index = []
170
+ for rank_id in group:
171
+ if rank_id < len(total_param_loaded):
172
+ if param in total_param_loaded[rank_id]:
173
+ param_rank_index.append(rank_id)
174
+ else:
175
+ raise ValueError("rank_id should be smaller than total rank num")
176
+ return param_rank_index
177
+
178
+
179
+ def _communicate_allreduce(allreduce_input, group_map, group):
180
+ """Communicate allreduce input."""
181
+ if not allreduce_input:
182
+ return
183
+ from mindspore import Tensor
184
+ group_name, is_manual_communication_group = _get_group_name(group_map, group)
185
+ if is_manual_communication_group:
186
+ create_group(group_name, list(group))
187
+ communicator = SingleCommunicator(group_name)
188
+ for real_param in allreduce_input:
189
+ real_param.set_data(communicator(Tensor(real_param)), real_param.sliced)
190
+ if is_manual_communication_group:
191
+ destroy_group(group_name)
192
+ _remove_group_info(group_name)
193
+
194
+
195
+ def _create_allreduce_input(params, group, net_param_dict, total_param_loaded, param_not_load, cur_rank):
196
+ """Creates allreduce input."""
197
+ from mindspore import Tensor
198
+ allreduce_input = []
199
+ for param in params:
200
+ if param not in net_param_dict:
201
+ continue
202
+ if param.startswith("accu_grads") or param.endswith("expert_load"):
203
+ continue
204
+ param_rank_index = _get_param_index_in_group(total_param_loaded, group, param)
205
+ if not param_rank_index:
206
+ continue
207
+ elif len(param_rank_index) == 1:
208
+ real_param = net_param_dict[param]
209
+ _remove_param_not_load(real_param.name, param_not_load)
210
+ if cur_rank != param_rank_index[0]:
211
+ real_param.set_data(Tensor(np.zeros(real_param.shape), dtype=real_param.dtype), real_param.sliced)
212
+ allreduce_input.append(real_param)
213
+ elif len(param_rank_index) > 1:
214
+ raise ValueError(f"For param {param} in group {group} should be in one rank, but in {param_rank_index}.")
215
+ return allreduce_input
216
+
217
+
218
+ def _get_sorted_group_map():
219
+ """Get the world group map."""
220
+ group_map = _get_group_map()
221
+ if group_map:
222
+ group_map = {key: group_map[key] for key in sorted(group_map.keys())}
223
+ return group_map
224
+
225
+
226
+ def _check_total_param_loaded(total_param_loaded):
227
+ """Check total_param_loaded."""
228
+ flag = True
229
+ for rank_id, param_loaded in enumerate(total_param_loaded):
230
+ if rank_id not in param_loaded:
231
+ flag = False
232
+ logger.warning("The order of loaded parameters on each card obtained by all_gather_object is incorrect,"
233
+ "and the parameter broadcast will reorder them.")
234
+ break
235
+ if not flag:
236
+ new_total_param_loaded = [None] * len(total_param_loaded)
237
+ for _, param_loaded in enumerate(total_param_loaded):
238
+ for param in param_loaded:
239
+ if isinstance(param, int):
240
+ new_total_param_loaded[param] = param_loaded
241
+ break
242
+ return new_total_param_loaded
243
+ return total_param_loaded
244
+
245
+
246
+ def _single_parameter_broadcast(net, layout, param_not_load=None, param_loaded=None):
170
247
  """
171
248
  Broadcast single parameter to other rank in data parallel dimension.
172
249
  """
173
- from mindspore import Tensor
250
+ logger.info("Start loading the parameter broadcast for removing redundant parameters.")
251
+ from mindspore.runtime import synchronize
252
+ from mindspore.mint.distributed import all_gather_object
174
253
  origin_parallel_mode = context.get_auto_parallel_context("parallel_mode")
175
254
  origin_dataset_strategy = context.get_auto_parallel_context("dataset_strategy")
176
255
  cur_rank = get_rank()
@@ -188,33 +267,20 @@ def _single_parameter_broadcast(net, layout, param_not_load=None):
188
267
  return
189
268
  net_param_dict = net.parameters_dict()
190
269
  _chang_parallel_context(origin_dataset_strategy)
191
- group_map = _get_group_map()
192
- if group_map:
193
- group_map = {key: group_map[key] for key in sorted(group_map.keys())}
270
+ param_loaded.add(cur_rank)
271
+ total_num = get_group_size()
272
+ total_param_loaded = [None] * total_num
273
+ synchronize()
274
+ all_gather_object(total_param_loaded, param_loaded)
275
+ total_param_loaded = _check_total_param_loaded(total_param_loaded)
276
+ group_map = _get_sorted_group_map()
194
277
  for group, params in param_redundancy_reversed.items():
195
- group_name, is_manual_communication_group = _get_group_name(group_map, group)
196
- allreduce_input = []
197
- for param in params:
198
- if param not in net_param_dict:
199
- continue
200
- if param.startswith("accu_grads") or param.endswith("expert_load"):
201
- continue
202
- real_param = net_param_dict[param]
203
- _remove_param_not_load(real_param.name, param_not_load)
204
- if param not in single_params[cur_rank]:
205
- real_param.set_data(Tensor(np.zeros(real_param.shape), dtype=real_param.dtype), real_param.sliced)
206
- allreduce_input.append(real_param)
207
- if not allreduce_input:
208
- continue
209
- if is_manual_communication_group:
210
- create_group(group_name, list(group))
211
- allreduce_input.sort(key=lambda param: (str(param.shape), str(param.dtype)))
212
- communicator = SingleCommunicator(group_name)
213
- for real_param in allreduce_input:
214
- real_param.set_data(communicator(Tensor(real_param)), real_param.sliced)
215
- if is_manual_communication_group:
216
- destroy_group(group_name)
278
+ allreduce_input = _create_allreduce_input(params, group, net_param_dict, total_param_loaded, param_not_load,
279
+ cur_rank)
280
+ _communicate_allreduce(allreduce_input, group_map, group)
217
281
  _restore_parallel_context(origin_parallel_mode, origin_dataset_strategy)
282
+ synchronize()
283
+ logger.info("End loading the parameter broadcast for removing redundant parameters.")
218
284
 
219
285
 
220
286
  def _insert_virtual_pp_dim(layout):
@@ -272,8 +338,8 @@ class CommTensorDataForPP(Cell):
272
338
  global ALLREDUCE_GROUP_LIST
273
339
  current_rank_stage_id = self._current_rank_id // self._from_dev_num_in_stage
274
340
  end_stage = self._from_dev_num_in_stage * (current_rank_stage_id + 1)
275
- rank_pos_in_stage = [rank_id for rank_id in range(self._from_dev_num_in_stage * current_rank_stage_id,
276
- end_stage)].index(self._current_rank_id)
341
+ start_stage = self._from_dev_num_in_stage * current_rank_stage_id
342
+ rank_pos_in_stage = list(range(start_stage, end_stage)).index(self._current_rank_id)
277
343
  root_idx = self._from_rank_id[rank_pos_in_stage]
278
344
  all_reduce_rank_list = [self._from_rank_id[rank_pos_in_stage]]
279
345
  while rank_pos_in_stage < len(self._diff_rank_id):
@@ -144,8 +144,7 @@ def _build_protobuf_strategy(strategy_filename):
144
144
  parallel_strategy_map = _load_protobuf_strategy(strategy_filename)
145
145
  layout_items = parallel_strategy_map.parallel_layout_item
146
146
  if not layout_items:
147
- raise ValueError(f"For 'build_searched_strategy', the strategy file {strategy_filename} has no sliced "
148
- f"parameter, please check whether the 'strategy_filename' is correct.")
147
+ return {}
149
148
 
150
149
  strategy = {}
151
150
  for layout_item in layout_items:
@@ -159,6 +158,8 @@ def _build_json_strategy(strategy_filename):
159
158
  """build strategy from json file"""
160
159
  with open(strategy_filename, 'r') as f:
161
160
  json_content = json.load(f)
161
+ if "parallel_layout_item" not in json_content:
162
+ return {}
162
163
  layout_items = json_content.get("parallel_layout_item")
163
164
  strategy = {}
164
165
  for parameter_name, layout_item in layout_items.items():
@@ -278,7 +279,7 @@ def _extract_pipeline_stage_num(strategy_file):
278
279
  pipeline_stage_set.update(layout[6])
279
280
  pipeline_stage_num = len(pipeline_stage_set)
280
281
  if list(pipeline_stage_set) != list(range(pipeline_stage_num)):
281
- raise ValueError("The strategy file for pipeline parallel dose not contains all stages.")
282
+ raise ValueError("The strategy file for pipeline parallel does not contains all stages.")
282
283
  return pipeline_stage_num
283
284
 
284
285
 
@@ -65,7 +65,6 @@ _set_ps_context_func_map = {
65
65
  "enable_ssl": ps_context().set_enable_ssl,
66
66
  "client_password": ps_context().set_client_password,
67
67
  "server_password": ps_context().set_server_password,
68
- "scheduler_manage_port": ps_context().set_scheduler_manage_port,
69
68
  "config_file_path": ps_context().set_config_file_path,
70
69
  }
71
70
 
@@ -78,12 +77,10 @@ _get_ps_context_func_map = {
78
77
  "scheduler_ip": ps_context().scheduler_ip,
79
78
  "scheduler_port": ps_context().scheduler_port,
80
79
  "enable_ssl": ps_context().enable_ssl,
81
- "client_password": ps_context().client_password,
82
- "server_password": ps_context().server_password,
83
- "scheduler_manage_port": ps_context().scheduler_manage_port,
84
80
  "config_file_path": ps_context().config_file_path,
85
81
  }
86
82
 
83
+
87
84
  def _get_ps_mode_rank():
88
85
  ps_rank = ps_context().ps_rank_id()
89
86
  if ps_rank == -1:
@@ -116,8 +113,9 @@ def _set_ps_context(**kwargs):
116
113
  Only after enable_ps is set True, the environment variables will be effective.
117
114
  Default: ``False``.
118
115
  config_file_path (str): Configuration file path used by recovery. Default: ''.
119
- scheduler_manage_port (int): scheduler manage port used to scale out/in. Default: 11202.
120
116
  enable_ssl (bool): Set PS SSL mode enabled or disabled. Default: ``False``.
117
+ When set to False, users need to review and confirm the security of network environment
118
+ where the distributed job is located.
121
119
  client_password (str): Password to decrypt the secret key stored in the client certificate. Default: ''.
122
120
  server_password (str): Password to decrypt the secret key stored in the server certificate. Default: ''.
123
121
 
@@ -126,7 +124,7 @@ def _set_ps_context(**kwargs):
126
124
 
127
125
  Examples:
128
126
  >>> import mindspore as ms
129
- >>> ms.set_ps_context(enable_ps=True, enable_ssl=True, client_password='123456', server_password='123456')
127
+ >>> ms.set_ps_context(enable_ps=True, enable_ssl=True, client_password='', server_password='')
130
128
  """
131
129
  for key, value in kwargs.items():
132
130
  if key not in _set_ps_context_func_map: