Spaces:
Running
Running
patrickvonplaten
commited on
Commit
•
cbabf63
1
Parent(s):
3997fa3
Update app.py
Browse files
app.py
CHANGED
@@ -41,6 +41,7 @@ def get_ckpt_names(token, radio_model_names, input_model):
|
|
41 |
return error_str(e), gr.update(choices=[]), None
|
42 |
|
43 |
def convert_and_push(radio_model_names, input_model, ckpt_name, sd_version, token, path_in_repo):
|
|
|
44 |
|
45 |
if sd_version == None:
|
46 |
return error_str("You must select a stable diffusion version.", title="Invalid input")
|
@@ -55,17 +56,17 @@ def convert_and_push(radio_model_names, input_model, ckpt_name, sd_version, toke
|
|
55 |
|
56 |
# 2. Run the conversion script
|
57 |
os.makedirs(model_id, exist_ok=True)
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
)
|
69 |
|
70 |
# 3. Push to the model repo
|
71 |
commit_message="Add Diffusers weights"
|
|
|
41 |
return error_str(e), gr.update(choices=[]), None
|
42 |
|
43 |
def convert_and_push(radio_model_names, input_model, ckpt_name, sd_version, token, path_in_repo):
|
44 |
+
extract_ema = False
|
45 |
|
46 |
if sd_version == None:
|
47 |
return error_str("You must select a stable diffusion version.", title="Invalid input")
|
|
|
56 |
|
57 |
# 2. Run the conversion script
|
58 |
os.makedirs(model_id, exist_ok=True)
|
59 |
+
run_command = [
|
60 |
+
"python3",
|
61 |
+
"./diffs/scripts/convert_original_stable_diffusion_to_diffusers.py",
|
62 |
+
"--checkpoint_path",
|
63 |
+
ckpt_path,
|
64 |
+
"--dump_path" ,
|
65 |
+
model_id,
|
66 |
+
]
|
67 |
+
if extract_ema:
|
68 |
+
run_command.append("--extract_ema")
|
69 |
+
subprocess.run(run_command)
|
70 |
|
71 |
# 3. Push to the model repo
|
72 |
commit_message="Add Diffusers weights"
|