DySAT icon indicating copy to clipboard operation
DySAT copied to clipboard

code issue

Open wangzeyu135798 opened this issue 5 years ago • 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

wangzeyu135798 avatar Feb 13 '21 09:02 wangzeyu135798

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

aravindsankar28 avatar Feb 22 '21 02:02 aravindsankar28

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

fanfanman avatar Feb 23 '22 09:02 fanfanman