diff --git a/dreambooth_gui.py b/dreambooth_gui.py index 55eec52..c0f4472 100644 --- a/dreambooth_gui.py +++ b/dreambooth_gui.py @@ -455,8 +455,12 @@ def train_model( ) print(run_cmd) + # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) # check if output_dir/last is a folder... therefore it is a diffuser model last_dir = pathlib.Path(f'{output_dir}/{output_name}') diff --git a/finetune_gui.py b/finetune_gui.py index 737f64c..38a11fb 100644 --- a/finetune_gui.py +++ b/finetune_gui.py @@ -310,7 +310,10 @@ def train_model( print(run_cmd) # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) # create images buckets if generate_image_buckets: @@ -332,7 +335,10 @@ def train_model( print(run_cmd) # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) image_num = len( [ @@ -441,8 +447,12 @@ def train_model( ) print(run_cmd) + # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) # check if output_dir/last is a folder... therefore it is a diffuser model last_dir = pathlib.Path(f'{output_dir}/{output_name}') diff --git a/library/basic_caption_gui.py b/library/basic_caption_gui.py index a26f571..21852c3 100644 --- a/library/basic_caption_gui.py +++ b/library/basic_caption_gui.py @@ -39,7 +39,10 @@ def caption_images( print(run_cmd) # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) if overwrite_input: if not prefix == '' or not postfix == '': diff --git a/library/blip_caption_gui.py b/library/blip_caption_gui.py index 30d6955..2e0081d 100644 --- a/library/blip_caption_gui.py +++ b/library/blip_caption_gui.py @@ -50,7 +50,10 @@ def caption_images( print(run_cmd) # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) # Add prefix and postfix add_pre_postfix( diff --git a/library/convert_model_gui.py b/library/convert_model_gui.py index f6352e0..aaa39b8 100644 --- a/library/convert_model_gui.py +++ b/library/convert_model_gui.py @@ -88,7 +88,10 @@ def convert_model( print(run_cmd) # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) if ( not target_model_type == 'diffuser' diff --git a/library/extract_lora_gui.py b/library/extract_lora_gui.py index 6020c8d..91897e4 100644 --- a/library/extract_lora_gui.py +++ b/library/extract_lora_gui.py @@ -55,7 +55,10 @@ def extract_lora( print(run_cmd) # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) ### diff --git a/library/merge_lora_gui.py b/library/merge_lora_gui.py index a3ecd48..21cd16a 100644 --- a/library/merge_lora_gui.py +++ b/library/merge_lora_gui.py @@ -54,7 +54,10 @@ def merge_lora( print(run_cmd) # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) ### diff --git a/library/resize_lora_gui.py b/library/resize_lora_gui.py index 8d41ee8..842f42e 100644 --- a/library/resize_lora_gui.py +++ b/library/resize_lora_gui.py @@ -41,7 +41,10 @@ def resize_lora( print(run_cmd) # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) ### diff --git a/library/wd14_caption_gui.py b/library/wd14_caption_gui.py index 0c1cf79..89de66d 100644 --- a/library/wd14_caption_gui.py +++ b/library/wd14_caption_gui.py @@ -31,7 +31,10 @@ def caption_images(train_data_dir, caption_extension, batch_size, thresh): print(run_cmd) # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) print('...captioning done') diff --git a/lora_gui.py b/lora_gui.py index 0da962b..d475040 100644 --- a/lora_gui.py +++ b/lora_gui.py @@ -545,8 +545,12 @@ def train_model( ) print(run_cmd) + # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) # check if output_dir/last is a folder... therefore it is a diffuser model last_dir = pathlib.Path(f'{output_dir}/{output_name}') diff --git a/textual_inversion_gui.py b/textual_inversion_gui.py index 9bfadf5..089ac0a 100644 --- a/textual_inversion_gui.py +++ b/textual_inversion_gui.py @@ -497,8 +497,12 @@ def train_model( run_cmd += f' --use_style_template' print(run_cmd) + # Run the command - os.system(run_cmd) + if os.name == 'posix': + os.system(run_cmd) + else: + subprocess.run(run_cmd) # check if output_dir/last is a folder... therefore it is a diffuser model last_dir = pathlib.Path(f'{output_dir}/{output_name}')