aravindsankar28/DySAT

code issue

wangzeyu135798 opened this issue · 2 comments

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

The hyper-paramter settings are copied from parser to flags. It should work correctly if you execute run_script.py.

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")