Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3ba4c01

Browse files
committed
Use tf.gfile.Open to open flagfile as otherwise files on google cloud storage etc cannot be opened.
1 parent 96c4daa commit 3ba4c01

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

official/recommendation/data_async_generation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,11 @@ def _parse_flagfile():
455455
sys.exit()
456456
time.sleep(1)
457457
tf.logging.info("flagfile found.")
458-
# This overrides FLAGS with flags from flagfile.
459-
flags.FLAGS([__file__, "--flagfile", flagfile])
458+
# `flags` module opens `flagfile` with `open`, which does not work on
459+
# google cloud storage etc.
460+
with tf.gfile.Open(flagfile, "r") as f:
461+
# This overrides FLAGS with flags from flagfile.
462+
flags.FLAGS([__file__] + [line for line in f])
460463

461464

462465
def main(_):

0 commit comments

Comments
 (0)