mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-06 04:52:13 -07:00
Trainer: added --silent-start cmd option
This commit is contained in:
parent
2fe86faf01
commit
0fb912e91f
2 changed files with 59 additions and 45 deletions
4
main.py
4
main.py
|
@ -116,6 +116,7 @@ if __name__ == "__main__":
|
|||
'force_model_name' : arguments.force_model_name,
|
||||
'force_gpu_idxs' : [ int(x) for x in arguments.force_gpu_idxs.split(',') ] if arguments.force_gpu_idxs is not None else None,
|
||||
'cpu_only' : arguments.cpu_only,
|
||||
'silent_start' : arguments.silent_start,
|
||||
'execute_programs' : [ [int(x[0]), x[1] ] for x in arguments.execute_program ],
|
||||
'debug' : arguments.debug,
|
||||
}
|
||||
|
@ -134,6 +135,9 @@ if __name__ == "__main__":
|
|||
p.add_argument('--force-model-name', dest="force_model_name", default=None, help="Forcing to choose model name from model/ folder.")
|
||||
p.add_argument('--cpu-only', action="store_true", dest="cpu_only", default=False, help="Train on CPU.")
|
||||
p.add_argument('--force-gpu-idxs', dest="force_gpu_idxs", default=None, help="Force to choose GPU indexes separated by comma.")
|
||||
p.add_argument('--silent-start', action="store_true", dest="silent_start", default=False, help="Silent start. Automatically chooses Best GPU and last used model.")
|
||||
|
||||
|
||||
p.add_argument('--execute-program', dest="execute_program", default=[], action='append', nargs='+')
|
||||
p.set_defaults (func=process_train)
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ class ModelBase(object):
|
|||
cpu_only=False,
|
||||
debug=False,
|
||||
force_model_class_name=None,
|
||||
silent_start=False,
|
||||
**kwargs):
|
||||
self.is_training = is_training
|
||||
self.saved_models_path = saved_models_path
|
||||
|
@ -61,7 +62,12 @@ class ModelBase(object):
|
|||
saved_models_names = sorted(saved_models_names, key=operator.itemgetter(1), reverse=True )
|
||||
saved_models_names = [ x[0] for x in saved_models_names ]
|
||||
|
||||
|
||||
if len(saved_models_names) != 0:
|
||||
if silent_start:
|
||||
self.model_name = saved_models_names[0]
|
||||
io.log_info(f'Silent start: choosed model "{self.model_name}"')
|
||||
else:
|
||||
io.log_info ("Choose one of saved models, or enter a name to create a new model.")
|
||||
io.log_info ("[r] : rename")
|
||||
io.log_info ("[d] : delete")
|
||||
|
@ -145,6 +151,10 @@ class ModelBase(object):
|
|||
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}")
|
||||
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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue