Spaces:
Running on Zero
Running on Zero
daKhosa commited on
Commit ·
e234e6d
1
Parent(s): 6cf6261
Add 10Eros v1 as selectable model (FP8 full checkpoint, not LoRA)
Browse files- app.py +31 -8
- generate.py +18 -5
app.py
CHANGED
|
@@ -30,11 +30,30 @@ SULPHUR_ASSETS = [
|
|
| 30 |
LTX_ASSETS = [
|
| 31 |
("SulphurAI/Sulphur-2-base", "experimental/sulphur_experimental_lora_v1.safetensors", LORAS_DIR),
|
| 32 |
("DeepBeepMeep/LTX-2", "ltx-2.3-22b-distilled-lora-384.safetensors", LORAS_DIR),
|
| 33 |
-
("TenStrip/LTX2.3-10Eros", "10Eros_v1-fp8mixed_learned.safetensors", LORAS_DIR),
|
| 34 |
("DeepBeepMeep/LTX-2", "ltx-2.3-22b_vae.safetensors", CKPTS_DIR),
|
| 35 |
("DeepBeepMeep/LTX-2", "ltx-2.3-22b_text_embedding_projection.safetensors", CKPTS_DIR),
|
| 36 |
("DeepBeepMeep/LTX-2", "ltx-2.3-22b_embeddings_connector.safetensors", CKPTS_DIR),
|
| 37 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
SULPHUR_FINETUNE = {
|
| 40 |
"model": {
|
|
@@ -90,7 +109,7 @@ def setup():
|
|
| 90 |
check=True,
|
| 91 |
)
|
| 92 |
|
| 93 |
-
for repo, fname, dest in SULPHUR_ASSETS + LTX_ASSETS:
|
| 94 |
_download(repo, fname, dest)
|
| 95 |
|
| 96 |
# Gemma text encoder — must stay in its subfolder (Wan2GP looks there by name)
|
|
@@ -111,6 +130,7 @@ def setup():
|
|
| 111 |
|
| 112 |
FINETUNES_DIR.mkdir(parents=True, exist_ok=True)
|
| 113 |
(FINETUNES_DIR / "sulphur_2_base.json").write_text(json.dumps(SULPHUR_FINETUNE, indent=2))
|
|
|
|
| 114 |
print("[setup] Done.")
|
| 115 |
|
| 116 |
|
|
@@ -119,8 +139,10 @@ setup()
|
|
| 119 |
RESOLUTIONS = ["832x480", "480x832", "640x640", "1024x576", "576x1024"]
|
| 120 |
|
| 121 |
|
|
|
|
|
|
|
| 122 |
@spaces.GPU(duration=120)
|
| 123 |
-
def generate_video(image, prompt, resolution, steps, guidance_scale, frames, seed):
|
| 124 |
if image is None:
|
| 125 |
raise gr.Error("Please upload an image.")
|
| 126 |
if not prompt.strip():
|
|
@@ -134,7 +156,7 @@ def generate_video(image, prompt, resolution, steps, guidance_scale, frames, see
|
|
| 134 |
"--image", image,
|
| 135 |
"--prompt", prompt,
|
| 136 |
"--output", str(out_file),
|
| 137 |
-
"--model", "sulphur-2",
|
| 138 |
"--seed", str(int(seed)),
|
| 139 |
"--resolution", resolution,
|
| 140 |
"--steps", str(int(steps)),
|
|
@@ -180,11 +202,12 @@ def generate_video(image, prompt, resolution, steps, guidance_scale, frames, see
|
|
| 180 |
|
| 181 |
|
| 182 |
with gr.Blocks(title="Sulphur — Image to Video") as demo:
|
| 183 |
-
gr.Markdown("# Sulphur — Image to Video
|
| 184 |
with gr.Row():
|
| 185 |
with gr.Column(scale=1):
|
| 186 |
-
image_in
|
| 187 |
-
prompt_in
|
|
|
|
| 188 |
with gr.Accordion("Advanced", open=False):
|
| 189 |
resolution_dd = gr.Dropdown(RESOLUTIONS, value="832x480", label="Resolution")
|
| 190 |
steps_sl = gr.Slider(1, 50, value=8, step=1, label="Steps")
|
|
@@ -198,7 +221,7 @@ with gr.Blocks(title="Sulphur — Image to Video") as demo:
|
|
| 198 |
|
| 199 |
run_btn.click(
|
| 200 |
fn=generate_video,
|
| 201 |
-
inputs=[image_in, prompt_in, resolution_dd, steps_sl, guidance_sl, frames_sl, seed_num],
|
| 202 |
outputs=[video_out, log_out],
|
| 203 |
)
|
| 204 |
|
|
|
|
| 30 |
LTX_ASSETS = [
|
| 31 |
("SulphurAI/Sulphur-2-base", "experimental/sulphur_experimental_lora_v1.safetensors", LORAS_DIR),
|
| 32 |
("DeepBeepMeep/LTX-2", "ltx-2.3-22b-distilled-lora-384.safetensors", LORAS_DIR),
|
|
|
|
| 33 |
("DeepBeepMeep/LTX-2", "ltx-2.3-22b_vae.safetensors", CKPTS_DIR),
|
| 34 |
("DeepBeepMeep/LTX-2", "ltx-2.3-22b_text_embedding_projection.safetensors", CKPTS_DIR),
|
| 35 |
("DeepBeepMeep/LTX-2", "ltx-2.3-22b_embeddings_connector.safetensors", CKPTS_DIR),
|
| 36 |
]
|
| 37 |
+
EROS_ASSETS = [
|
| 38 |
+
("TenStrip/LTX2.3-10Eros", "10Eros_v1-fp8mixed_learned.safetensors", CKPTS_DIR),
|
| 39 |
+
]
|
| 40 |
+
|
| 41 |
+
EROS_FINETUNE = {
|
| 42 |
+
"model": {
|
| 43 |
+
"name": "10Eros v1",
|
| 44 |
+
"visible": True,
|
| 45 |
+
"architecture": "ltx2_22B",
|
| 46 |
+
"parent_model_type": "ltx2_22B",
|
| 47 |
+
"description": "LTX-2.3 fine-tune by TenStrip. FP8 mixed precision.",
|
| 48 |
+
"URLs": [str(CKPTS_DIR / "10Eros_v1-fp8mixed_learned.safetensors")],
|
| 49 |
+
"preload_URLs": [],
|
| 50 |
+
},
|
| 51 |
+
"num_inference_steps": 25,
|
| 52 |
+
"video_length": 81,
|
| 53 |
+
"resolution": "832x480",
|
| 54 |
+
"guidance_scale": 3.5,
|
| 55 |
+
"alt_guidance_scale": 3.5,
|
| 56 |
+
}
|
| 57 |
|
| 58 |
SULPHUR_FINETUNE = {
|
| 59 |
"model": {
|
|
|
|
| 109 |
check=True,
|
| 110 |
)
|
| 111 |
|
| 112 |
+
for repo, fname, dest in SULPHUR_ASSETS + LTX_ASSETS + EROS_ASSETS:
|
| 113 |
_download(repo, fname, dest)
|
| 114 |
|
| 115 |
# Gemma text encoder — must stay in its subfolder (Wan2GP looks there by name)
|
|
|
|
| 130 |
|
| 131 |
FINETUNES_DIR.mkdir(parents=True, exist_ok=True)
|
| 132 |
(FINETUNES_DIR / "sulphur_2_base.json").write_text(json.dumps(SULPHUR_FINETUNE, indent=2))
|
| 133 |
+
(FINETUNES_DIR / "eros_10_v1.json").write_text(json.dumps(EROS_FINETUNE, indent=2))
|
| 134 |
print("[setup] Done.")
|
| 135 |
|
| 136 |
|
|
|
|
| 139 |
RESOLUTIONS = ["832x480", "480x832", "640x640", "1024x576", "576x1024"]
|
| 140 |
|
| 141 |
|
| 142 |
+
MODEL_MAP = {"Sulphur 2 Base": "sulphur-2", "10Eros v1": "eros-10"}
|
| 143 |
+
|
| 144 |
@spaces.GPU(duration=120)
|
| 145 |
+
def generate_video(image, prompt, model_choice, resolution, steps, guidance_scale, frames, seed):
|
| 146 |
if image is None:
|
| 147 |
raise gr.Error("Please upload an image.")
|
| 148 |
if not prompt.strip():
|
|
|
|
| 156 |
"--image", image,
|
| 157 |
"--prompt", prompt,
|
| 158 |
"--output", str(out_file),
|
| 159 |
+
"--model", MODEL_MAP.get(model_choice, "sulphur-2"),
|
| 160 |
"--seed", str(int(seed)),
|
| 161 |
"--resolution", resolution,
|
| 162 |
"--steps", str(int(steps)),
|
|
|
|
| 202 |
|
| 203 |
|
| 204 |
with gr.Blocks(title="Sulphur — Image to Video") as demo:
|
| 205 |
+
gr.Markdown("# Sulphur — Image to Video")
|
| 206 |
with gr.Row():
|
| 207 |
with gr.Column(scale=1):
|
| 208 |
+
image_in = gr.Image(type="filepath", label="Input Image")
|
| 209 |
+
prompt_in = gr.Textbox(label="Prompt", placeholder="Describe the motion…", lines=3)
|
| 210 |
+
model_radio = gr.Radio(list(MODEL_MAP.keys()), value="Sulphur 2 Base", label="Model")
|
| 211 |
with gr.Accordion("Advanced", open=False):
|
| 212 |
resolution_dd = gr.Dropdown(RESOLUTIONS, value="832x480", label="Resolution")
|
| 213 |
steps_sl = gr.Slider(1, 50, value=8, step=1, label="Steps")
|
|
|
|
| 221 |
|
| 222 |
run_btn.click(
|
| 223 |
fn=generate_video,
|
| 224 |
+
inputs=[image_in, prompt_in, model_radio, resolution_dd, steps_sl, guidance_sl, frames_sl, seed_num],
|
| 225 |
outputs=[video_out, log_out],
|
| 226 |
)
|
| 227 |
|
generate.py
CHANGED
|
@@ -13,6 +13,7 @@ WAN2GP_ROOT = Path(os.environ.get("WAN2GP_ROOT", "/tmp/Wan2GP"))
|
|
| 13 |
|
| 14 |
MODEL_SHORTHANDS = {
|
| 15 |
"sulphur-2": "sulphur_2_base",
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
DEFAULTS = {
|
|
@@ -22,6 +23,20 @@ DEFAULTS = {
|
|
| 22 |
"resolution": "832x480",
|
| 23 |
"video_length": 81,
|
| 24 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
|
|
@@ -48,6 +63,7 @@ def main():
|
|
| 48 |
|
| 49 |
model_type = MODEL_SHORTHANDS.get(args.model, args.model)
|
| 50 |
defaults = DEFAULTS.get(model_type, DEFAULTS["sulphur_2_base"])
|
|
|
|
| 51 |
|
| 52 |
image_path = str(Path(args.image.strip()).resolve())
|
| 53 |
if not Path(image_path).exists():
|
|
@@ -83,11 +99,8 @@ def main():
|
|
| 83 |
"seed": args.seed,
|
| 84 |
"image_prompt_type": "S",
|
| 85 |
"input_video_strength": 1.0,
|
| 86 |
-
"activated_loras":
|
| 87 |
-
|
| 88 |
-
"10Eros_v1-fp8mixed_learned.safetensors",
|
| 89 |
-
],
|
| 90 |
-
"loras_multipliers": ["0.5", "0.8"],
|
| 91 |
}
|
| 92 |
|
| 93 |
p(f"Model: {model_type}")
|
|
|
|
| 13 |
|
| 14 |
MODEL_SHORTHANDS = {
|
| 15 |
"sulphur-2": "sulphur_2_base",
|
| 16 |
+
"eros-10": "eros_10_v1",
|
| 17 |
}
|
| 18 |
|
| 19 |
DEFAULTS = {
|
|
|
|
| 23 |
"resolution": "832x480",
|
| 24 |
"video_length": 81,
|
| 25 |
},
|
| 26 |
+
"eros_10_v1": {
|
| 27 |
+
"num_inference_steps": 25,
|
| 28 |
+
"guidance_scale": 3.5,
|
| 29 |
+
"resolution": "832x480",
|
| 30 |
+
"video_length": 81,
|
| 31 |
+
},
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
LORAS_BY_MODEL = {
|
| 35 |
+
"sulphur_2_base": (
|
| 36 |
+
["sulphur_experimental_lora_v1.safetensors"],
|
| 37 |
+
["0.5"],
|
| 38 |
+
),
|
| 39 |
+
"eros_10_v1": ([], []),
|
| 40 |
}
|
| 41 |
|
| 42 |
|
|
|
|
| 63 |
|
| 64 |
model_type = MODEL_SHORTHANDS.get(args.model, args.model)
|
| 65 |
defaults = DEFAULTS.get(model_type, DEFAULTS["sulphur_2_base"])
|
| 66 |
+
loras, lora_multipliers = LORAS_BY_MODEL.get(model_type, ([], []))
|
| 67 |
|
| 68 |
image_path = str(Path(args.image.strip()).resolve())
|
| 69 |
if not Path(image_path).exists():
|
|
|
|
| 99 |
"seed": args.seed,
|
| 100 |
"image_prompt_type": "S",
|
| 101 |
"input_video_strength": 1.0,
|
| 102 |
+
"activated_loras": loras,
|
| 103 |
+
"loras_multipliers": lora_multipliers,
|
|
|
|
|
|
|
|
|
|
| 104 |
}
|
| 105 |
|
| 106 |
p(f"Model: {model_type}")
|