Skip to content

Commit 2df3e59

Browse files
ucdmkttfx-copybara
authored andcommitted
internal cleanup
PiperOrigin-RevId: 319343653
1 parent 022b836 commit 2df3e59

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tfx/components/tuner/executor.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ def search(input_dict: Dict[Text, List[types.Artifact]],
8585

8686
tuner_fn_result = tuner_fn(fn_args)
8787
result = tuner_fn_result.tuner
88-
fit_kwargs = tuner_fn_result.fit_kwargs
8988

9089
# TODO(b/156966497): set logger for printing.
9190
result.search_space_summary()
9291
logging.info('Start tuning... Tuner ID: %s', result.tuner_id)
93-
result.search(**fit_kwargs)
92+
result.search(**tuner_fn_result.fit_kwargs)
9493
logging.info('Finished tuning... Tuner ID: %s', result.tuner_id)
9594
result.results_summary()
9695

tfx/extensions/google_cloud_ai_platform/tuner/executor.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ def run_chief_oracle():
154154
"""Invoke chief oracle, and listen to the open port."""
155155
logging.info('chief_oracle() starting...')
156156

157-
# Per specification, KerasTuner's behavior is controlled by env variables.
157+
# Per KerasTuner's specification, configuration of chief oracle is set
158+
# by environment variables. This only affects the current sub-process
159+
# which is single-threaded, but not the main process. As such, mutation
160+
# of this otherwise global state is safe.
158161
os.environ['KERASTUNER_ORACLE_IP'] = '0.0.0.0'
159162
os.environ['KERASTUNER_ORACLE_PORT'] = self._master_port
160163
os.environ['KERASTUNER_TUNER_ID'] = 'chief'
@@ -198,6 +201,9 @@ def _search(self, input_dict: Dict[Text, List[types.Artifact]],
198201
input_dict, exec_properties)
199202

200203
# If distributed, both master and worker need to know where the oracle is.
204+
# Per KerasTuner's interface, it is configured through env variables.
205+
# This only affects the current main process, which is designed to be
206+
# single-threaded.
201207
os.environ['KERASTUNER_ORACLE_IP'] = self._master_addr
202208
os.environ['KERASTUNER_ORACLE_PORT'] = self._master_port
203209

0 commit comments

Comments
 (0)