diff --git a/core/interact/interact.py b/core/interact/interact.py index 21cd881..9ec53fb 100644 --- a/core/interact/interact.py +++ b/core/interact/interact.py @@ -229,8 +229,9 @@ class InteractBase(object): return "\n" res = dict(filter(lambda item: s in item[0], self.default_answers.items())) - if res in self.default_answers: - return res[1] + key = list(res.keys())[0] + if key in self.default_answers: + return list(res.values())[0] return input(s) def input_number(self, s, default_value, valid_list=None, show_default_value=True, add_info=None, help_message=None): diff --git a/core/interact/interact_dict.py b/core/interact/interact_dict.py index 1439047..ef82d1d 100644 --- a/core/interact/interact_dict.py +++ b/core/interact/interact_dict.py @@ -1,8 +1,8 @@ import pickle dictionary = { -'[png] Output image format ( png/jpg ?:help ) : ' : 'png', ' : ' : '0', +'[png] Output image format ( png/jpg ?:help ) : ' : 'png', 'Override' : '0', ' Press enter in 2 seconds to override model settings. ' : '\n', '[0] Which GPU indexes to choose? : ' : '0', @@ -14,7 +14,7 @@ dictionary = { '[y] Continue extraction? ( y/n ?:help ) : ' : 'True', '[2] Autobackup every N hour ( 0..24 ?:help ) : ' : '2', '[n] Write preview history ( y/n ?:help ) : ' : 'False', -'[83000] Target iteration : ' : '83000', +'[83000] Target iteration : ' : '100000', '[n] Flip SRC faces randomly ( y/n ?:help ) : ' : 'False', '[n] Flip DST faces randomly ( y/n ?:help ) : ' : 'False', '[4] Batch_size ( ?:help ) : ' : '4', @@ -49,4 +49,11 @@ dictionary = { '[16] Bitrate of output file in MB/s : ' : '16', } with open('/home/deepfake/interact_dict.pkl', 'wb') as handle: - pickle.dump(dictionary, handle, protocol=pickle.HIGHEST_PROTOCOL) + pickle.dump(dictionary, handle, protocol=4) + +#with open('/home/deepfake/interact_dict.pkl', 'rb') as handle: +# d = pickle.load(handle) +#s = "Target iteration" +#res = dict(filter(lambda item: s in item[0], d.items())) +# +#print(list(res.values())[0]) diff --git a/mainscripts/Trainer.py b/mainscripts/Trainer.py index df74ca3..061b9c6 100644 --- a/mainscripts/Trainer.py +++ b/mainscripts/Trainer.py @@ -163,6 +163,7 @@ def trainerThread (s2c, c2s, e, model_save() is_reached_goal = True io.log_info ('You can use preview now.') + os._exit(1) need_save = False while time.time() - last_save_time >= save_interval_min*60: @@ -357,4 +358,4 @@ def main(**kwargs): except KeyboardInterrupt: s2c.put ( {'op': 'close'} ) - io.destroy_all_windows() \ No newline at end of file + io.destroy_all_windows()