automatized arguments with pickle

This commit is contained in:
leno3003 2022-03-28 22:43:24 +02:00
parent afd87df67a
commit dee168e5a6
3 changed files with 15 additions and 6 deletions

View file

@ -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):

View file

@ -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])

View file

@ -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()
io.destroy_all_windows()