mindspore 2.6.0__cp311-cp311-win_amd64.whl → 2.7.0rc1__cp311-cp311-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.
- mindspore/.commit_id +1 -1
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/__init__.py +1 -1
- mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +40 -9
- mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
- mindspore/_extends/optimize/cell_utils.py +96 -0
- mindspore/_extends/parse/__init__.py +2 -2
- mindspore/_extends/parse/compile_config.py +44 -22
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -1
- mindspore/_extends/parse/parser.py +36 -61
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +32 -13
- mindspore/_extends/parse/trope.py +8 -1
- mindspore/_extends/pijit/__init__.py +1 -2
- mindspore/amp.py +4 -4
- mindspore/atlprov.dll +0 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/boost/adasum.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +4 -4
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +27 -2
- mindspore/common/_grad_function.py +2 -1
- mindspore/common/_pijit_context.py +28 -7
- mindspore/common/_stub_tensor.py +1 -209
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +76 -15
- mindspore/common/api.py +193 -112
- mindspore/common/dtype.py +21 -11
- mindspore/common/dump.py +10 -15
- mindspore/common/generator.py +2 -3
- mindspore/common/hook_handle.py +11 -2
- mindspore/common/jit_config.py +1 -1
- mindspore/common/jit_trace.py +84 -105
- mindspore/common/parameter.py +26 -12
- mindspore/common/recompute.py +3 -3
- mindspore/common/sparse_tensor.py +0 -3
- mindspore/common/symbol.py +0 -1
- mindspore/common/tensor.py +48 -83
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +38 -23
- mindspore/dataset/core/config.py +3 -3
- mindspore/dataset/engine/datasets.py +20 -7
- mindspore/dataset/engine/datasets_user_defined.py +32 -2
- mindspore/dataset/engine/iterators.py +2 -2
- mindspore/dataset/engine/obs/config_loader.py +2 -2
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
- mindspore/dataset/transforms/py_transforms.py +7 -3
- mindspore/dataset/transforms/transforms.py +7 -3
- mindspore/dataset/vision/validators.py +1 -0
- mindspore/device_context/ascend/device.py +1 -1
- mindspore/device_context/gpu/__init__.py +2 -2
- mindspore/device_context/gpu/device.py +1 -1
- mindspore/device_context/gpu/op_precision.py +4 -2
- mindspore/device_context/gpu/op_tuning.py +6 -3
- mindspore/device_manager.py +16 -9
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +3 -5
- mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
- mindspore/experimental/optim/adadelta.py +13 -20
- mindspore/experimental/optim/adagrad.py +15 -22
- mindspore/experimental/optim/adam.py +17 -24
- mindspore/experimental/optim/adamax.py +14 -22
- mindspore/experimental/optim/adamw.py +28 -34
- mindspore/experimental/optim/asgd.py +15 -25
- mindspore/experimental/optim/lr_scheduler.py +27 -45
- mindspore/experimental/optim/nadam.py +14 -24
- mindspore/experimental/optim/optimizer.py +13 -23
- mindspore/experimental/optim/radam.py +18 -24
- mindspore/experimental/optim/rmsprop.py +14 -25
- mindspore/experimental/optim/rprop.py +15 -26
- mindspore/experimental/optim/sgd.py +9 -19
- mindspore/hal/__init__.py +4 -4
- mindspore/hal/contiguous_tensors_handle.py +2 -2
- mindspore/hal/memory.py +1 -0
- mindspore/include/api/cell.h +37 -1
- mindspore/include/api/delegate.h +10 -0
- mindspore/include/api/model.h +3 -0
- mindspore/include/api/types.h +2 -2
- mindspore/include/c_api/model_c.h +0 -58
- mindspore/include/c_api/tensor_c.h +0 -26
- mindspore/include/dataset/vision_ascend.h +1 -1
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +60 -11
- mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_cpu_res_manager.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mindspore_ops_host.dll +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mint/__init__.py +4 -44
- mindspore/mint/distributed/__init__.py +1 -0
- mindspore/mint/distributed/distributed.py +208 -5
- mindspore/mint/nn/__init__.py +1 -1
- mindspore/mint/nn/functional.py +53 -6
- mindspore/mint/nn/layer/_functions.py +164 -294
- mindspore/mint/nn/layer/activation.py +8 -6
- mindspore/mint/nn/layer/conv.py +122 -98
- mindspore/mint/nn/layer/normalization.py +8 -22
- mindspore/mint/optim/adam.py +19 -18
- mindspore/mint/optim/adamw.py +14 -8
- mindspore/mint/optim/sgd.py +5 -5
- mindspore/msobj140.dll +0 -0
- mindspore/mspdb140.dll +0 -0
- mindspore/mspdbcore.dll +0 -0
- mindspore/mspdbst.dll +0 -0
- mindspore/mspft140.dll +0 -0
- mindspore/msvcdis140.dll +0 -0
- mindspore/msvcp140_1.dll +0 -0
- mindspore/msvcp140_2.dll +0 -0
- mindspore/msvcp140_atomic_wait.dll +0 -0
- mindspore/msvcp140_codecvt_ids.dll +0 -0
- mindspore/nn/cell.py +325 -499
- mindspore/nn/grad/cell_grad.py +11 -12
- mindspore/nn/layer/activation.py +32 -34
- mindspore/nn/layer/basic.py +67 -64
- mindspore/nn/layer/channel_shuffle.py +4 -4
- mindspore/nn/layer/combined.py +4 -2
- mindspore/nn/layer/conv.py +86 -85
- mindspore/nn/layer/dense.py +9 -7
- mindspore/nn/layer/embedding.py +50 -52
- mindspore/nn/layer/image.py +37 -39
- mindspore/nn/layer/math.py +111 -112
- mindspore/nn/layer/normalization.py +56 -44
- mindspore/nn/layer/pooling.py +58 -63
- mindspore/nn/layer/rnn_cells.py +33 -33
- mindspore/nn/layer/rnns.py +56 -56
- mindspore/nn/layer/thor_layer.py +74 -73
- mindspore/nn/layer/transformer.py +11 -1
- mindspore/nn/learning_rate_schedule.py +20 -20
- mindspore/nn/loss/loss.py +79 -81
- mindspore/nn/optim/adam.py +1 -1
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/optimizer.py +1 -1
- mindspore/nn/optim/thor.py +2 -2
- mindspore/nn/probability/distribution/exponential.py +2 -1
- mindspore/nn/probability/distribution/poisson.py +2 -1
- mindspore/nn/sparse/sparse.py +3 -3
- mindspore/nn/wrap/cell_wrapper.py +34 -37
- mindspore/nn/wrap/grad_reducer.py +37 -37
- mindspore/nn/wrap/loss_scale.py +72 -74
- mindspore/numpy/array_creations.py +5 -5
- mindspore/numpy/fft.py +1 -1
- mindspore/numpy/math_ops.py +1 -1
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
- mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
- mindspore/ops/_vmap/vmap_array_ops.py +6 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +17 -8
- mindspore/ops/auto_generate/gen_extend_func.py +1 -51
- mindspore/ops/auto_generate/gen_ops_def.py +463 -257
- mindspore/ops/auto_generate/gen_ops_prim.py +1127 -885
- mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
- mindspore/ops/composite/__init__.py +10 -0
- mindspore/ops/composite/base.py +8 -4
- mindspore/ops/composite/multitype_ops/__init__.py +12 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +132 -108
- mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
- mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
- mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
- mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
- mindspore/ops/function/__init__.py +3 -1
- mindspore/ops/function/_add_attr_func.py +11 -6
- mindspore/ops/function/array_func.py +7 -94
- mindspore/ops/function/debug_func.py +4 -3
- mindspore/ops/function/grad/grad_func.py +1 -1
- mindspore/ops/function/math_func.py +21 -367
- mindspore/ops/function/nn_func.py +26 -41
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +31 -4
- mindspore/ops/functional.py +0 -2
- mindspore/ops/functional_overload.py +463 -6
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +5 -2
- mindspore/ops/operations/_custom_ops_utils.py +675 -8
- mindspore/ops/operations/_inner_ops.py +3 -6
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/comm_ops.py +185 -26
- mindspore/ops/operations/custom_ops.py +235 -172
- mindspore/ops/operations/debug_ops.py +55 -4
- mindspore/ops/operations/image_ops.py +13 -13
- mindspore/ops/operations/manually_defined/ops_def.py +15 -16
- mindspore/ops/operations/math_ops.py +3 -4
- mindspore/ops/operations/nn_ops.py +5 -6
- mindspore/ops/primitive.py +6 -10
- mindspore/ops/tensor_method.py +36 -4
- mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
- mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
- mindspore/ops_generate/api/functions_cc_generator.py +58 -10
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
- mindspore/ops_generate/common/base_generator.py +14 -0
- mindspore/ops_generate/common/gen_constants.py +7 -2
- mindspore/ops_generate/common/gen_utils.py +0 -19
- mindspore/ops_generate/common/op_proto.py +11 -4
- mindspore/ops_generate/common/template.py +88 -11
- mindspore/ops_generate/gen_ops.py +1 -1
- mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
- mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -0
- mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
- mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
- mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
- mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
- mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
- mindspore/parallel/_auto_parallel_context.py +4 -2
- mindspore/parallel/_cell_wrapper.py +106 -40
- mindspore/parallel/_parallel_serialization.py +1 -1
- mindspore/parallel/_ps_context.py +4 -6
- mindspore/parallel/_tensor.py +167 -12
- mindspore/parallel/_transformer/moe.py +1 -1
- mindspore/parallel/_transformer/transformer.py +13 -8
- mindspore/parallel/auto_parallel.py +12 -5
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +3 -1
- mindspore/parallel/cluster/process_entity/_api.py +84 -48
- mindspore/parallel/cluster/process_entity/_utils.py +95 -7
- mindspore/parallel/cluster/run.py +43 -4
- mindspore/parallel/function/__init__.py +8 -1
- mindspore/parallel/function/reshard_func.py +1 -1
- mindspore/parallel/nn/__init__.py +15 -2
- mindspore/parallel/nn/parallel_cell_wrapper.py +9 -10
- mindspore/parallel/nn/parallel_grad_reducer.py +7 -6
- mindspore/parallel/shard.py +2 -2
- mindspore/parallel/transform_safetensors.py +462 -174
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +2 -1
- mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
- mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +3 -0
- mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
- mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
- mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
- mindspore/profiler/analysis/task_manager.py +1 -1
- mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
- mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +42 -22
- mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
- mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
- mindspore/profiler/common/constant.py +16 -0
- mindspore/profiler/common/profiler_context.py +25 -27
- mindspore/profiler/common/profiler_info.py +0 -16
- mindspore/profiler/common/profiler_op_analyse.py +235 -0
- mindspore/profiler/common/profiler_output_path.py +23 -8
- mindspore/profiler/common/profiler_parameters.py +128 -35
- mindspore/profiler/dynamic_profile/__init__.py +0 -0
- mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
- mindspore/profiler/dynamic_profiler.py +305 -314
- mindspore/profiler/envprofiler.py +12 -7
- mindspore/profiler/experimental_config.py +96 -6
- mindspore/profiler/mstx.py +33 -12
- mindspore/profiler/platform/__init__.py +2 -3
- mindspore/profiler/platform/npu_profiler.py +29 -19
- mindspore/profiler/profiler.py +35 -19
- mindspore/profiler/profiler_action_controller.py +64 -76
- mindspore/profiler/schedule.py +10 -4
- mindspore/rewrite/common/config.py +1 -0
- mindspore/rewrite/common/namer.py +1 -0
- mindspore/rewrite/common/namespace.py +1 -0
- mindspore/rewrite/node/node.py +31 -11
- mindspore/rewrite/parsers/assign_parser.py +1 -1
- mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
- mindspore/run_check/_check_version.py +7 -10
- mindspore/runtime/__init__.py +5 -5
- mindspore/runtime/event.py +10 -4
- mindspore/runtime/executor.py +60 -45
- mindspore/runtime/memory.py +21 -30
- mindspore/runtime/thread_bind_core.py +298 -164
- mindspore/safeguard/rewrite_obfuscation.py +12 -13
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/_utils.py +6 -2
- mindspore/train/amp.py +43 -20
- mindspore/train/callback/__init__.py +5 -5
- mindspore/train/callback/_checkpoint.py +3 -6
- mindspore/train/callback/_flops_collector.py +1 -1
- mindspore/train/callback/_landscape.py +0 -1
- mindspore/train/callback/_train_fault_tolerance.py +71 -13
- mindspore/train/data_sink.py +11 -2
- mindspore/train/dataset_helper.py +9 -0
- mindspore/train/model.py +51 -33
- mindspore/train/serialization.py +133 -111
- mindspore/train/summary/summary_record.py +13 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +3 -2
- mindspore/utils/dryrun.py +0 -6
- mindspore/utils/runtime_execution_order_check.py +162 -78
- mindspore/utils/sdc_detect.py +68 -0
- mindspore/utils/utils.py +6 -9
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/METADATA +5 -4
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/RECORD +352 -390
- mindspore/_deprecated/jit.py +0 -198
- mindspore/experimental/es/__init__.py +0 -22
- mindspore/experimental/es/embedding_service.py +0 -891
- mindspore/experimental/es/embedding_service_layer.py +0 -581
- mindspore/profiler/parser/__init__.py +0 -14
- mindspore/profiler/parser/aicpu_data_parser.py +0 -272
- mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
- mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
- mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
- mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
- mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
- mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
- mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
- mindspore/profiler/parser/ascend_flops_generator.py +0 -116
- mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
- mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
- mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
- mindspore/profiler/parser/ascend_op_generator.py +0 -334
- mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
- mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
- mindspore/profiler/parser/base_timeline_generator.py +0 -483
- mindspore/profiler/parser/container.py +0 -229
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
- mindspore/profiler/parser/flops_parser.py +0 -531
- mindspore/profiler/parser/framework_enum.py +0 -111
- mindspore/profiler/parser/framework_parser.py +0 -464
- mindspore/profiler/parser/framework_struct.py +0 -61
- mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
- mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
- mindspore/profiler/parser/hccl_parser.py +0 -573
- mindspore/profiler/parser/hwts_log_parser.py +0 -122
- mindspore/profiler/parser/integrator.py +0 -526
- mindspore/profiler/parser/memory_usage_parser.py +0 -277
- mindspore/profiler/parser/minddata_analyzer.py +0 -800
- mindspore/profiler/parser/minddata_parser.py +0 -186
- mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
- mindspore/profiler/parser/op_intermediate_parser.py +0 -149
- mindspore/profiler/parser/optime_parser.py +0 -250
- mindspore/profiler/parser/profiler_info.py +0 -213
- mindspore/profiler/parser/step_trace_parser.py +0 -666
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/top_level.txt +0 -0
mindspore/dataset/core/config.py
CHANGED
|
@@ -1097,12 +1097,12 @@ def get_error_samples_mode():
|
|
|
1097
1097
|
return _CDE_TO_PYTHON_ERROR_SAMPLES_MODE.get(_config.get_error_samples_mode())
|
|
1098
1098
|
|
|
1099
1099
|
|
|
1100
|
-
def set_iterator_mode(do_copy=
|
|
1100
|
+
def set_iterator_mode(do_copy=False, parallel_convert=False):
|
|
1101
1101
|
"""
|
|
1102
1102
|
Select dataset iterator optimization strategy.
|
|
1103
1103
|
|
|
1104
1104
|
Args:
|
|
1105
|
-
do_copy (bool): Whether dataset iterator creates a Tensor from numpy.ndarray without copy. Default: "
|
|
1105
|
+
do_copy (bool): Whether dataset iterator creates a Tensor from numpy.ndarray without copy. Default: "False".
|
|
1106
1106
|
parallel_convert (bool): Whether dataset iterator starts a thread to organize Tensors to output.
|
|
1107
1107
|
Default: "False".
|
|
1108
1108
|
|
|
@@ -1122,7 +1122,7 @@ def set_iterator_mode(do_copy=True, parallel_convert=False):
|
|
|
1122
1122
|
def get_iterator_mode():
|
|
1123
1123
|
"""
|
|
1124
1124
|
Get dataset iterator mode indicate iterator optimization strategy.
|
|
1125
|
-
If `set_iterator_mode` is never called before, `do_copy` default to "
|
|
1125
|
+
If `set_iterator_mode` is never called before, `do_copy` default to "False", `parallel_convert` default to "False".
|
|
1126
1126
|
|
|
1127
1127
|
Returns:
|
|
1128
1128
|
dict, iterator mode dictionary contains the value of `do_copy` and `parallel_convert`.
|
|
@@ -575,6 +575,12 @@ class Dataset:
|
|
|
575
575
|
create shared memory, and represents ``output_columns`` use the second element as the
|
|
576
576
|
unit to create shared memory.
|
|
577
577
|
|
|
578
|
+
.. warning::
|
|
579
|
+
`batch` uses `dill` module implicitly in multiprocessing `spawn` mode to serialize/deserialize
|
|
580
|
+
`per_batch_map`, which is known to be insecure. It is possible to construct malicious pickle data
|
|
581
|
+
which will execute arbitrary code during unpickling. Never load data that could have come from
|
|
582
|
+
untrusted sources, or has been tampered with.
|
|
583
|
+
|
|
578
584
|
Returns:
|
|
579
585
|
Dataset, a new dataset with the above operation applied.
|
|
580
586
|
|
|
@@ -886,6 +892,12 @@ class Dataset:
|
|
|
886
892
|
|
|
887
893
|
- offload (bool, optional): Flag to indicate whether offload is used. Default: ``None``.
|
|
888
894
|
|
|
895
|
+
.. warning::
|
|
896
|
+
`map` uses `dill` module implicitly in multiprocessing `spawn` mode to serialize/deserialize `operations`,
|
|
897
|
+
which is known to be insecure. It is possible to construct malicious pickle data which will
|
|
898
|
+
execute arbitrary code during unpickling. Never load data that could have come from untrusted sources,
|
|
899
|
+
or has been tampered with.
|
|
900
|
+
|
|
889
901
|
Note:
|
|
890
902
|
- Input `operations` accepts TensorOperations defined in mindspore.dataset part, plus user-defined
|
|
891
903
|
Python functions (PyFuncs).
|
|
@@ -1557,7 +1569,7 @@ class Dataset:
|
|
|
1557
1569
|
del api_tree
|
|
1558
1570
|
|
|
1559
1571
|
@check_tuple_iterator
|
|
1560
|
-
def create_tuple_iterator(self, columns=None, num_epochs=-1, output_numpy=False, do_copy=
|
|
1572
|
+
def create_tuple_iterator(self, columns=None, num_epochs=-1, output_numpy=False, do_copy=False):
|
|
1561
1573
|
"""
|
|
1562
1574
|
Create an iterator over the dataset that yields samples of type list, whose elements are
|
|
1563
1575
|
the data for each column.
|
|
@@ -1571,7 +1583,7 @@ class Dataset:
|
|
|
1571
1583
|
convert it to Tensor. Default: ``False`` .
|
|
1572
1584
|
do_copy (bool, optional): Whether to copy the data when converting output to Tensor,
|
|
1573
1585
|
or reuse the buffer for better performance, only works when `output_numpy` is ``False`` .
|
|
1574
|
-
Default: ``
|
|
1586
|
+
Default: ``False`` .
|
|
1575
1587
|
|
|
1576
1588
|
Returns:
|
|
1577
1589
|
Iterator, a dataset iterator that yields samples of type list.
|
|
@@ -1598,7 +1610,7 @@ class Dataset:
|
|
|
1598
1610
|
return TupleIterator(self, columns, num_epochs, output_numpy, do_copy)
|
|
1599
1611
|
|
|
1600
1612
|
@check_dict_iterator
|
|
1601
|
-
def create_dict_iterator(self, num_epochs=-1, output_numpy=False, do_copy=
|
|
1613
|
+
def create_dict_iterator(self, num_epochs=-1, output_numpy=False, do_copy=False):
|
|
1602
1614
|
"""
|
|
1603
1615
|
Create an iterator over the dataset that yields samples of type dict,
|
|
1604
1616
|
while the key is the column name and the value is the data.
|
|
@@ -1610,7 +1622,7 @@ class Dataset:
|
|
|
1610
1622
|
convert it to Tensor. Default: ``False`` .
|
|
1611
1623
|
do_copy (bool, optional): Whether to copy the data when converting output to Tensor,
|
|
1612
1624
|
or reuse the buffer for better performance, only works when `output_numpy` is ``False`` .
|
|
1613
|
-
Default: ``
|
|
1625
|
+
Default: ``False`` .
|
|
1614
1626
|
|
|
1615
1627
|
Returns:
|
|
1616
1628
|
Iterator, a dataset iterator that yields samples of type dict.
|
|
@@ -3632,9 +3644,10 @@ class _PythonMultiprocessing(cde.PythonMultiprocessingRuntime):
|
|
|
3632
3644
|
"process(es): {}".format(self.cleaning_process.pid, self.get_pids()))
|
|
3633
3645
|
|
|
3634
3646
|
if get_enable_watchdog():
|
|
3635
|
-
worker_ids = [
|
|
3647
|
+
worker_ids = [os.getpid()]
|
|
3648
|
+
worker_ids.extend([worker.pid for worker in self.workers])
|
|
3636
3649
|
worker_ids.append(self.cleaning_process.pid)
|
|
3637
|
-
cde.register_worker_pids(id(self),
|
|
3650
|
+
cde.register_worker_pids(id(self), worker_ids)
|
|
3638
3651
|
|
|
3639
3652
|
def _abort_monitor(self):
|
|
3640
3653
|
"""Deregister workers monitored by the watch dog and join clean process."""
|
|
@@ -4385,7 +4398,7 @@ class TransferDataset(Dataset):
|
|
|
4385
4398
|
def create_dict_iterator(self, num_epochs=-1, output_numpy=False):
|
|
4386
4399
|
raise RuntimeError("TransferDataset is not iterable.")
|
|
4387
4400
|
|
|
4388
|
-
def create_tuple_iterator(self, columns=None, num_epochs=-1, output_numpy=False, do_copy=
|
|
4401
|
+
def create_tuple_iterator(self, columns=None, num_epochs=-1, output_numpy=False, do_copy=False):
|
|
4389
4402
|
raise RuntimeError("TransferDataset is not iterable.")
|
|
4390
4403
|
|
|
4391
4404
|
def __iter__(self):
|
|
@@ -220,6 +220,7 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
220
220
|
|
|
221
221
|
self.ppid = os.getpid()
|
|
222
222
|
self.pids = []
|
|
223
|
+
self.thread_ids = []
|
|
223
224
|
self.check_interval = get_multiprocessing_timeout_interval() # the interval of check queue's size
|
|
224
225
|
|
|
225
226
|
if self.multi_process is True:
|
|
@@ -277,12 +278,32 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
277
278
|
worker = _GeneratorWorkerMt(self.dataset, self.eof, worker_id)
|
|
278
279
|
worker.daemon = True
|
|
279
280
|
self.need_join = True
|
|
281
|
+
worker.start()
|
|
282
|
+
self.thread_ids.append(worker.ident)
|
|
280
283
|
self.workers.append(worker)
|
|
281
284
|
|
|
282
285
|
# Register a termination function using weakref to avoid the object from unable to properly destruct.
|
|
283
286
|
atexit.register(lambda cleanup: cleanup()() if cleanup() is not None else None,
|
|
284
287
|
weakref.WeakMethod(self.terminate))
|
|
285
288
|
|
|
289
|
+
def get_worker_ids(self):
|
|
290
|
+
"""
|
|
291
|
+
Get dict of worker's ids
|
|
292
|
+
|
|
293
|
+
Returns:
|
|
294
|
+
dict of strings
|
|
295
|
+
"""
|
|
296
|
+
if not self.is_mp_enabled():
|
|
297
|
+
return {}
|
|
298
|
+
worker_ids = {}
|
|
299
|
+
if self.multi_process is True:
|
|
300
|
+
worker_ids["is_thread"] = False
|
|
301
|
+
worker_ids["worker_id"] = self.pids
|
|
302
|
+
else:
|
|
303
|
+
worker_ids["is_thread"] = True
|
|
304
|
+
worker_ids["worker_id"] = self.thread_ids
|
|
305
|
+
return worker_ids
|
|
306
|
+
|
|
286
307
|
def terminate(self):
|
|
287
308
|
self._stop_subprocess()
|
|
288
309
|
|
|
@@ -421,9 +442,10 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
421
442
|
"process(es): {}".format(self.cleaning_process.pid, [worker.pid for worker in self.workers]))
|
|
422
443
|
|
|
423
444
|
if get_enable_watchdog():
|
|
424
|
-
worker_ids = [
|
|
445
|
+
worker_ids = [os.getpid()]
|
|
446
|
+
worker_ids.extend([worker.pid for worker in self.workers])
|
|
425
447
|
worker_ids.append(self.cleaning_process.pid)
|
|
426
|
-
cde.register_worker_pids(id(self),
|
|
448
|
+
cde.register_worker_pids(id(self), worker_ids)
|
|
427
449
|
|
|
428
450
|
def _release_fd(self):
|
|
429
451
|
"""Release the file descriptor by subprocess"""
|
|
@@ -480,6 +502,8 @@ class SamplerFn(cde.PythonMultiprocessingRuntime):
|
|
|
480
502
|
except Exception: # pylint: disable=W0703
|
|
481
503
|
# Block all errors when join
|
|
482
504
|
continue
|
|
505
|
+
elif not self.multi_process:
|
|
506
|
+
w.join(timeout=5)
|
|
483
507
|
|
|
484
508
|
if self.multi_process is True:
|
|
485
509
|
self._release_fd()
|
|
@@ -795,6 +819,12 @@ class GeneratorDataset(MappableDataset, UnionBaseDataset):
|
|
|
795
819
|
- `Load & Process Data With Dataset Pipeline
|
|
796
820
|
<https://www.mindspore.cn/docs/en/master/api_python/samples/dataset/dataset_gallery.html>`_
|
|
797
821
|
|
|
822
|
+
.. warning::
|
|
823
|
+
`GeneratorDataset` uses `dill` module implicitly in multiprocessing `spawn` mode to serialize/deserialize
|
|
824
|
+
`source`, which is known to be insecure. It is possible to construct malicious pickle data which will
|
|
825
|
+
execute arbitrary code during unpickling. Never load data that could have come from untrusted sources,
|
|
826
|
+
or has been tampered with.
|
|
827
|
+
|
|
798
828
|
Note:
|
|
799
829
|
- If you configure `python_multiprocessing=True` (Default: ``True`` ) and `num_parallel_workers>1`
|
|
800
830
|
(default: ``1`` ) indicates that the multiprocessing mode is started for data load acceleration.
|
|
@@ -220,7 +220,7 @@ class Iterator:
|
|
|
220
220
|
dataset: Dataset to be iterated over
|
|
221
221
|
"""
|
|
222
222
|
|
|
223
|
-
def __init__(self, dataset, num_epochs=-1, output_numpy=False, do_copy=
|
|
223
|
+
def __init__(self, dataset, num_epochs=-1, output_numpy=False, do_copy=False):
|
|
224
224
|
self._col_names = None
|
|
225
225
|
|
|
226
226
|
# create a copy of tree and work on it.
|
|
@@ -493,7 +493,7 @@ class TupleIterator(Iterator):
|
|
|
493
493
|
The derived class of Iterator with list type.
|
|
494
494
|
"""
|
|
495
495
|
|
|
496
|
-
def __init__(self, dataset, columns=None, num_epochs=-1, output_numpy=False, do_copy=
|
|
496
|
+
def __init__(self, dataset, columns=None, num_epochs=-1, output_numpy=False, do_copy=False):
|
|
497
497
|
if columns is not None:
|
|
498
498
|
if not isinstance(columns, list):
|
|
499
499
|
columns = [columns]
|
|
@@ -57,12 +57,12 @@ class _Config:
|
|
|
57
57
|
|
|
58
58
|
def _convert_type(self, key):
|
|
59
59
|
if key not in self.config:
|
|
60
|
-
return
|
|
60
|
+
return os.environ[key]
|
|
61
61
|
if isinstance(self.config[key], int):
|
|
62
62
|
return int(os.environ[key])
|
|
63
63
|
if isinstance(self.config[key], float):
|
|
64
64
|
return float(os.environ[key])
|
|
65
|
-
return
|
|
65
|
+
return os.environ[key]
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
config = _Config()
|
|
@@ -506,3 +506,11 @@ class MindRecordFromOBS:
|
|
|
506
506
|
path = os.path.join(self._local_path, target_dataset)
|
|
507
507
|
_iteration = MindDataset(dataset_files=[path], shuffle=False)
|
|
508
508
|
return _iteration.get_col_names()
|
|
509
|
+
|
|
510
|
+
def close(self):
|
|
511
|
+
if self._pool:
|
|
512
|
+
self._pool.terminate()
|
|
513
|
+
self._pool = None
|
|
514
|
+
|
|
515
|
+
def __del__(self):
|
|
516
|
+
self.close()
|
|
@@ -51,10 +51,14 @@ class PyTensorOperation:
|
|
|
51
51
|
if "transforms" in json_obj.keys():
|
|
52
52
|
# operations which have transforms as input, need to call _from_json() for each transform to deseriallize
|
|
53
53
|
transforms = []
|
|
54
|
+
valid_module = ['mindspore.dataset.vision', 'mindspore.dataset.text',
|
|
55
|
+
'mindspore.dataset.audio', 'mindspore.dataset.transforms']
|
|
54
56
|
for json_op in json_obj["transforms"]:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
py_module = sys.modules.get(json_op.get("python_module"))
|
|
58
|
+
if py_module.__package__ not in valid_module:
|
|
59
|
+
raise RuntimeError('Invalid json content, try to serialzie dataset again.')
|
|
60
|
+
transforms.append(getattr(py_module, json_op.get("tensor_op_name")).from_json(
|
|
61
|
+
json.dumps(json_op.get("tensor_op_params"))))
|
|
58
62
|
new_op.transforms = transforms
|
|
59
63
|
if "output_type" in json_obj.keys():
|
|
60
64
|
output_type = np.dtype(json_obj["output_type"])
|
|
@@ -165,10 +165,14 @@ class PyTensorOperation:
|
|
|
165
165
|
if "transforms" in json_obj.keys():
|
|
166
166
|
# operations which have transforms as input, need to call _from_json() for each transform to deseriallize
|
|
167
167
|
transforms = []
|
|
168
|
+
valid_module = ['mindspore.dataset.vision', 'mindspore.dataset.text',
|
|
169
|
+
'mindspore.dataset.audio', 'mindspore.dataset.transforms']
|
|
168
170
|
for json_op in json_obj["transforms"]:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
py_module = sys.modules.get(json_op.get("python_module"))
|
|
172
|
+
if py_module.__package__ not in valid_module:
|
|
173
|
+
raise RuntimeError('Invalid json content, try to serialzie dataset again.')
|
|
174
|
+
transforms.append(getattr(py_module, json_op["tensor_op_name"]).from_json(
|
|
175
|
+
json.dumps(json_op["tensor_op_params"])))
|
|
172
176
|
new_op.transforms = transforms
|
|
173
177
|
if "output_type" in json_obj.keys():
|
|
174
178
|
output_type = np.dtype(json_obj["output_type"])
|
|
@@ -66,7 +66,7 @@ def is_available():
|
|
|
66
66
|
|
|
67
67
|
def _is_supported():
|
|
68
68
|
device_target = ms.context.get_context("device_target")
|
|
69
|
-
if device_target
|
|
69
|
+
if device_target in ['CPU', 'GPU']:
|
|
70
70
|
logger.error(f"{device_target} device is not supported. Please use correct device")
|
|
71
71
|
return False
|
|
72
72
|
return True
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
# ============================================================================
|
|
15
15
|
"""init file for GPU device context"""
|
|
16
16
|
|
|
17
|
+
__all__ = ['device_count', 'is_available']
|
|
18
|
+
|
|
17
19
|
from .device import device_count, is_available
|
|
18
20
|
from .op_precision import *
|
|
19
21
|
from .op_tuning import *
|
|
20
|
-
|
|
21
|
-
__all__ = ["device_count", "is_available"]
|
|
@@ -64,7 +64,7 @@ def is_available():
|
|
|
64
64
|
|
|
65
65
|
def _is_supported():
|
|
66
66
|
device_target = ms.context.get_context("device_target")
|
|
67
|
-
if device_target
|
|
67
|
+
if device_target in ['CPU', 'Ascend']:
|
|
68
68
|
logger.error(f"{device_target} device is not supported. Please use correct device")
|
|
69
69
|
return False
|
|
70
70
|
return True
|
|
@@ -29,7 +29,8 @@ function_status = {'matmul_allow_tf32': False, 'conv_allow_tf32': False}
|
|
|
29
29
|
def matmul_allow_tf32(value):
|
|
30
30
|
"""
|
|
31
31
|
Whether to convert FP32 to TF32 for Matmul operators.
|
|
32
|
-
For detailed information, please refer to `CUBLAS_COMPUTE_32F_FAST_TF32
|
|
32
|
+
For detailed information, please refer to `CUBLAS_COMPUTE_32F_FAST_TF32
|
|
33
|
+
<https://docs.nvidia.com/cuda/cublas/index.html>`_.
|
|
33
34
|
|
|
34
35
|
Args:
|
|
35
36
|
value (bool): Whether to convert FP32 to TF32 for Matmul operators. If not configured, the framework
|
|
@@ -50,7 +51,8 @@ def matmul_allow_tf32(value):
|
|
|
50
51
|
def conv_allow_tf32(value):
|
|
51
52
|
"""
|
|
52
53
|
Whether to convert FP32 to TF32 for Conv operators.
|
|
53
|
-
For detailed information, please refer to `CUBLAS_COMPUTE_32F_FAST_TF32
|
|
54
|
+
For detailed information, please refer to `CUBLAS_COMPUTE_32F_FAST_TF32
|
|
55
|
+
<https://docs.nvidia.com/cuda/cublas/index.html>`_.
|
|
54
56
|
|
|
55
57
|
Args:
|
|
56
58
|
value (bool): Whether to convert FP32 to HF32 for Conv operators. If not configured, the framework defaults
|
|
@@ -27,7 +27,8 @@ function_status = {'conv_fprop_algo': False, 'conv_wgrad_algo': False, 'conv_dgr
|
|
|
27
27
|
def conv_fprop_algo(mode):
|
|
28
28
|
"""
|
|
29
29
|
Specifies convolution forward algorithm.
|
|
30
|
-
For detailed information, please refer to `NVIDA cuDNN about cudnnConvolutionForward
|
|
30
|
+
For detailed information, please refer to `NVIDA cuDNN about cudnnConvolutionForward
|
|
31
|
+
<https://docs.nvidia.com/deeplearning/cudnn/latest/api/cudnn-cnn-library.html>`_.
|
|
31
32
|
|
|
32
33
|
Args:
|
|
33
34
|
mode (str): convolution forward algorithm. If not configured, the framework defaults to 'normal'.
|
|
@@ -80,7 +81,8 @@ def conv_fprop_algo(mode):
|
|
|
80
81
|
def conv_wgrad_algo(mode):
|
|
81
82
|
"""
|
|
82
83
|
Specifies convolution filter grad algorithm.
|
|
83
|
-
For detailed information, please refer to `NVIDA cuDNN
|
|
84
|
+
For detailed information, please refer to `NVIDA cuDNN
|
|
85
|
+
<https://docs.nvidia.com/deeplearning/cudnn/latest/api/cudnn-cnn-library.html>`_.
|
|
84
86
|
|
|
85
87
|
Args:
|
|
86
88
|
mode (str): convolution filter grad algorithm. If not configured, the framework defaults to 'normal'.
|
|
@@ -129,7 +131,8 @@ def conv_wgrad_algo(mode):
|
|
|
129
131
|
def conv_dgrad_algo(mode):
|
|
130
132
|
"""
|
|
131
133
|
Specifies convolution data grad algorithm.
|
|
132
|
-
For detailed information, please refer to `NVIDA cuDNN
|
|
134
|
+
For detailed information, please refer to `NVIDA cuDNN
|
|
135
|
+
<https://docs.nvidia.com/deeplearning/cudnn/latest/api/cudnn-cnn-library.html>`_.
|
|
133
136
|
|
|
134
137
|
Args:
|
|
135
138
|
mode (str): convolution data grad algorithm. If not configured, the framework defaults to 'normal'.
|
mindspore/device_manager.py
CHANGED
|
@@ -15,16 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
"""Device manager interfaces."""
|
|
17
17
|
|
|
18
|
+
__all__ = ['set_device', 'set_deterministic', 'get_current_device']
|
|
19
|
+
|
|
18
20
|
import os
|
|
19
21
|
from mindspore import log as logger
|
|
20
22
|
from mindspore._c_expression import DeviceManagerConf, DeviceContextManager, MSContext, CollectiveManager
|
|
21
23
|
from mindspore._checkparam import args_type_check
|
|
22
24
|
from mindspore.parallel._ps_context import _need_reset_device_target_for_ps
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
__all__ = ['set_device', 'set_deterministic', 'get_current_device']
|
|
26
|
-
|
|
27
|
-
|
|
28
26
|
class DeviceInfo(tuple):
|
|
29
27
|
"""
|
|
30
28
|
DeviceInfo class. Store the current device target and the corresponding device id.
|
|
@@ -120,14 +118,21 @@ def set_deterministic(deterministic):
|
|
|
120
118
|
"""
|
|
121
119
|
Enables or disables deterministic computing.
|
|
122
120
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
communication operators in the global communication group.
|
|
121
|
+
This configuration is a global configuration, and once enabled, subsequent calculation operations
|
|
122
|
+
will follow the configuration setting. When deterministic computing is enabled, the same output
|
|
123
|
+
is generated if an operator is executed for multiple times with the same hardware and input. This often
|
|
124
|
+
slows down operator execution.
|
|
128
125
|
|
|
129
126
|
The framework not enabled deterministic computation by default.
|
|
130
127
|
|
|
128
|
+
Note:
|
|
129
|
+
- In distributed scenario, we suggest user to set deterministic computing before
|
|
130
|
+
calling :func:`mindspore.communication.init` to enable deterministic operation for
|
|
131
|
+
communication operators in the global communication group.
|
|
132
|
+
- The fixed method for deterministic calculation must be in the same main process as the network,
|
|
133
|
+
operator, etc. Only one deterministic state can be set in the same thread, and it is not recommended
|
|
134
|
+
to set deterministic state multiple times in one thread.
|
|
135
|
+
|
|
131
136
|
Args:
|
|
132
137
|
deterministic (bool): Whether to enable deterministic computing.
|
|
133
138
|
|
|
@@ -139,6 +144,8 @@ def set_deterministic(deterministic):
|
|
|
139
144
|
if DeviceManagerConf.get_instance().is_deterministic_configured():
|
|
140
145
|
raise RuntimeError("The 'mindspore.set_deterministic' can not be set repeatedly.")
|
|
141
146
|
|
|
147
|
+
logger.info(f"Set deterministic setting to '{deterministic}'.")
|
|
148
|
+
|
|
142
149
|
# Must wait for all async created groups to be initialized so that
|
|
143
150
|
# deterministic feature could be consistent between all processes.
|
|
144
151
|
CollectiveManager.get_instance().wait_all_comm_init()
|
mindspore/dnnl.dll
CHANGED
|
Binary file
|
mindspore/dpcmi.dll
CHANGED
|
Binary file
|
|
@@ -19,7 +19,6 @@ import numpy as np
|
|
|
19
19
|
from mindspore.common import Tensor, dtype
|
|
20
20
|
from mindspore.experimental.llm_boost.ascend_native.llm_boost import LLMBoost
|
|
21
21
|
|
|
22
|
-
|
|
23
22
|
def RoundUp(val: int, align: int) -> int:
|
|
24
23
|
if align == 0:
|
|
25
24
|
return 0
|
|
@@ -43,7 +42,6 @@ def ConvertTensor(nd_mat: np.ndarray, transpose: bool = True, nd2nz: bool = True
|
|
|
43
42
|
nz_mat = nz_mat.reshape(r, c)
|
|
44
43
|
return nz_mat
|
|
45
44
|
|
|
46
|
-
|
|
47
45
|
class LlamaBoostAscendNative(LLMBoost):
|
|
48
46
|
r"""
|
|
49
47
|
Implements an Llama model in a single kernel.
|
|
@@ -66,7 +64,7 @@ class LlamaBoostAscendNative(LLMBoost):
|
|
|
66
64
|
def _prepare_single_layer(self, ckpt, config, id):
|
|
67
65
|
""" prepares the dictionary of weights of a single layer """
|
|
68
66
|
prefix = 'model.layers.' + str(id)
|
|
69
|
-
is_last =
|
|
67
|
+
is_last = id == config.num_layers-1
|
|
70
68
|
layer = 'layers.' + str(id) + '.'
|
|
71
69
|
l_dict = {key: value for key, value in ckpt.items() if layer in key}
|
|
72
70
|
if config.n_kv_heads is None:
|
|
@@ -94,8 +92,8 @@ class LlamaBoostAscendNative(LLMBoost):
|
|
|
94
92
|
else:
|
|
95
93
|
raise RuntimeError("hidden size and ffn hidden size must be divided by rank size without remainder. \
|
|
96
94
|
hidden_size: ", hid_size, " ffn_hidden_size: ", ffn_hid, " rank_size: ", rank_size)
|
|
97
|
-
quant =
|
|
98
|
-
unite_qkv =
|
|
95
|
+
quant = self._get_from_dict(l_dict, "_weight_quantizer") is not None
|
|
96
|
+
unite_qkv = config.num_heads == config.n_kv_heads
|
|
99
97
|
self.dictionary[prefix + ".attention_norm.weight"] = \
|
|
100
98
|
Tensor(self._get_from_dict(l_dict, "attention_norm"), dtype=dtype.float16)
|
|
101
99
|
self.dictionary[prefix + ".ffn_norm.weight"] = \
|
|
@@ -18,7 +18,6 @@ import numpy as np
|
|
|
18
18
|
import mindspore as ms
|
|
19
19
|
from mindspore import ops, Tensor
|
|
20
20
|
from mindspore import log as logger
|
|
21
|
-
from mindspore.ops import operations as P
|
|
22
21
|
import mindspore.common.dtype as mstype
|
|
23
22
|
from mindspore._c_expression import _set_format
|
|
24
23
|
from mindspore.common.parameter import Parameter
|
|
@@ -95,8 +94,8 @@ class AtbBoostBase:
|
|
|
95
94
|
self.max_base_len, dtype=self.dtype, need_nz=self.need_nz
|
|
96
95
|
)
|
|
97
96
|
|
|
98
|
-
self.cast =
|
|
99
|
-
self.reshape =
|
|
97
|
+
self.cast = ops.Cast()
|
|
98
|
+
self.reshape = ops.Reshape()
|
|
100
99
|
self.kv_quant = None
|
|
101
100
|
self.rank_id = get_real_rank()
|
|
102
101
|
self.device_num = get_real_group_size()
|
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
1
|
+
# The code implementation refers to the following files from pytorch:
|
|
2
|
+
# - https://github.com/pytorch/pytorch/blob/v1.13.0/torch/optim/adadelta.py
|
|
3
|
+
# Additional modifications are made by Huawei Technologies Co., Ltd in 2023.
|
|
14
4
|
# ============================================================================
|
|
15
5
|
"""adadelta"""
|
|
16
6
|
from __future__ import absolute_import
|
|
17
7
|
|
|
18
|
-
from mindspore
|
|
8
|
+
from mindspore import ops
|
|
19
9
|
import mindspore.common.dtype as mstype
|
|
20
10
|
from mindspore.experimental.optim.optimizer import Optimizer, check_not_less_than, check_not_less_than_without_equal
|
|
21
11
|
from mindspore import _checkparam as validator
|
|
22
12
|
from mindspore import jit
|
|
23
13
|
|
|
24
|
-
_adadelta_opt =
|
|
14
|
+
_adadelta_opt = ops.MultitypeFuncGraph("adadelta_opt")
|
|
25
15
|
|
|
26
16
|
|
|
27
17
|
@_adadelta_opt.register("Function", "Number", "Number", "Tensor", "Tensor", "Tensor", "Tensor", "Tensor")
|
|
28
18
|
def _tensor_run_opt(opt, rho, epsilon, learning_rate, weight, accum, accum_update, gradient):
|
|
29
19
|
"""Apply adadelta optimizer to the weight parameter."""
|
|
30
20
|
success = True
|
|
31
|
-
success =
|
|
21
|
+
success = ops.depend(success, opt(weight, accum, accum_update, learning_rate, rho, epsilon, gradient))
|
|
32
22
|
return success
|
|
33
23
|
|
|
34
24
|
|
|
@@ -60,6 +50,9 @@ class Adadelta(Optimizer):
|
|
|
60
50
|
&\rule{180mm}{0.4pt} \\[-1.ex]
|
|
61
51
|
\end{aligned}
|
|
62
52
|
|
|
53
|
+
For more details about Adadelta algorithm, please refer to `ADADELTA: An Adaptive Learning Rate Method
|
|
54
|
+
<https://arxiv.org/abs/1212.5701>`_.
|
|
55
|
+
|
|
63
56
|
.. warning::
|
|
64
57
|
This is an experimental optimizer API that is subject to change.
|
|
65
58
|
This module must be used with lr scheduler module in `LRScheduler Class
|
|
@@ -129,18 +122,18 @@ class Adadelta(Optimizer):
|
|
|
129
122
|
|
|
130
123
|
self.accum = self.parameters.clone(prefix="accum", init=0)
|
|
131
124
|
self.accum_update = self.parameters.clone(prefix="accum_update", init=0)
|
|
132
|
-
self.opt =
|
|
133
|
-
self.op_cast =
|
|
125
|
+
self.opt = ops.ApplyAdadelta()
|
|
126
|
+
self.op_cast = ops.Cast()
|
|
134
127
|
|
|
135
128
|
@jit
|
|
136
129
|
def implementation(self, lr, rho, eps, maximize, weight_decay, start_id, end_id, gradients):
|
|
137
130
|
"""Extract the common computing part for acceleration"""
|
|
138
131
|
params = self.parameters[start_id: end_id]
|
|
139
|
-
grads = tuple([grad if not maximize else
|
|
132
|
+
grads = tuple([grad if not maximize else ops.neg(grad) for grad in gradients[start_id: end_id]])
|
|
140
133
|
grads = self._decay_weight(weight_decay, params, grads)
|
|
141
134
|
accum = self.accum[start_id: end_id]
|
|
142
135
|
accum_update = self.accum_update[start_id: end_id]
|
|
143
|
-
self.hyper_map(
|
|
136
|
+
self.hyper_map(ops.partial(_adadelta_opt, self.opt, rho, eps, lr),
|
|
144
137
|
params, accum, accum_update, grads)
|
|
145
138
|
return True
|
|
146
139
|
|
|
@@ -1,34 +1,24 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
1
|
+
# The code implementation refers to the following files from pytorch:
|
|
2
|
+
# - https://github.com/pytorch/pytorch/blob/v1.13.0/torch/optim/adagrad.py
|
|
3
|
+
# Additional modifications are made by Huawei Technologies Co., Ltd in 2023.
|
|
14
4
|
# ============================================================================
|
|
15
5
|
"""adagrad"""
|
|
16
6
|
from __future__ import absolute_import
|
|
17
7
|
|
|
18
|
-
from mindspore
|
|
8
|
+
from mindspore import ops
|
|
19
9
|
from mindspore.common import Tensor, Parameter
|
|
20
10
|
import mindspore.common.dtype as mstype
|
|
21
11
|
from mindspore.experimental.optim.optimizer import Optimizer, check_not_less_than, check_not_less_than_without_equal
|
|
22
12
|
from mindspore import jit
|
|
23
13
|
|
|
24
|
-
_adagrad_opt =
|
|
14
|
+
_adagrad_opt = ops.MultitypeFuncGraph("adagrad_opt")
|
|
25
15
|
|
|
26
16
|
|
|
27
17
|
@_adagrad_opt.register("Function", "Tensor", "Tensor", "Tensor", "Tensor")
|
|
28
18
|
def _tensor_run_opt(opt, learning_rate, weight, accum, gradient):
|
|
29
19
|
"""Apply adagrad optimizer to the weight parameter."""
|
|
30
20
|
success = True
|
|
31
|
-
success =
|
|
21
|
+
success = ops.depend(success, opt(weight, accum, learning_rate, gradient))
|
|
32
22
|
return success
|
|
33
23
|
|
|
34
24
|
|
|
@@ -57,6 +47,9 @@ class Adagrad(Optimizer):
|
|
|
57
47
|
&\rule{160mm}{0.4pt} \\[-1.ex]
|
|
58
48
|
\end{aligned}
|
|
59
49
|
|
|
50
|
+
For more details about Adagrad algorithm, please refer to `Adaptive Subgradient Methods for Online Learning and \
|
|
51
|
+
Stochastic Optimization <https://jmlr.org/papers/v12/duchi11a.html>`_.
|
|
52
|
+
|
|
60
53
|
.. warning::
|
|
61
54
|
This is an experimental optimizer API that is subject to change.
|
|
62
55
|
This module must be used with lr scheduler module in `LRScheduler Class
|
|
@@ -129,22 +122,22 @@ class Adagrad(Optimizer):
|
|
|
129
122
|
super(Adagrad, self).__init__(params, defaults)
|
|
130
123
|
|
|
131
124
|
self.accum = self.parameters.clone(prefix="accum", init=initial_accumulator_value)
|
|
132
|
-
self.op_cast =
|
|
125
|
+
self.op_cast = ops.Cast()
|
|
133
126
|
self.step_t = Parameter(Tensor(0, mstype.int32), "step_t")
|
|
134
127
|
self.increase_tensor = Tensor(1, mstype.int32)
|
|
135
|
-
self.assignadd =
|
|
136
|
-
self.assign =
|
|
128
|
+
self.assignadd = ops.AssignAdd()
|
|
129
|
+
self.assign = ops.Assign()
|
|
137
130
|
|
|
138
131
|
@jit
|
|
139
132
|
def implementation(self, eps, lr, lr_decay, maximize, weight_decay, start_id, end_id, gradients):
|
|
140
133
|
"""Extract the common computing part for acceleration"""
|
|
141
|
-
opt =
|
|
134
|
+
opt = ops.ApplyAdagradV2(epsilon=eps, update_slots=True)
|
|
142
135
|
decay_lr = lr / (1 + self.step_t * lr_decay)
|
|
143
136
|
params = self.parameters[start_id: end_id]
|
|
144
|
-
grads = tuple([grad if not maximize else
|
|
137
|
+
grads = tuple([grad if not maximize else ops.neg(grad) for grad in gradients[start_id: end_id]])
|
|
145
138
|
grads = self._decay_weight(weight_decay, params, grads)
|
|
146
139
|
accum = self.accum[start_id: end_id]
|
|
147
|
-
self.hyper_map(
|
|
140
|
+
self.hyper_map(ops.partial(_adagrad_opt, opt, decay_lr), params, accum, grads)
|
|
148
141
|
return True
|
|
149
142
|
|
|
150
143
|
def construct(self, gradients):
|