You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

_auto_parallel_context.py 24 kB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  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.
  14. # ============================================================================
  15. """Context of auto parallel"""
  16. import threading
  17. import mindspore.context as context
  18. from mindspore.parallel._dp_allreduce_fusion import _set_fusion_strategy_by_idx, _set_fusion_strategy_by_size
  19. from mindspore._c_expression import AutoParallelContext
  20. from mindspore._checkparam import args_type_check
  21. _MAX_GROUP_NAME_LEN = 127
  22. _DEFAULT_HCCL_FUSION_GROUP_NAME = "hccl_world_groupsum1"
  23. _DEFAULT_NCCL_FUSION_GROUP_NAME = "nccl_world_groupsum1"
  24. class _AutoParallelContext:
  25. """
  26. _AutoParallelContext is the environment in which operations are executed
  27. Note:
  28. Create a context through instantiating Context object is not recommended.
  29. Should use auto_parallel_context() to get the context since Context is singleton.
  30. """
  31. _instance = None
  32. _instance_lock = threading.Lock()
  33. def __init__(self):
  34. self._context_handle = AutoParallelContext.get_instance()
  35. def __new__(cls):
  36. if cls._instance is None:
  37. cls._instance_lock.acquire()
  38. cls._instance = object.__new__(cls)
  39. cls._instance_lock.release()
  40. return cls._instance
  41. def check_context_handle(self):
  42. """
  43. Check context handle.
  44. Raises:
  45. ValueError: If the context handle is none.
  46. """
  47. if self._context_handle is None:
  48. raise ValueError("Context handle is none in context!!!")
  49. def set_device_num(self, device_num):
  50. """
  51. Set device num for auto parallel.
  52. Args:
  53. device_num (int): The device number.
  54. Raises:
  55. ValueError: If the device num is not in [1, 4096].
  56. """
  57. self.check_context_handle()
  58. if device_num < 1 or device_num > 4096:
  59. raise ValueError("Device num must be in [1, 4096], but got {}".format(device_num))
  60. self._context_handle.set_device_num(device_num)
  61. def get_device_num(self):
  62. """Get device num."""
  63. self.check_context_handle()
  64. return self._context_handle.get_device_num()
  65. def set_global_rank(self, global_rank):
  66. """
  67. Set global rank for auto parallel.
  68. Args:
  69. global_rank (int): The rank id of current rank.
  70. Raises:
  71. ValueError: If the global rank is not in [1, 4096].
  72. """
  73. self.check_context_handle()
  74. if global_rank < 0 or global_rank > 4095:
  75. raise ValueError("Global rank must be in [0, 4095], but got {}".format(global_rank))
  76. self._context_handle.set_global_rank(global_rank)
  77. def get_global_rank(self):
  78. """Get current rank id."""
  79. self.check_context_handle()
  80. return self._context_handle.get_global_rank()
  81. def set_pipeline_stages(self, stages):
  82. """Set the stages of the pipeline"""
  83. self.check_context_handle()
  84. self._context_handle.set_pipeline_stage_split_num(stages)
  85. def get_pipeline_stages(self):
  86. """Get the stages of the pipeline"""
  87. self.check_context_handle()
  88. return self._context_handle.get_pipeline_stage_split_num()
  89. def set_gradients_mean(self, gradients_mean):
  90. """
  91. Set gradients_mean flag.
  92. Note:
  93. If gradients_mean is true, it will insert a div operator after parameter gradients allreduce.
  94. Args:
  95. gradients_mean (bool): The gradients_mean flag.
  96. """
  97. self.check_context_handle()
  98. self._context_handle.set_gradients_mean(gradients_mean)
  99. def get_gradients_mean(self):
  100. """Get gradients_mean flag."""
  101. self.check_context_handle()
  102. return self._context_handle.get_gradients_mean()
  103. def set_gradient_fp32_sync(self, gradient_fp32_sync):
  104. """
  105. Set gradient_fp32_sync.
  106. Note:
  107. If gradient_fp32_sync is true,
  108. it will convert tensor type from fp16 to fp32 before parameter gradients allreduce.
  109. Args:
  110. gradient_fp32_sync (bool): The gradient_fp32_sync flag.
  111. """
  112. self.check_context_handle()
  113. self._context_handle.set_gradient_fp32_sync(gradient_fp32_sync)
  114. def get_gradient_fp32_sync(self):
  115. """Get gradient_fp32_sync flag."""
  116. self.check_context_handle()
  117. return self._context_handle.get_gradient_fp32_sync()
  118. def set_loss_repeated_mean(self, loss_repeated_mean):
  119. """
  120. Set loss_repeated_mean flag.
  121. Note:
  122. If loss_repeated_mean is true,
  123. Distributed automatic differentiation will perform a mean operator
  124. in backward in the case of repeated calculations.
  125. Args:
  126. loss_repeated_mean (bool): The loss_repeated_mean flag.
  127. """
  128. self.check_context_handle()
  129. self._context_handle.set_loss_repeated_mean(loss_repeated_mean)
  130. def get_loss_repeated_mean(self):
  131. """Get loss_repeated_mean flag."""
  132. self.check_context_handle()
  133. return self._context_handle.get_loss_repeated_mean()
  134. def set_parallel_mode(self, parallel_mode):
  135. """
  136. Set parallel mode for auto parallel.
  137. Args:
  138. parallel_mode (str): The parallel mode of auto parallel.
  139. Raises:
  140. ValueError: If parallel mode is not supported.
  141. """
  142. self.check_context_handle()
  143. ret = self._context_handle.set_parallel_mode(parallel_mode)
  144. if ret is False:
  145. raise ValueError("Parallel mode does not support {}".format(parallel_mode))
  146. def get_parallel_mode(self):
  147. """Get parallel mode."""
  148. self.check_context_handle()
  149. return self._context_handle.get_parallel_mode()
  150. def set_strategy_search_mode(self, auto_parallel_search_mode):
  151. """
  152. Set search mode of strategy.
  153. Args:
  154. auto_parallel_search_mode (str): The search mode of strategy.
  155. """
  156. self.check_context_handle()
  157. ret = self._context_handle.set_strategy_search_mode(auto_parallel_search_mode)
  158. if ret is False:
  159. raise ValueError("Strategy search mode does not support {}".format(auto_parallel_search_mode))
  160. def get_strategy_search_mode(self):
  161. """Get search mode of strategy."""
  162. self.check_context_handle()
  163. return self._context_handle.get_strategy_search_mode()
  164. def set_parameter_broadcast(self, parameter_broadcast):
  165. """
  166. Set parameter broadcast.
  167. Args:
  168. parameter_broadcast (bool): Parameter broadcast or not.
  169. """
  170. self.check_context_handle()
  171. if parameter_broadcast is True and context.get_context("enable_ge") is False:
  172. raise RuntimeError("Parameter broadcast is a developing feature. For now we suggest to"
  173. " use mindspore.common.set_seed() to share parameters among devices.")
  174. self._context_handle.set_parameter_broadcast(parameter_broadcast)
  175. def get_parameter_broadcast(self):
  176. """Get parameter broadcast flag."""
  177. self.check_context_handle()
  178. return self._context_handle.get_parameter_broadcast()
  179. def set_strategy_ckpt_load_file(self, strategy_ckpt_load_file):
  180. """
  181. Set strategy checkpoint load path.
  182. Args:
  183. strategy_ckpt_load_file (bool): Path to load parallel strategy checkpoint.
  184. """
  185. self.check_context_handle()
  186. self._context_handle.set_strategy_ckpt_load_file(strategy_ckpt_load_file)
  187. def get_strategy_ckpt_load_file(self):
  188. """Get strategy checkpoint load path."""
  189. self.check_context_handle()
  190. return self._context_handle.get_strategy_ckpt_load_file()
  191. def set_full_batch(self, full_batch):
  192. """
  193. Set whether load full batch on each device.
  194. Args:
  195. full_batch (bool): True if load full batch on each device.
  196. """
  197. self.check_context_handle()
  198. self._context_handle.set_full_batch(full_batch)
  199. def get_full_batch(self):
  200. """Get whether load full batch on each device."""
  201. self.check_context_handle()
  202. return self._context_handle.get_full_batch()
  203. def set_strategy_ckpt_save_file(self, strategy_ckpt_save_file):
  204. """
  205. Set strategy checkpoint save path.
  206. Args:
  207. strategy_ckpt_save_file (bool): Path to save parallel strategy checkpoint.
  208. """
  209. self.check_context_handle()
  210. import os
  211. dir_path = os.path.dirname(strategy_ckpt_save_file)
  212. if dir_path and not os.path.exists(dir_path):
  213. os.makedirs(dir_path)
  214. self._context_handle.set_strategy_ckpt_save_file(strategy_ckpt_save_file)
  215. def get_strategy_ckpt_save_file(self):
  216. """Get strategy checkpoint save path."""
  217. self.check_context_handle()
  218. return self._context_handle.get_strategy_ckpt_save_file()
  219. def get_parameter_broadcast_is_set(self):
  220. """Get parameter broadcast is set or not."""
  221. self.check_context_handle()
  222. return self._context_handle.get_parameter_broadcast_is_set()
  223. def set_all_reduce_fusion_split_indices(self, indices, group=""):
  224. """
  225. Set allreduce fusion strategy by parameters indices.
  226. Args:
  227. indices (list): Indices list.
  228. group (str): The communication group of hccl/nccl.
  229. Raises:
  230. TypeError: If type of indices item is not int.
  231. TypeError: If group is not a python str.
  232. """
  233. self.check_context_handle()
  234. if not indices:
  235. raise ValueError('indices can not be empty')
  236. if isinstance(indices, (list)):
  237. for index in indices:
  238. if not isinstance(index, int):
  239. raise TypeError('indices has invalid value')
  240. else:
  241. raise TypeError('indices must be a python list')
  242. if len(set(indices)) != len(indices):
  243. raise ValueError('indices has duplicate elements')
  244. if sorted(indices) != indices:
  245. raise ValueError('elements in indices must be sorted in ascending order')
  246. if isinstance(group, (str)):
  247. group_len = len(group)
  248. if group_len > _MAX_GROUP_NAME_LEN:
  249. raise ValueError('Group name len is out of range {_MAX_GROUP_NAME_LEN}')
  250. else:
  251. raise TypeError('Group must be a python str')
  252. if group == "":
  253. if context.get_context("device_target") == "Ascend":
  254. group = _DEFAULT_HCCL_FUSION_GROUP_NAME
  255. else:
  256. group = _DEFAULT_NCCL_FUSION_GROUP_NAME
  257. self._context_handle.set_all_reduce_fusion_split_indices(indices, group)
  258. if context.get_context("device_target") == "Ascend" and context.get_context("enable_ge"):
  259. _set_fusion_strategy_by_idx(indices)
  260. def get_all_reduce_fusion_split_indices(self, group=""):
  261. """
  262. Get allreduce fusion split indices.
  263. Args:
  264. group (str): The communication group of hccl/nccl.
  265. Returns:
  266. Return split sizes list according to the group.
  267. Raises:
  268. TypeError: If group is not a python str.
  269. """
  270. self.check_context_handle()
  271. if isinstance(group, (str)):
  272. group_len = len(group)
  273. if group_len > _MAX_GROUP_NAME_LEN:
  274. raise ValueError('Group name len is out of range {_MAX_GROUP_NAME_LEN}')
  275. else:
  276. raise TypeError('Group must be a python str')
  277. if group == "":
  278. if context.get_context("device_target") == "Ascend":
  279. group = _DEFAULT_HCCL_FUSION_GROUP_NAME
  280. else:
  281. group = _DEFAULT_NCCL_FUSION_GROUP_NAME
  282. return self._context_handle.get_all_reduce_fusion_split_indices(group)
  283. def set_all_reduce_fusion_split_sizes(self, sizes, group=""):
  284. """
  285. Set allreduce fusion strategy by parameters data sizes.
  286. Args:
  287. sizes (list): Sizes list.
  288. group (str): The communication group of hccl/nccl.
  289. Raises:
  290. TypeError: If type of sizes item is not int.
  291. TypeError: If group is not a python str.
  292. """
  293. self.check_context_handle()
  294. if isinstance(sizes, (list)):
  295. for size in sizes:
  296. if not isinstance(size, int):
  297. raise TypeError('sizes has invalid value')
  298. else:
  299. raise TypeError('sizes must be a python list')
  300. if isinstance(group, (str)):
  301. group_len = len(group)
  302. if group_len > _MAX_GROUP_NAME_LEN:
  303. raise ValueError('Group name len is out of range {_MAX_GROUP_NAME_LEN}')
  304. else:
  305. raise TypeError('Group must be a python str')
  306. if group == "":
  307. if context.get_context("device_target") == "Ascend":
  308. group = _DEFAULT_HCCL_FUSION_GROUP_NAME
  309. else:
  310. group = _DEFAULT_NCCL_FUSION_GROUP_NAME
  311. self._context_handle.set_all_reduce_fusion_split_sizes(sizes, group)
  312. if context.get_context("device_target") == "Ascend":
  313. _set_fusion_strategy_by_size(sizes)
  314. def get_all_reduce_fusion_split_sizes(self, group=""):
  315. """
  316. Get allreduce fusion split sizes.
  317. Args:
  318. group (str): The communication group of hccl/nccl.
  319. Returns:
  320. Return split sizes list according to the group.
  321. Raises:
  322. TypeError: If group is not a python str.
  323. """
  324. self.check_context_handle()
  325. if isinstance(group, (str)):
  326. group_len = len(group)
  327. if group_len > _MAX_GROUP_NAME_LEN:
  328. raise ValueError('Group name len is out of range {_MAX_GROUP_NAME_LEN}')
  329. else:
  330. raise TypeError('Group must be a python str')
  331. if group == "":
  332. if context.get_context("device_target") == "Ascend":
  333. group = _DEFAULT_HCCL_FUSION_GROUP_NAME
  334. else:
  335. group = _DEFAULT_NCCL_FUSION_GROUP_NAME
  336. return self._context_handle.get_all_reduce_fusion_split_sizes(group)
  337. def set_enable_all_reduce_fusion(self, enable_all_reduce_fusion):
  338. """
  339. Set enable/disable all reduce fusion.
  340. Args:
  341. enable_all_reduce_fusion (bool): Enable/disable all reduce fusion.
  342. """
  343. self.check_context_handle()
  344. if not isinstance(enable_all_reduce_fusion, bool):
  345. raise TypeError('enable_all_reduce_fusion is invalid type')
  346. self._context_handle.set_enable_all_reduce_fusion(enable_all_reduce_fusion)
  347. def get_enable_all_reduce_fusion(self):
  348. """Get all reduce fusion flag."""
  349. self.check_context_handle()
  350. return self._context_handle.get_enable_all_reduce_fusion()
  351. def get_device_num_is_set(self):
  352. """Get device number is set or not."""
  353. self.check_context_handle()
  354. return self._context_handle.get_device_num_is_set()
  355. def get_global_rank_is_set(self):
  356. """Get global rank is set or not."""
  357. self.check_context_handle()
  358. return self._context_handle.get_global_rank_is_set()
  359. def set_enable_parallel_optimizer(self, enable_parallel_optimizer):
  360. """
  361. Set enable/disable parallel optimizer.
  362. Args:
  363. set_enable_parallel_optimizer (bool): Enable/disable parallel optimizer.
  364. """
  365. self.check_context_handle()
  366. if not isinstance(enable_parallel_optimizer, bool):
  367. raise TypeError('enable_parallel_optimizer is invalid type')
  368. self._context_handle.set_enable_parallel_optimizer(enable_parallel_optimizer)
  369. def get_enable_parallel_optimizer(self):
  370. """Get parallel optimizer flag."""
  371. self.check_context_handle()
  372. return self._context_handle.get_enable_parallel_optimizer()
  373. def reset(self):
  374. """Reset all settings."""
  375. self.check_context_handle()
  376. self._context_handle.reset()
  377. _auto_parallel_context = None
  378. def auto_parallel_context():
  379. """
  380. Get the global _auto_parallel_context, if it is not created, create a new one.
  381. Returns:
  382. _AutoParallelContext, the global auto parallel context.
  383. """
  384. global _auto_parallel_context
  385. if _auto_parallel_context is None:
  386. _auto_parallel_context = _AutoParallelContext()
  387. return _auto_parallel_context
  388. _set_auto_parallel_context_func_map = {
  389. "device_num": auto_parallel_context().set_device_num,
  390. "global_rank": auto_parallel_context().set_global_rank,
  391. "gradients_mean": auto_parallel_context().set_gradients_mean,
  392. "gradient_fp32_sync": auto_parallel_context().set_gradient_fp32_sync,
  393. "loss_repeated_mean": auto_parallel_context().set_loss_repeated_mean,
  394. "pipeline_stages": auto_parallel_context().set_pipeline_stages,
  395. "parallel_mode": auto_parallel_context().set_parallel_mode,
  396. "auto_parallel_search_mode": auto_parallel_context().set_strategy_search_mode,
  397. "parameter_broadcast": auto_parallel_context().set_parameter_broadcast,
  398. "strategy_ckpt_load_file": auto_parallel_context().set_strategy_ckpt_load_file,
  399. "strategy_ckpt_save_file": auto_parallel_context().set_strategy_ckpt_save_file,
  400. "full_batch": auto_parallel_context().set_full_batch,
  401. "enable_parallel_optimizer": auto_parallel_context().set_enable_parallel_optimizer,
  402. "all_reduce_fusion_config": auto_parallel_context().set_all_reduce_fusion_split_indices}
  403. _get_auto_parallel_context_func_map = {
  404. "device_num": auto_parallel_context().get_device_num,
  405. "global_rank": auto_parallel_context().get_global_rank,
  406. "gradients_mean": auto_parallel_context().get_gradients_mean,
  407. "gradient_fp32_sync": auto_parallel_context().get_gradient_fp32_sync,
  408. "loss_repeated_mean": auto_parallel_context().get_loss_repeated_mean,
  409. "pipeline_stages": auto_parallel_context().get_pipeline_stages,
  410. "parallel_mode": auto_parallel_context().get_parallel_mode,
  411. "auto_parallel_search_mode": auto_parallel_context().get_strategy_search_mode,
  412. "parameter_broadcast": auto_parallel_context().get_parameter_broadcast,
  413. "strategy_ckpt_load_file": auto_parallel_context().get_strategy_ckpt_load_file,
  414. "strategy_ckpt_save_file": auto_parallel_context().get_strategy_ckpt_save_file,
  415. "full_batch": auto_parallel_context().get_full_batch,
  416. "enable_parallel_optimizer": auto_parallel_context().get_enable_parallel_optimizer,
  417. "all_reduce_fusion_config": auto_parallel_context().get_all_reduce_fusion_split_indices}
  418. @args_type_check(device_num=int, global_rank=int, gradients_mean=bool, gradient_fp32_sync=bool,
  419. loss_repeated_mean=bool, parallel_mode=str, auto_parallel_search_mode=str,
  420. parameter_broadcast=bool, strategy_ckpt_load_file=str,
  421. strategy_ckpt_save_file=str, full_batch=bool, enable_parallel_optimizer=bool,
  422. all_reduce_fusion_config=list)
  423. def _set_auto_parallel_context(**kwargs):
  424. """
  425. Set auto parallel context.
  426. Note:
  427. Attribute name is required for setting attributes.
  428. Args:
  429. device_num (int): Available device number, the value must be in [1, 4096]. Default: 1.
  430. global_rank (int): Global rank id, the value must be in [0, 4095]. Default: 0.
  431. gradients_mean (bool): Whether to perform mean operator after all-reduce of mirror. Default: False.
  432. loss_repeated_mean (bool): Whether to perform mean operator in backward in the case of repeated
  433. calculations. Default: True.
  434. gradient_fp32_sync (bool): Gradients allreduce by fp32 even though gradients is fp16 if this flag is True.
  435. Default: True.
  436. parallel_mode (str): There are five kinds of parallel modes, "stand_alone", "data_parallel",
  437. "hybrid_parallel", "semi_auto_parallel" and "auto_parallel". Default: "stand_alone".
  438. - stand_alone: Only one processor working.
  439. - data_parallel: Distributing the data across different processors.
  440. - hybrid_parallel: Achieving data parallelism and model parallelism manually.
  441. - semi_auto_parallel: Achieving data parallelism and model parallelism by
  442. setting parallel strategies.
  443. - auto_parallel: Achieving parallelism automatically.
  444. auto_parallel_search_mode (str): There are two kinds of search modes, "recursive_programming"
  445. and "dynamic_programming". Default: "dynamic_programming".
  446. - recursive_programming: Recursive programming search mode.
  447. - dynamic_programming: Dynamic programming search mode.
  448. parameter_broadcast (bool): Indicating whether to broadcast parameters before training.
  449. "stand_alone", "semi_auto_parallel" and "auto_parallel" do not support parameter
  450. broadcast. Default: False.
  451. strategy_ckpt_load_file (str): The path to load parallel strategy checkpoint. Default: ''
  452. strategy_ckpt_save_file (str): The path to save parallel strategy checkpoint. Default: ''
  453. full_batch (bool): Whether to load the whole batch on each device. Default: False.
  454. enable_parallel_optimizer (bool): Enable using optimizer segmentation or not. Default: False.
  455. all_reduce_fusion_config (list): Set allreduce fusion strategy by parameters indices.
  456. pipeline_stages (int): Set the stage information for pipeline parallel. This indicates how
  457. the devices are distributed alone the pipeline. The total devices will be divided into
  458. 'pipeline_stags' stages. This currently could only be used when
  459. parall mode semi_auto_parallel is enabled. Default: 0
  460. Raises:
  461. ValueError: If input key is not attribute in auto parallel context.
  462. """
  463. for key, value in kwargs.items():
  464. if key not in _set_auto_parallel_context_func_map:
  465. raise ValueError("Set context keyword %s is not recognized!" % key)
  466. set_func = _set_auto_parallel_context_func_map[key]
  467. set_func(value)
  468. def _get_auto_parallel_context(attr_key):
  469. """
  470. Get auto parallel context attribute value according to the key.
  471. Args:
  472. attr_key (str): The key of the attribute.
  473. Returns:
  474. Return attribute value according to the key.
  475. Raises:
  476. ValueError: If input key is not attribute in auto parallel context.
  477. """
  478. if attr_key not in _get_auto_parallel_context_func_map:
  479. raise ValueError("Get context keyword %s is not recognized!" % attr_key)
  480. get_func = _get_auto_parallel_context_func_map[attr_key]
  481. return get_func()
  482. def _reset_auto_parallel_context():
  483. """
  484. Reset auto parallel context attributes to the default values:
  485. - device_num: 1.
  486. - global_rank: 0.
  487. - gradients_mean: False.
  488. - gradient_fp32_sync: True.
  489. - parallel_mode: "stand_alone".
  490. - parameter_broadcast: False.
  491. - strategy_ckpt_load_file: ""
  492. - strategy_ckpt_save_file: ""
  493. - enable_parallel_optimizer: False
  494. - auto_parallel_search_mode: dynamic_programming
  495. - pipeline_stages: 0
  496. """
  497. auto_parallel_context().reset()