Commit
·
c803c53
1
Parent(s):
2e131a1
Upload convert_diffusers_to_sd_cli.py
Browse files
convert_diffusers_to_sd_cli.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import os
|
| 3 |
+
try:
|
| 4 |
+
import converters
|
| 5 |
+
except ImportError:
|
| 6 |
+
|
| 7 |
+
#if there's a scripts folder where the script is, add it to the path
|
| 8 |
+
if 'scripts' in os.listdir(os.path.dirname(os.path.abspath(__file__))):
|
| 9 |
+
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '\\scripts')
|
| 10 |
+
else:
|
| 11 |
+
print('Could not find scripts folder. Please add it to the path manually or place this file in it.')
|
| 12 |
+
import converters
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
if __name__ == '__main__':
|
| 16 |
+
args = sys.argv[1:]
|
| 17 |
+
if len(args) != 2:
|
| 18 |
+
print('Usage: python3 convert_diffusers_to_sd.py <model_path> <output_path>')
|
| 19 |
+
sys.exit(1)
|
| 20 |
+
model_path = args[0]
|
| 21 |
+
output_path = args[1]
|
| 22 |
+
converters.Convert_Diffusers_to_SD(model_path, output_path)
|