rename choosed to chosen in code

This commit is contained in:
camjac251 2021-06-20 03:38:26 -05:00
commit 873f75c596
No known key found for this signature in database
GPG key ID: BEB14628800F8CE9
2 changed files with 16 additions and 16 deletions

View file

@ -234,27 +234,27 @@ class nn():
while True:
try:
if choose_only_one:
choosed_idxs = io.input_str("Which GPU index to choose?", best_device_indexes)
chosen_idxs = io.input_str("Which GPU index to choose?", best_device_indexes)
else:
choosed_idxs = io.input_str("Which GPU indexes to choose?", best_device_indexes)
chosen_idxs = io.input_str("Which GPU indexes to choose?", best_device_indexes)
if allow_cpu and choosed_idxs.lower() == "cpu":
choosed_idxs = []
if allow_cpu and chosen_idxs.lower() == "cpu":
chosen_idxs = []
break
choosed_idxs = [ int(x) for x in choosed_idxs.split(',') ]
chosen_idxs = [ int(x) for x in chosen_idxs.split(',') ]
if choose_only_one:
if len(choosed_idxs) == 1:
if len(chosen_idxs) == 1:
break
else:
if all( [idx in all_devices_indexes for idx in choosed_idxs] ):
if all( [idx in all_devices_indexes for idx in chosen_idxs] ):
break
except:
pass
io.log_info ("")
return choosed_idxs
return chosen_idxs
class DeviceConfig():
@staticmethod

View file

@ -135,7 +135,7 @@ class ModelBase(object):
self.options_show_override = {}
self.loss_history = []
self.sample_for_preview = None
self.choosed_gpu_indexes = None
self.chosen_gpu_indexes = None
model_data = {}
self.model_data_path = Path( self.get_strpath_storage_for_file('data.dat') )
@ -147,14 +147,14 @@ class ModelBase(object):
self.options = model_data['options']
self.loss_history = model_data.get('loss_history', [])
self.sample_for_preview = model_data.get('sample_for_preview', None)
self.choosed_gpu_indexes = model_data.get('choosed_gpu_indexes', None)
self.chosen_gpu_indexes = model_data.get('chosen_gpu_indexes', None)
if self.is_first_run():
io.log_info ("\nModel first run.")
if silent_start:
self.device_config = nn.DeviceConfig.BestGPU()
io.log_info (f"Silent start: choosed device {'CPU' if self.device_config.cpu_only else self.device_config.devices[0].name}")
io.log_info (f"Silent start: chosen device {'CPU' if self.device_config.cpu_only else self.device_config.devices[0].name}")
else:
self.device_config = nn.DeviceConfig.GPUIndexes( force_gpu_idxs or nn.ask_choose_device_idxs(suggest_best_multi_gpu=True)) \
if not cpu_only else nn.DeviceConfig.CPU()
@ -228,9 +228,9 @@ class ModelBase(object):
io.log_info (f"Choose image for the preview history. {wnd_name}")
io.named_window(wnd_name)
io.capture_keys(wnd_name)
choosed = False
chosen = False
preview_id_counter = 0
while not choosed:
while not chosen:
self.sample_for_preview = self.generate_next_samples()
previews = self.get_static_previews()
@ -240,7 +240,7 @@ class ModelBase(object):
key_events = io.get_key_events(wnd_name)
key, chr_key, ctrl_pressed, alt_pressed, shift_pressed = key_events[-1] if len(key_events) > 0 else (0,0,False,False,False)
if key == ord('\n') or key == ord('\r'):
choosed = True
chosen = True
break
elif key == ord(' '):
preview_id_counter += 1
@ -251,7 +251,7 @@ class ModelBase(object):
try:
io.process_messages(0.1)
except KeyboardInterrupt:
choosed = True
chosen = True
io.destroy_window(wnd_name)
else:
@ -395,7 +395,7 @@ class ModelBase(object):
'options': self.options,
'loss_history': self.loss_history,
'sample_for_preview' : self.sample_for_preview,
'choosed_gpu_indexes' : self.choosed_gpu_indexes,
'chosen_gpu_indexes' : self.chosen_gpu_indexes,
}
pathex.write_bytes_safe (self.model_data_path, pickle.dumps(model_data) )