"src/runtime/vscode:/vscode.git/clone" did not exist on "62af41c245d924e7fe0837b34ebc9f6cfa613594"
Commit 02cf1f87 authored by Zongwei Zhou's avatar Zongwei Zhou Committed by A. Unique TensorFlower
Browse files

Fix errors in classifier trainer when there is no distribution strategy

PiperOrigin-RevId: 306495321
parent 0bfdad07
...@@ -109,7 +109,8 @@ def _get_dataset_builders(params: base_configs.ExperimentConfig, ...@@ -109,7 +109,8 @@ def _get_dataset_builders(params: base_configs.ExperimentConfig,
logging.warning('label_smoothing not applied, so datasets will not be one ' logging.warning('label_smoothing not applied, so datasets will not be one '
'hot encoded.') 'hot encoded.')
num_devices = strategy.num_replicas_in_sync num_devices = strategy.num_replicas_in_sync if strategy else 1
image_size = get_image_size_from_model(params) image_size = get_image_size_from_model(params)
dataset_configs = [ dataset_configs = [
...@@ -309,7 +310,8 @@ def train_and_eval( ...@@ -309,7 +310,8 @@ def train_and_eval(
strategy_scope = distribution_utils.get_strategy_scope(strategy) strategy_scope = distribution_utils.get_strategy_scope(strategy)
logging.info('Detected %d devices.', strategy.num_replicas_in_sync) logging.info('Detected %d devices.',
strategy.num_replicas_in_sync if strategy else 1)
label_smoothing = params.model.loss.label_smoothing label_smoothing = params.model.loss.label_smoothing
one_hot = label_smoothing and label_smoothing > 0 one_hot = label_smoothing and label_smoothing > 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment