Skip to content

Commit eb55002

Browse files
committed
Fix exported_collections variable for TF
1 parent 9389f3b commit eb55002

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

smdebug/tensorflow/base_hook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(
9090
# This will be None if the var wasn't set, i.e. not param server
9191
self.tf_config_json = load_tf_config_json(os.getenv("TF_CONFIG"))
9292
self._hook_supported = None
93-
93+
self._exported_collections = False
9494
self._distribution_strategy = {
9595
ModeKeys.TRAIN: None,
9696
ModeKeys.EVAL: None,

smdebug/tensorflow/keras.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,15 @@ def _on_any_batch_end(self, batch, mode, logs=None):
514514
self._save_tensors_post_step(batch, logs)
515515

516516
if self._prepared_tensors[mode]:
517-
if self.exported_collections is False:
517+
if self._exported_collections is False:
518518
# in keras, these collections change when mode changes
519519
# but rest of the project isn't yet capable of handling this
520520
# this means that collections like outputs, or other collections with intermediate tensors
521521
# will only have tensor names from first mode
522522

523523
# this means sometimes collections will be exported after 1 step
524524
self.export_collections()
525-
self.exported_collections = True
525+
self._exported_collections = True
526526

527527
if self._exported_model[self.mode] is False:
528528
# confirmed that keras has same graph for all modes

smdebug/tensorflow/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,9 @@ def begin(self):
292292
self._export_model()
293293
self._exported_model[self.mode] = True
294294

295-
if self.exported_collections is False:
295+
if self._exported_collections is False:
296296
self.export_collections()
297-
self.exported_collections = True
297+
self._exported_collections = True
298298

299299
def _get_tensors_to_save_this_step(self) -> set:
300300
tensors_to_save = set()

tests/zero_code_change/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
You can run the ZCC tests on DLAMI or DLC for supported containers as follows from the main folder of the repository:
2+
3+
```
4+
PYTHONPATH=. python tests/zero_code_change/tensorflow_integration_tests.py
5+
```
6+
7+
```
8+
pytest tests/zero_code_change/horovod/
9+
```

0 commit comments

Comments
 (0)