0

I would like to store FLAGS (tf.app.flags.FLAGS) in a file and reload them later. Until TensorFlow 1.4, I used this code for reloading:

with open(config_file, 'r') as f:
     config = json.load(f)
     FLAGS.__flags.update(config)

From TensorFlow 1.5, the underlying implementation of FLAGS changed. Does anybody know a way to update the FLAGS with values stored in a file?

stecklin
  • 131
  • 7

1 Answers1

3

Try:

with open(config_file, 'r') as f:
    config = json.load(f)
    for name, value in config.items():
        FLAGS.__flags[name].value = value
Weidong Xu
  • 31
  • 3