code issue
wangzeyu135798 opened this issue · 2 comments
wangzeyu135798 commented
When I run train.py, there is a problem following:
absl.flags._exceptions.DuplicateFlagError: The flag 'log_dir' is defined twice. First from absl.logging, Second from flags. Description from first occurrence: directory to write logfiles into
aravindsankar28 commented
The hyper-paramter settings are copied from parser to flags. It should work correctly if you execute run_script.py.
fanfanman commented
The issue happens for tf1.14 due to flags pre-initialized by "absl" package. Adding the following lines to flags.py to delete existed flags works for me, reference
def del_all_flags(FLAGS):
flags_dict = FLAGS._flags()
keys_list = [keys for keys in flags_dict]
for keys in keys_list:
FLAGS.__delattr__(keys)
del_all_flags(tf.flags.FLAGS)
(Add after ”FLAGS = flags.FLAGS“ in "flags.py")