diff --git a/scripts/convert_sd_to_diffusers_cli.py b/scripts/convert_sd_to_diffusers_cli.py new file mode 100644 index 0000000..1bde976 --- /dev/null +++ b/scripts/convert_sd_to_diffusers_cli.py @@ -0,0 +1,29 @@ +import sys +import os +try: + import converters +except ImportError: + + #if there's a scripts folder where the script is, add it to the path + if 'scripts' in os.listdir(os.path.dirname(os.path.abspath(__file__))): + sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '\\scripts') + else: + print('Could not find scripts folder. Please add it to the path manually or place this file in it.') + import converters + + +if __name__ == '__main__': + args = sys.argv[1:] + if len(args) != 4: + print('Usage: python3 convert_sd_to_diffusers.py ') + sys.exit(1) + checkpoint_path = args[0] + output_path = args[1] + version = args[2] + prediction_type = args[3] + converters.Convert_SD_to_Diffusers( + checkpoint_path, + output_path, + version = version, + prediction_type = prediction_type + ) \ No newline at end of file diff --git a/scripts/trainer.py b/scripts/trainer.py index bf5a572..266b3ba 100644 --- a/scripts/trainer.py +++ b/scripts/trainer.py @@ -1064,10 +1064,17 @@ def __init__( if concept['use_sub_dirs'] == 1: tot = 0 for root, dirs, files in os.walk(concept['instance_data_dir']): - tot += len(files) + for file in files: + if file.endswith( ('.jpg','.jpeg','.png','.webp','.bmp','.JPG','.JPEG','.PNG','.WEBP','.BMP')): + tot += 1 count = tot else: - count = len(os.listdir(concept['instance_data_dir'])) + tot = 0 + files = os.listdir(concept['instance_data_dir']) + for file in files: + if file.endswith( ('.jpg','.jpeg','.png','.webp','.bmp','.JPG','.JPEG','.PNG','.WEBP','.BMP')): + tot += 1 + count = tot else: count = len(os.listdir(concept['instance_data_dir'])) print(f"{concept['instance_data_dir']} has count of {count}")