Merge pull request #309 from bmaltais/dev

Change how subprocess is run
This commit is contained in:
bmaltais 2023-03-05 11:44:26 -05:00 committed by GitHub
commit 7be7f6d2c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 56 additions and 13 deletions

View File

@ -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}')

View File

@ -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}')

View File

@ -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 == '':

View File

@ -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(

View File

@ -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'

View File

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

View File

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

View File

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

View File

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

View File

@ -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}')

View File

@ -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}')