Spaces:
Running
on
Zero
Running
on
Zero
Update default paths in app.py and download_qwen_image_models.py to use /data and /auto directories. Adjust metadata generation script to reflect new working directory structure.
Browse files- app.py +11 -6
- download_qwen_image_models.py +1 -1
app.py
CHANGED
|
@@ -18,12 +18,12 @@ from download_qwen_image_models import download_all_models, DEFAULT_MODELS_DIR
|
|
| 18 |
|
| 19 |
|
| 20 |
# Defaults matching train_QIE.sh expectations
|
| 21 |
-
DEFAULT_DATA_ROOT = "/
|
| 22 |
DEFAULT_IMAGE_FOLDER = "image"
|
| 23 |
-
DEFAULT_OUTPUT_DIR_BASE = "/
|
| 24 |
-
DEFAULT_DATASET_CONFIG = "/
|
| 25 |
-
DEFAULT_MODELS_ROOT = DEFAULT_MODELS_DIR # "/
|
| 26 |
-
WORKSPACE_AUTO_DIR = "/
|
| 27 |
|
| 28 |
# musubi-tuner settings
|
| 29 |
DEFAULT_MUSUBI_TUNER_DIR = os.environ.get("MUSUBI_TUNER_DIR", "/musubi-tuner")
|
|
@@ -140,6 +140,11 @@ def _prepare_script(
|
|
| 140 |
txt = _replace_model_path(txt, "text_encoder", "text_encoder/qwen_2.5_vl_7b.safetensors")
|
| 141 |
txt = _replace_model_path(txt, "dit", "dit/qwen_image_edit_2509_bf16.safetensors")
|
| 142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
# ZeroGPU compatibility: avoid spawning via 'accelerate launch'.
|
| 144 |
# Run the training module directly in-process so GPU stays attached
|
| 145 |
# to the same Python request context.
|
|
@@ -298,7 +303,7 @@ def build_ui() -> gr.Blocks:
|
|
| 298 |
# Qwen-Image-Edit Trainer
|
| 299 |
- Downloads required models on startup.
|
| 300 |
- Generates metadata and trains via `train_QIE.sh`.
|
| 301 |
-
- Paths are POSIX-style (e.g., /
|
| 302 |
""")
|
| 303 |
|
| 304 |
with gr.Row():
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
# Defaults matching train_QIE.sh expectations
|
| 21 |
+
DEFAULT_DATA_ROOT = "/data"
|
| 22 |
DEFAULT_IMAGE_FOLDER = "image"
|
| 23 |
+
DEFAULT_OUTPUT_DIR_BASE = "/auto/train_LoRA"
|
| 24 |
+
DEFAULT_DATASET_CONFIG = "/auto/dataset_QIE.toml"
|
| 25 |
+
DEFAULT_MODELS_ROOT = DEFAULT_MODELS_DIR # "/Qwen-Image_models"
|
| 26 |
+
WORKSPACE_AUTO_DIR = "/auto"
|
| 27 |
|
| 28 |
# musubi-tuner settings
|
| 29 |
DEFAULT_MUSUBI_TUNER_DIR = os.environ.get("MUSUBI_TUNER_DIR", "/musubi-tuner")
|
|
|
|
| 140 |
txt = _replace_model_path(txt, "text_encoder", "text_encoder/qwen_2.5_vl_7b.safetensors")
|
| 141 |
txt = _replace_model_path(txt, "dit", "dit/qwen_image_edit_2509_bf16.safetensors")
|
| 142 |
|
| 143 |
+
# Replace working dir for metadata generation to root /auto
|
| 144 |
+
txt = re.sub(r"^cd\s+/workspace/auto\s*$", "cd /auto", txt, flags=re.MULTILINE)
|
| 145 |
+
# Ensure musubi-tuner path matches configured location
|
| 146 |
+
txt = re.sub(r"^cd\s+/musubi-tuner\s*$", f"cd {re.escape(DEFAULT_MUSUBI_TUNER_DIR)}", txt, flags=re.MULTILINE)
|
| 147 |
+
|
| 148 |
# ZeroGPU compatibility: avoid spawning via 'accelerate launch'.
|
| 149 |
# Run the training module directly in-process so GPU stays attached
|
| 150 |
# to the same Python request context.
|
|
|
|
| 303 |
# Qwen-Image-Edit Trainer
|
| 304 |
- Downloads required models on startup.
|
| 305 |
- Generates metadata and trains via `train_QIE.sh`.
|
| 306 |
+
- Paths are POSIX-style (e.g., /data, /auto, /Qwen-Image_models...).
|
| 307 |
""")
|
| 308 |
|
| 309 |
with gr.Row():
|
download_qwen_image_models.py
CHANGED
|
@@ -7,7 +7,7 @@ from huggingface_hub import hf_hub_download
|
|
| 7 |
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
| 8 |
|
| 9 |
DEFAULT_MODELS_DIR = os.environ.get("QWEN_IMAGE_MODELS_DIR",
|
| 10 |
-
"/
|
| 11 |
# Temporary download root (requested: use /tmp instead of /workspace)
|
| 12 |
TMP_DOWNLOAD_ROOT = os.environ.get("QWEN_IMAGE_TMP_DIR", "/tmp/qie_downloads")
|
| 13 |
|
|
|
|
| 7 |
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
| 8 |
|
| 9 |
DEFAULT_MODELS_DIR = os.environ.get("QWEN_IMAGE_MODELS_DIR",
|
| 10 |
+
"/Qwen-Image_models")
|
| 11 |
# Temporary download root (requested: use /tmp instead of /workspace)
|
| 12 |
TMP_DOWNLOAD_ROOT = os.environ.get("QWEN_IMAGE_TMP_DIR", "/tmp/qie_downloads")
|
| 13 |
|