!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:
i-robot 2021-10-15 02:32:57 +00:00 committed by Gitee
commit 4026500fa9
15 changed files with 18 additions and 18 deletions

View File

@ -123,7 +123,7 @@ class Model:
""" """
def __init__(self, network, loss_fn=None, optimizer=None, metrics=None, eval_network=None, 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._network = network
self._loss_fn = loss_fn self._loss_fn = loss_fn
self._optimizer = optimizer self._optimizer = optimizer
@ -132,7 +132,7 @@ class Model:
self._keep_bn_fp32 = True self._keep_bn_fp32 = True
self._check_kwargs(kwargs) self._check_kwargs(kwargs)
self._amp_level = amp_level self._amp_level = amp_level
self._acc_level = acc_level self._boost_level = boost_level
self._eval_network = eval_network self._eval_network = eval_network
self._process_amp_args(kwargs) self._process_amp_args(kwargs)
self._parallel_mode = _get_parallel_mode() self._parallel_mode = _get_parallel_mode()
@ -187,7 +187,7 @@ class Model:
def _build_acc_network(self, kwargs): def _build_acc_network(self, kwargs):
"""Build the acc network.""" """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"]: if processor.level not in ["O1", "O2"]:
return return
if self._optimizer is None: if self._optimizer is None:

View File

@ -50,7 +50,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"
all_reduce_fusion_config: all_reduce_fusion_config:

View File

@ -50,7 +50,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"

View File

@ -50,7 +50,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"

View File

@ -52,7 +52,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"

View File

@ -52,7 +52,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"

View File

@ -52,7 +52,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"

View File

@ -50,7 +50,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"
all_reduce_fusion_config: all_reduce_fusion_config:

View File

@ -52,7 +52,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O1" boost_mode: "O1"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"
all_reduce_fusion_config: all_reduce_fusion_config:

View File

@ -53,7 +53,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"
all_reduce_fusion_config: all_reduce_fusion_config:

View File

@ -53,7 +53,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"
all_reduce_fusion_config: all_reduce_fusion_config:

View File

@ -52,7 +52,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"
all_reduce_fusion_config: all_reduce_fusion_config:

View File

@ -25,7 +25,7 @@ eval: False
save_ckpt: False save_ckpt: False
mode_name: "GRAPH" mode_name: "GRAPH"
dtype: "fp16" dtype: "fp16"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"

View File

@ -53,7 +53,7 @@ eval_interval: 1
enable_cache: False enable_cache: False
cache_session_id: "" cache_session_id: ""
mode_name: "GRAPH" mode_name: "GRAPH"
acc_mode: "O0" boost_mode: "O0"
conv_init: "XavierUniform" conv_init: "XavierUniform"
dense_init: "TruncatedNormal" dense_init: "TruncatedNormal"
all_reduce_fusion_config: all_reduce_fusion_config:

View File

@ -107,7 +107,7 @@ def set_parameter():
gradients_mean=True) gradients_mean=True)
set_algo_parameters(elementwise_op_strategy_follow=True) set_algo_parameters(elementwise_op_strategy_follow=True)
if config.net_name == "resnet50" or config.net_name == "se-resnet50": 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) context.set_auto_parallel_context(all_reduce_fusion_config=config.all_reduce_fusion_config)
elif config.net_name == "resnet101": elif config.net_name == "resnet101":
context.set_auto_parallel_context(all_reduce_fusion_config=config.all_reduce_fusion_config) 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) model = Model(net, loss_fn=loss, optimizer=opt, metrics=metrics, eval_network=dist_eval_network)
else: else:
model = Model(net, loss_fn=loss, optimizer=opt, loss_scale_manager=loss_scale, metrics=metrics, 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) eval_network=dist_eval_network)
if config.optimizer == "Thor" and config.dataset == "imagenet2012": if config.optimizer == "Thor" and config.dataset == "imagenet2012":