mindspore.parallel.set_op_strategy_config

View Source On Gitee
mindspore.parallel.set_op_strategy_config(mode='SAVE', path='')[source]

Set strategy json configuration when using sharding propagation.

Warning

This is an experimental interface, may be changed or canceled in the future; This interface currently doesn't support saving or loading strategies using layout.

Note

  • It only works when parallel_mode=ParallelMode.AUTO_PARALLEL and search_mode='sharding_propagation'.

  • It only supports saving and reloading with the same configuration for the same network. If the network or training hyperparameters are modified after using the SAVE mode to save the strategies of operator to the setting json file, which may lead to the failure of using the LOAD mode to load operator strategies from json.

  • When performing distributed training, users can first save the strategy using dryrun on a single device and then load strategy to perform distributed training.

Parameters
  • mode (str) – The parameter for choosing save or load .json file. Default value: "SAVE" .

  • path (str) – Path to save or load parallel strategy json, must be an absolute path. Default value: "" .

Raises
  • KeyError – When type is not "SAVE" or "LOAD" .

  • KeyError – When path does not end in ".json" .

  • KeyError – When path is not an absolute path.