Spaces:
Running
Running
Commit
•
f532dce
1
Parent(s):
d934b39
Update app.py
Browse files
app.py
CHANGED
@@ -31,7 +31,10 @@ from transformers import AutoProcessor, AutoModelForCausalLM
|
|
31 |
|
32 |
if not is_spaces:
|
33 |
from toolkit.job import get_job
|
34 |
-
|
|
|
|
|
|
|
35 |
MAX_IMAGES = 150
|
36 |
|
37 |
|
@@ -152,7 +155,7 @@ def start_training(
|
|
152 |
slugged_lora_name = slugify(lora_name)
|
153 |
|
154 |
# Load the default config
|
155 |
-
with open("train_lora_flux_24gb.yaml", "r") as f:
|
156 |
config = yaml.safe_load(f)
|
157 |
|
158 |
# Update the config with user inputs
|
@@ -164,7 +167,9 @@ def start_training(
|
|
164 |
config["config"]["process"][0]["network"]["linear"] = int(rank)
|
165 |
config["config"]["process"][0]["network"]["linear_alpha"] = int(rank)
|
166 |
config["config"]["process"][0]["datasets"][0]["folder_path"] = dataset_folder
|
|
|
167 |
config["config"]["process"][0]["save"]["hf_repo_id"] = f"{profile.username}/{slugged_lora_name}"
|
|
|
168 |
if concept_sentence:
|
169 |
config["config"]["process"][0]["trigger_word"] = concept_sentence
|
170 |
if sample_1 or sample_2 or sample_2:
|
@@ -225,7 +230,6 @@ css = """
|
|
225 |
.tabitem{border: 0px}
|
226 |
"""
|
227 |
|
228 |
-
|
229 |
def swap_visibilty(profile: gr.OAuthProfile | None):
|
230 |
print(profile)
|
231 |
if is_spaces:
|
|
|
31 |
|
32 |
if not is_spaces:
|
33 |
from toolkit.job import get_job
|
34 |
+
else:
|
35 |
+
gr.OAuthProfile = None
|
36 |
+
gr.OAuthToken = None
|
37 |
+
|
38 |
MAX_IMAGES = 150
|
39 |
|
40 |
|
|
|
155 |
slugged_lora_name = slugify(lora_name)
|
156 |
|
157 |
# Load the default config
|
158 |
+
with open("train_lora_flux_24gb.yaml" if is_spaces else "config/examples/train_lora_flux_24gb.yaml", "r") as f:
|
159 |
config = yaml.safe_load(f)
|
160 |
|
161 |
# Update the config with user inputs
|
|
|
167 |
config["config"]["process"][0]["network"]["linear"] = int(rank)
|
168 |
config["config"]["process"][0]["network"]["linear_alpha"] = int(rank)
|
169 |
config["config"]["process"][0]["datasets"][0]["folder_path"] = dataset_folder
|
170 |
+
config["config"]["process"][0]["save"]["push_to_hub"] = True
|
171 |
config["config"]["process"][0]["save"]["hf_repo_id"] = f"{profile.username}/{slugged_lora_name}"
|
172 |
+
config["config"]["process"][0]["save"]["hf_private"] = True
|
173 |
if concept_sentence:
|
174 |
config["config"]["process"][0]["trigger_word"] = concept_sentence
|
175 |
if sample_1 or sample_2 or sample_2:
|
|
|
230 |
.tabitem{border: 0px}
|
231 |
"""
|
232 |
|
|
|
233 |
def swap_visibilty(profile: gr.OAuthProfile | None):
|
234 |
print(profile)
|
235 |
if is_spaces:
|