forked from mindspore-Ecosystem/mindspore
!24604 rename keyword argument from 'acc_level' to 'boost_level' in class Model.__init__
Merge pull request !24604 from zhouneng/fix_issue_acc_level_rename_r1.4
This commit is contained in:
commit
4026500fa9
|
@ -123,7 +123,7 @@ class Model:
|
|||
"""
|
||||
|
||||
def __init__(self, network, loss_fn=None, optimizer=None, metrics=None, eval_network=None,
|
||||
eval_indexes=None, amp_level="O0", acc_level="O0", **kwargs):
|
||||
eval_indexes=None, amp_level="O0", boost_level="O0", **kwargs):
|
||||
self._network = network
|
||||
self._loss_fn = loss_fn
|
||||
self._optimizer = optimizer
|
||||
|
@ -132,7 +132,7 @@ class Model:
|
|||
self._keep_bn_fp32 = True
|
||||
self._check_kwargs(kwargs)
|
||||
self._amp_level = amp_level
|
||||
self._acc_level = acc_level
|
||||
self._boost_level = boost_level
|
||||
self._eval_network = eval_network
|
||||
self._process_amp_args(kwargs)
|
||||
self._parallel_mode = _get_parallel_mode()
|
||||
|
@ -187,7 +187,7 @@ class Model:
|
|||
|
||||
def _build_acc_network(self, kwargs):
|
||||
"""Build the acc network."""
|
||||
processor = acc.AutoAcc(self._acc_level, kwargs)
|
||||
processor = acc.AutoAcc(self._boost_level, kwargs)
|
||||
if processor.level not in ["O1", "O2"]:
|
||||
return
|
||||
if self._optimizer is None:
|
||||
|
|
|
@ -50,7 +50,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
all_reduce_fusion_config:
|
||||
|
|
|
@ -50,7 +50,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
all_reduce_fusion_config:
|
||||
|
|
|
@ -52,7 +52,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O1"
|
||||
boost_mode: "O1"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
all_reduce_fusion_config:
|
||||
|
|
|
@ -53,7 +53,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
all_reduce_fusion_config:
|
||||
|
|
|
@ -53,7 +53,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
all_reduce_fusion_config:
|
||||
|
|
|
@ -52,7 +52,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
all_reduce_fusion_config:
|
||||
|
|
|
@ -25,7 +25,7 @@ eval: False
|
|||
save_ckpt: False
|
||||
mode_name: "GRAPH"
|
||||
dtype: "fp16"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ eval_interval: 1
|
|||
enable_cache: False
|
||||
cache_session_id: ""
|
||||
mode_name: "GRAPH"
|
||||
acc_mode: "O0"
|
||||
boost_mode: "O0"
|
||||
conv_init: "XavierUniform"
|
||||
dense_init: "TruncatedNormal"
|
||||
all_reduce_fusion_config:
|
||||
|
|
|
@ -107,7 +107,7 @@ def set_parameter():
|
|||
gradients_mean=True)
|
||||
set_algo_parameters(elementwise_op_strategy_follow=True)
|
||||
if config.net_name == "resnet50" or config.net_name == "se-resnet50":
|
||||
if config.acc_mode not in ["O1", "O2"]:
|
||||
if config.boost_mode not in ["O1", "O2"]:
|
||||
context.set_auto_parallel_context(all_reduce_fusion_config=config.all_reduce_fusion_config)
|
||||
elif config.net_name == "resnet101":
|
||||
context.set_auto_parallel_context(all_reduce_fusion_config=config.all_reduce_fusion_config)
|
||||
|
@ -252,7 +252,7 @@ def train_net():
|
|||
model = Model(net, loss_fn=loss, optimizer=opt, metrics=metrics, eval_network=dist_eval_network)
|
||||
else:
|
||||
model = Model(net, loss_fn=loss, optimizer=opt, loss_scale_manager=loss_scale, metrics=metrics,
|
||||
amp_level="O2", acc_level=config.acc_mode, keep_batchnorm_fp32=False,
|
||||
amp_level="O2", boost_level=config.boost_mode, keep_batchnorm_fp32=False,
|
||||
eval_network=dist_eval_network)
|
||||
|
||||
if config.optimizer == "Thor" and config.dataset == "imagenet2012":
|
||||
|
|
Loading…
Reference in New Issue