Change how subprocess is run
This commit is contained in:
parent
09939ff8a8
commit
2e47a45e3f
@ -455,8 +455,12 @@ def train_model(
|
|||||||
)
|
)
|
||||||
|
|
||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# 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
|
# check if output_dir/last is a folder... therefore it is a diffuser model
|
||||||
last_dir = pathlib.Path(f'{output_dir}/{output_name}')
|
last_dir = pathlib.Path(f'{output_dir}/{output_name}')
|
||||||
|
@ -310,7 +310,10 @@ def train_model(
|
|||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
os.system(run_cmd)
|
if os.name == 'posix':
|
||||||
|
os.system(run_cmd)
|
||||||
|
else:
|
||||||
|
subprocess.run(run_cmd)
|
||||||
|
|
||||||
# create images buckets
|
# create images buckets
|
||||||
if generate_image_buckets:
|
if generate_image_buckets:
|
||||||
@ -332,7 +335,10 @@ def train_model(
|
|||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
os.system(run_cmd)
|
if os.name == 'posix':
|
||||||
|
os.system(run_cmd)
|
||||||
|
else:
|
||||||
|
subprocess.run(run_cmd)
|
||||||
|
|
||||||
image_num = len(
|
image_num = len(
|
||||||
[
|
[
|
||||||
@ -441,8 +447,12 @@ def train_model(
|
|||||||
)
|
)
|
||||||
|
|
||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# 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
|
# check if output_dir/last is a folder... therefore it is a diffuser model
|
||||||
last_dir = pathlib.Path(f'{output_dir}/{output_name}')
|
last_dir = pathlib.Path(f'{output_dir}/{output_name}')
|
||||||
|
@ -39,7 +39,10 @@ def caption_images(
|
|||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
os.system(run_cmd)
|
if os.name == 'posix':
|
||||||
|
os.system(run_cmd)
|
||||||
|
else:
|
||||||
|
subprocess.run(run_cmd)
|
||||||
|
|
||||||
if overwrite_input:
|
if overwrite_input:
|
||||||
if not prefix == '' or not postfix == '':
|
if not prefix == '' or not postfix == '':
|
||||||
|
@ -50,7 +50,10 @@ def caption_images(
|
|||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# 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 prefix and postfix
|
||||||
add_pre_postfix(
|
add_pre_postfix(
|
||||||
|
@ -88,7 +88,10 @@ def convert_model(
|
|||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
os.system(run_cmd)
|
if os.name == 'posix':
|
||||||
|
os.system(run_cmd)
|
||||||
|
else:
|
||||||
|
subprocess.run(run_cmd)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
not target_model_type == 'diffuser'
|
not target_model_type == 'diffuser'
|
||||||
|
@ -55,7 +55,10 @@ def extract_lora(
|
|||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
os.system(run_cmd)
|
if os.name == 'posix':
|
||||||
|
os.system(run_cmd)
|
||||||
|
else:
|
||||||
|
subprocess.run(run_cmd)
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -54,7 +54,10 @@ def merge_lora(
|
|||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
os.system(run_cmd)
|
if os.name == 'posix':
|
||||||
|
os.system(run_cmd)
|
||||||
|
else:
|
||||||
|
subprocess.run(run_cmd)
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -41,7 +41,10 @@ def resize_lora(
|
|||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
os.system(run_cmd)
|
if os.name == 'posix':
|
||||||
|
os.system(run_cmd)
|
||||||
|
else:
|
||||||
|
subprocess.run(run_cmd)
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -31,7 +31,10 @@ def caption_images(train_data_dir, caption_extension, batch_size, thresh):
|
|||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# Run the command
|
||||||
os.system(run_cmd)
|
if os.name == 'posix':
|
||||||
|
os.system(run_cmd)
|
||||||
|
else:
|
||||||
|
subprocess.run(run_cmd)
|
||||||
|
|
||||||
print('...captioning done')
|
print('...captioning done')
|
||||||
|
|
||||||
|
@ -545,8 +545,12 @@ def train_model(
|
|||||||
)
|
)
|
||||||
|
|
||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# 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
|
# check if output_dir/last is a folder... therefore it is a diffuser model
|
||||||
last_dir = pathlib.Path(f'{output_dir}/{output_name}')
|
last_dir = pathlib.Path(f'{output_dir}/{output_name}')
|
||||||
|
@ -497,8 +497,12 @@ def train_model(
|
|||||||
run_cmd += f' --use_style_template'
|
run_cmd += f' --use_style_template'
|
||||||
|
|
||||||
print(run_cmd)
|
print(run_cmd)
|
||||||
|
|
||||||
# Run the command
|
# 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
|
# check if output_dir/last is a folder... therefore it is a diffuser model
|
||||||
last_dir = pathlib.Path(f'{output_dir}/{output_name}')
|
last_dir = pathlib.Path(f'{output_dir}/{output_name}')
|
||||||
|
Loading…
Reference in New Issue
Block a user