Pre-download Gemma at startup; bump guidance to 5.0 for prompt adherence
Browse files- app.py +16 -8
- generate.py +1 -1
app.py
CHANGED
|
@@ -91,13 +91,21 @@ def setup():
|
|
| 91 |
for repo, fname, dest in SULPHUR_ASSETS + LTX_ASSETS:
|
| 92 |
_download(repo, fname, dest)
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
FINETUNES_DIR.mkdir(parents=True, exist_ok=True)
|
| 103 |
(FINETUNES_DIR / "sulphur_2_base.json").write_text(json.dumps(SULPHUR_FINETUNE, indent=2))
|
|
@@ -178,7 +186,7 @@ with gr.Blocks(title="Sulphur — Image to Video") as demo:
|
|
| 178 |
with gr.Accordion("Advanced", open=False):
|
| 179 |
resolution_dd = gr.Dropdown(RESOLUTIONS, value="832x480", label="Resolution")
|
| 180 |
steps_sl = gr.Slider(1, 50, value=8, step=1, label="Steps")
|
| 181 |
-
guidance_sl = gr.Slider(1.0, 10.0, value=
|
| 182 |
frames_sl = gr.Slider(17, 257, value=81, step=8, label="Frames")
|
| 183 |
seed_num = gr.Number(value=-1, label="Seed (-1 = random)", precision=0)
|
| 184 |
run_btn = gr.Button("Generate", variant="primary")
|
|
|
|
| 91 |
for repo, fname, dest in SULPHUR_ASSETS + LTX_ASSETS:
|
| 92 |
_download(repo, fname, dest)
|
| 93 |
|
| 94 |
+
# Gemma text encoder — must stay in its subfolder (Wan2GP looks there by name)
|
| 95 |
+
_gemma_folder = "gemma-3-12b-it-qat-q4_0-unquantized"
|
| 96 |
+
_gemma_file = f"{_gemma_folder}_quanto_bf16_int8.safetensors"
|
| 97 |
+
gemma_dest = CKPTS_DIR / _gemma_folder / _gemma_file
|
| 98 |
+
if not gemma_dest.exists():
|
| 99 |
+
from huggingface_hub import hf_hub_download
|
| 100 |
+
print("[download] Gemma text encoder...")
|
| 101 |
+
hf_hub_download(
|
| 102 |
+
repo_id="DeepBeepMeep/LTX-2",
|
| 103 |
+
filename=f"{_gemma_folder}/{_gemma_file}",
|
| 104 |
+
local_dir=str(CKPTS_DIR),
|
| 105 |
+
token=_HF_TOKEN,
|
| 106 |
+
)
|
| 107 |
+
else:
|
| 108 |
+
print("[download] cached: Gemma text encoder")
|
| 109 |
|
| 110 |
FINETUNES_DIR.mkdir(parents=True, exist_ok=True)
|
| 111 |
(FINETUNES_DIR / "sulphur_2_base.json").write_text(json.dumps(SULPHUR_FINETUNE, indent=2))
|
|
|
|
| 186 |
with gr.Accordion("Advanced", open=False):
|
| 187 |
resolution_dd = gr.Dropdown(RESOLUTIONS, value="832x480", label="Resolution")
|
| 188 |
steps_sl = gr.Slider(1, 50, value=8, step=1, label="Steps")
|
| 189 |
+
guidance_sl = gr.Slider(1.0, 10.0, value=5.0, step=0.5, label="Guidance Scale")
|
| 190 |
frames_sl = gr.Slider(17, 257, value=81, step=8, label="Frames")
|
| 191 |
seed_num = gr.Number(value=-1, label="Seed (-1 = random)", precision=0)
|
| 192 |
run_btn = gr.Button("Generate", variant="primary")
|
generate.py
CHANGED
|
@@ -17,7 +17,7 @@ MODEL_SHORTHANDS = {
|
|
| 17 |
DEFAULTS = {
|
| 18 |
"sulphur_2_base": {
|
| 19 |
"num_inference_steps": 8,
|
| 20 |
-
"guidance_scale":
|
| 21 |
"resolution": "832x480",
|
| 22 |
"video_length": 81,
|
| 23 |
},
|
|
|
|
| 17 |
DEFAULTS = {
|
| 18 |
"sulphur_2_base": {
|
| 19 |
"num_inference_steps": 8,
|
| 20 |
+
"guidance_scale": 5.0,
|
| 21 |
"resolution": "832x480",
|
| 22 |
"video_length": 81,
|
| 23 |
},
|