Upload folder using huggingface_hub (part 2)
Browse files- nodes/basic.py +9 -11
- scripts/test_rtx_upscale_integration.py +16 -14
- scripts/test_t2v_r2v_and_loader.py +46 -33
- tests/test_h3_project.py +1 -18
- tests/test_llm_api.py +0 -3
- tests/test_minimax_node.py +1 -2
- tests/test_multitrack_info_output.py +1 -3
- utils/h3_project.py +3 -20
- utils/llm_api.py +1 -5
- web/js/editor-loader.js +48 -0
nodes/basic.py
CHANGED
|
@@ -210,10 +210,11 @@ CATEGORY_LOGIC = "EasyUse/Logic"
|
|
| 210 |
CATEGORY_VIDEO = "EasyUse/Video"
|
| 211 |
PROMPT_FORMAT_OPTIONS = ["default", "promptRelay"]
|
| 212 |
|
| 213 |
-
#
|
| 214 |
-
#
|
| 215 |
-
#
|
| 216 |
-
#
|
|
|
|
| 217 |
FORMAT_DISPLAY_LABEL = "Moxie Multimedia"
|
| 218 |
FORMAT_INTERNAL_VALUE = "MiniMax"
|
| 219 |
|
|
@@ -1258,7 +1259,7 @@ class TimelineEditor(io.ComfyNode):
|
|
| 1258 |
options=resolution_combo_options,
|
| 1259 |
tooltip="Select a resolution or choose 'Custom' to specify your own width and height.",
|
| 1260 |
),
|
| 1261 |
-
io.Combo.Input("format", options=[
|
| 1262 |
TYPE_TIMELINE.Input(
|
| 1263 |
"timeline_data",
|
| 1264 |
),
|
|
@@ -1883,7 +1884,7 @@ class MultiTrackEditor(io.ComfyNode):
|
|
| 1883 |
options=resolution_combo_options,
|
| 1884 |
tooltip="Select a resolution or choose 'Custom'. Width and height of 32 enable audio-only output in MultiTrack Project.",
|
| 1885 |
),
|
| 1886 |
-
io.Combo.Input("format", options=[
|
| 1887 |
TYPE_TRACK_DATA.Input("track_data"),
|
| 1888 |
io.AnyType.Input("prompt_override", optional=True, tooltip="If provided, overrides all segment prompts in the timeline.",),
|
| 1889 |
io.Image.Input("image", optional=True, lazy=True, tooltip="Optional image media list for slot-based multitrack segments."),
|
|
@@ -2686,10 +2687,7 @@ def _multitrack_task_type(task: dict, image_count: int, has_video: bool) -> str:
|
|
| 2686 |
content = task.get("content", {})
|
| 2687 |
explicit_task_type = content.get("task_type") if isinstance(content, dict) else None
|
| 2688 |
if isinstance(explicit_task_type, str) and explicit_task_type.strip():
|
| 2689 |
-
|
| 2690 |
-
# The Moxie model set is reference-conditioned: T2V must yield the
|
| 2691 |
-
# exact same value as R2V (mirrors utils.h3_project.h3_task_type).
|
| 2692 |
-
return "r2v" if normalized == "t2v" else normalized
|
| 2693 |
mode = content.get("task_mode", "default") if isinstance(content, dict) else "default"
|
| 2694 |
if mode == "l2v":
|
| 2695 |
return "l2v"
|
|
@@ -2697,7 +2695,7 @@ def _multitrack_task_type(task: dict, image_count: int, has_video: bool) -> str:
|
|
| 2697 |
return "rv2v" if has_video else "r2v"
|
| 2698 |
if mode == "edit":
|
| 2699 |
return "vi2v" if image_count > 0 else "v2v"
|
| 2700 |
-
return "i2v" if image_count > 0 else "
|
| 2701 |
|
| 2702 |
|
| 2703 |
# code based on https://github.com/RH-RunningHub/ComfyUI-RH-Bernini/blob/main/nodes_bernini.py
|
|
|
|
| 210 |
CATEGORY_VIDEO = "EasyUse/Video"
|
| 211 |
PROMPT_FORMAT_OPTIONS = ["default", "promptRelay"]
|
| 212 |
|
| 213 |
+
# Legacy tolerance only: workflows saved while the format combo displayed a
|
| 214 |
+
# branded label still queue that label; every consumer in the chain -
|
| 215 |
+
# tracks_info, conditioning caches, saved project manifests, frontend lookups -
|
| 216 |
+
# keys on the internal value below, so queued values are normalized back at
|
| 217 |
+
# both node entries (and check_lazy_status) at execution time.
|
| 218 |
FORMAT_DISPLAY_LABEL = "Moxie Multimedia"
|
| 219 |
FORMAT_INTERNAL_VALUE = "MiniMax"
|
| 220 |
|
|
|
|
| 1259 |
options=resolution_combo_options,
|
| 1260 |
tooltip="Select a resolution or choose 'Custom' to specify your own width and height.",
|
| 1261 |
),
|
| 1262 |
+
io.Combo.Input("format", options=[FORMAT_INTERNAL_VALUE], default=FORMAT_INTERNAL_VALUE, tooltip="Moxie Multimedia Suite only supports the bundled Moxie video model."),
|
| 1263 |
TYPE_TIMELINE.Input(
|
| 1264 |
"timeline_data",
|
| 1265 |
),
|
|
|
|
| 1884 |
options=resolution_combo_options,
|
| 1885 |
tooltip="Select a resolution or choose 'Custom'. Width and height of 32 enable audio-only output in MultiTrack Project.",
|
| 1886 |
),
|
| 1887 |
+
io.Combo.Input("format", options=[FORMAT_INTERNAL_VALUE], default=FORMAT_INTERNAL_VALUE, tooltip="Moxie Multimedia Suite only supports the bundled Moxie video model."),
|
| 1888 |
TYPE_TRACK_DATA.Input("track_data"),
|
| 1889 |
io.AnyType.Input("prompt_override", optional=True, tooltip="If provided, overrides all segment prompts in the timeline.",),
|
| 1890 |
io.Image.Input("image", optional=True, lazy=True, tooltip="Optional image media list for slot-based multitrack segments."),
|
|
|
|
| 2687 |
content = task.get("content", {})
|
| 2688 |
explicit_task_type = content.get("task_type") if isinstance(content, dict) else None
|
| 2689 |
if isinstance(explicit_task_type, str) and explicit_task_type.strip():
|
| 2690 |
+
return explicit_task_type.strip()
|
|
|
|
|
|
|
|
|
|
| 2691 |
mode = content.get("task_mode", "default") if isinstance(content, dict) else "default"
|
| 2692 |
if mode == "l2v":
|
| 2693 |
return "l2v"
|
|
|
|
| 2695 |
return "rv2v" if has_video else "r2v"
|
| 2696 |
if mode == "edit":
|
| 2697 |
return "vi2v" if image_count > 0 else "v2v"
|
| 2698 |
+
return "i2v" if image_count > 0 else "t2v"
|
| 2699 |
|
| 2700 |
|
| 2701 |
# code based on https://github.com/RH-RunningHub/ComfyUI-RH-Bernini/blob/main/nodes_bernini.py
|
scripts/test_rtx_upscale_integration.py
CHANGED
|
@@ -370,21 +370,22 @@ check(
|
|
| 370 |
and "Lanczos fallback" in rtx_source,
|
| 371 |
)
|
| 372 |
|
| 373 |
-
# 16. format combo
|
|
|
|
| 374 |
basic_source = (PACK / "nodes" / "basic.py").read_text(encoding="utf-8")
|
| 375 |
check(
|
| 376 |
-
"format combo shows
|
| 377 |
-
basic_source.count('options=[
|
| 378 |
-
and '
|
| 379 |
and 'FORMAT_INTERNAL_VALUE = "MiniMax"' in basic_source,
|
| 380 |
)
|
| 381 |
check(
|
| 382 |
-
"
|
| 383 |
basic_source.count("\n format = _normalize_format(format)") == 2
|
| 384 |
and "\n raw_format = _normalize_format(format)" in basic_source,
|
| 385 |
)
|
| 386 |
|
| 387 |
-
# 17. shipped templates carry the
|
| 388 |
import json as _json
|
| 389 |
|
| 390 |
for name in ("Moxie-consolidated.json", "Moxie.json", "Moxie-clean.json"):
|
|
@@ -395,20 +396,21 @@ for name in ("Moxie-consolidated.json", "Moxie.json", "Moxie-clean.json"):
|
|
| 395 |
if node.get("type") == "easy multiTrackEditor"
|
| 396 |
)
|
| 397 |
check(
|
| 398 |
-
f"{name} format widget
|
| 399 |
-
editor["widgets_values"][2] == "
|
| 400 |
-
and editor["widgets_values_named"]["format"] == "
|
| 401 |
)
|
| 402 |
|
| 403 |
-
# 18. frontend
|
| 404 |
frontend_utils = (
|
| 405 |
PACK / "frontend" / "src" / "lib" / "multitrack-utils.ts"
|
| 406 |
).read_text(encoding="utf-8")
|
| 407 |
check(
|
| 408 |
-
"frontend format
|
| 409 |
-
"normalizeFormatValue" in frontend_utils
|
| 410 |
-
and "FORMAT_DISPLAY_LABEL
|
| 411 |
-
and
|
|
|
|
| 412 |
)
|
| 413 |
|
| 414 |
# --- MoxieCombine output cleanup (GetVideoComponents-style) ------------------
|
|
|
|
| 370 |
and "Lanczos fallback" in rtx_source,
|
| 371 |
)
|
| 372 |
|
| 373 |
+
# 16. format combo is the single internal value again; legacy label kept only
|
| 374 |
+
# as execution-time tolerance for old queued workflows
|
| 375 |
basic_source = (PACK / "nodes" / "basic.py").read_text(encoding="utf-8")
|
| 376 |
check(
|
| 377 |
+
"format combo shows MiniMax",
|
| 378 |
+
basic_source.count('options=[FORMAT_INTERNAL_VALUE]') == 2
|
| 379 |
+
and 'options=[FORMAT_DISPLAY_LABEL]' not in basic_source
|
| 380 |
and 'FORMAT_INTERNAL_VALUE = "MiniMax"' in basic_source,
|
| 381 |
)
|
| 382 |
check(
|
| 383 |
+
"legacy queued values still normalized at both node entries and lazy check",
|
| 384 |
basic_source.count("\n format = _normalize_format(format)") == 2
|
| 385 |
and "\n raw_format = _normalize_format(format)" in basic_source,
|
| 386 |
)
|
| 387 |
|
| 388 |
+
# 17. shipped templates carry the internal format value on the editor widget
|
| 389 |
import json as _json
|
| 390 |
|
| 391 |
for name in ("Moxie-consolidated.json", "Moxie.json", "Moxie-clean.json"):
|
|
|
|
| 396 |
if node.get("type") == "easy multiTrackEditor"
|
| 397 |
)
|
| 398 |
check(
|
| 399 |
+
f"{name} format widget is MiniMax",
|
| 400 |
+
editor["widgets_values"][2] == "MiniMax"
|
| 401 |
+
and editor["widgets_values_named"]["format"] == "MiniMax",
|
| 402 |
)
|
| 403 |
|
| 404 |
+
# 18. frontend is pristine upstream: no display-label mapping, t2v native
|
| 405 |
frontend_utils = (
|
| 406 |
PACK / "frontend" / "src" / "lib" / "multitrack-utils.ts"
|
| 407 |
).read_text(encoding="utf-8")
|
| 408 |
check(
|
| 409 |
+
"frontend has no format mapping and resolves t2v natively",
|
| 410 |
+
"normalizeFormatValue" not in frontend_utils
|
| 411 |
+
and "FORMAT_DISPLAY_LABEL" not in frontend_utils
|
| 412 |
+
and 'collected.format = format' in frontend_utils
|
| 413 |
+
and "return 't2v'" in frontend_utils,
|
| 414 |
)
|
| 415 |
|
| 416 |
# --- MoxieCombine output cleanup (GetVideoComponents-style) ------------------
|
scripts/test_t2v_r2v_and_loader.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
-
"""Standalone verification: T2V
|
| 3 |
|
| 4 |
No ComfyUI required. Checks (matching the standing verification rules):
|
| 5 |
-
1. utils/h3_project.py - h3_task_type / h3_generation_mode
|
| 6 |
-
|
| 7 |
-
2. nodes/basic.py - _multitrack_task_type mirrors the
|
| 8 |
-
3. utils/llm_api.py - reference-mode with zero media
|
| 9 |
-
cloud-native text-only mode
|
| 10 |
4. moxie_loader.py - schema shows a single model picker; execute()
|
| 11 |
auto-picks LoRA/VAE/CLIP from the pack's models/ folders and still
|
| 12 |
applies the LoRA to model+clip at strength 1.0.
|
|
@@ -88,7 +88,7 @@ def extract_constant(path, name):
|
|
| 88 |
|
| 89 |
|
| 90 |
# ---------------------------------------------------------------------------
|
| 91 |
-
# 1. utils/h3_project.py - T2V
|
| 92 |
# ---------------------------------------------------------------------------
|
| 93 |
|
| 94 |
def verify_h3_project():
|
|
@@ -98,11 +98,8 @@ def verify_h3_project():
|
|
| 98 |
|
| 99 |
h3_ns = extract_functions(
|
| 100 |
h3_file,
|
| 101 |
-
["h3_task_type", "h3_generation_mode", "
|
| 102 |
-
constants=("_T2V_EQUIVALENT_TASK_TYPE",),
|
| 103 |
)
|
| 104 |
-
equiv = h3_ns["_T2V_EQUIVALENT_TASK_TYPE"]
|
| 105 |
-
check("t2v equivalent constant is r2v", equiv == "r2v", repr(equiv))
|
| 106 |
|
| 107 |
def muted_image(image):
|
| 108 |
return bool(isinstance(image, dict) and image.get("muted"))
|
|
@@ -130,18 +127,18 @@ def verify_h3_project():
|
|
| 130 |
content["images"] = images
|
| 131 |
return {"start_frame": 0, "end_frame": 48, "task": {"content": content}}
|
| 132 |
|
| 133 |
-
check("default mode, no images ->
|
| 134 |
-
h3_task_type(entry_for(mode="default"), make_info()) == "
|
| 135 |
-
check("no task_mode, no images ->
|
| 136 |
-
h3_task_type(entry_for(), make_info()) == "
|
| 137 |
-
check("explicit t2v ->
|
| 138 |
-
h3_task_type(entry_for(task_type="t2v"), make_info()) == "
|
| 139 |
-
check("explicit T2V (uppercase) ->
|
| 140 |
-
h3_task_type(entry_for(task_type="T2V"), make_info()) == "
|
| 141 |
check("explicit custom type passes through",
|
| 142 |
h3_task_type(entry_for(task_type="wan-2.2-fun"), make_info()) == "wan-2.2-fun")
|
| 143 |
-
check("muted images ignored ->
|
| 144 |
-
h3_task_type(entry_for(images=[{"muted": True}]), make_info()) == "
|
| 145 |
check("one active image -> i2v unchanged",
|
| 146 |
h3_task_type(entry_for(images=[{"id": "a"}]), make_info()) == "i2v")
|
| 147 |
check("ref mode, no video -> r2v",
|
|
@@ -153,8 +150,8 @@ def verify_h3_project():
|
|
| 153 |
check("edit mode, no images -> v2v",
|
| 154 |
h3_task_type(entry_for(mode="edit"), make_info()) == "v2v")
|
| 155 |
|
| 156 |
-
check("generation_mode(t2v) ->
|
| 157 |
-
h3_generation_mode("t2v") == "
|
| 158 |
check("generation_mode(r2v) -> reference",
|
| 159 |
h3_generation_mode("r2v") == "reference")
|
| 160 |
check("generation_mode(rv2v) -> reference",
|
|
@@ -175,11 +172,11 @@ def verify_basic_node():
|
|
| 175 |
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "nodes", "basic.py"
|
| 176 |
)
|
| 177 |
resolver = extract_functions(basic_file, ["_multitrack_task_type"])["_multitrack_task_type"]
|
| 178 |
-
check("explicit t2v ->
|
| 179 |
-
resolver({"content": {"task_type": "t2v"}}, 0, False) == "
|
| 180 |
-
check("default mode, no images ->
|
| 181 |
-
resolver({"content": {"task_mode": "default"}}, 0, False) == "
|
| 182 |
-
check("no content ->
|
| 183 |
check("custom type kept",
|
| 184 |
resolver({"content": {"task_type": "wan-2.2-fun"}}, 0, False) == "wan-2.2-fun")
|
| 185 |
check("ref mode no video -> r2v",
|
|
@@ -191,7 +188,7 @@ def verify_basic_node():
|
|
| 191 |
|
| 192 |
|
| 193 |
# ---------------------------------------------------------------------------
|
| 194 |
-
# 3. utils/llm_api.py - reference-mode
|
| 195 |
# ---------------------------------------------------------------------------
|
| 196 |
|
| 197 |
def verify_llm_api():
|
|
@@ -200,10 +197,18 @@ def verify_llm_api():
|
|
| 200 |
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "utils", "llm_api.py"
|
| 201 |
)
|
| 202 |
media_resolver = extract_functions(llm_file, ["_h3_media_for_task_type"])["_h3_media_for_task_type"]
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
check("r2v with media -> r2va",
|
| 208 |
media_resolver("r2v", ["img1", "img2"], ["vid"], ["aud"]) == ("r2va", ["img1", "img2"], ["vid"], ["aud"]))
|
| 209 |
check("direct t2v still -> t2va",
|
|
@@ -325,6 +330,14 @@ def _install_loader_stubs(state):
|
|
| 325 |
sys.modules["comfy.ldm.modules"] = comfy_ldm_modules
|
| 326 |
sys.modules["comfy.ldm.modules.attention"] = comfy_attention
|
| 327 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
|
| 329 |
def _load_loader_module():
|
| 330 |
pack_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
+
"""Standalone verification: native T2V resolution + one-model loader.
|
| 3 |
|
| 4 |
No ComfyUI required. Checks (matching the standing verification rules):
|
| 5 |
+
1. utils/h3_project.py - h3_task_type / h3_generation_mode resolve T2V
|
| 6 |
+
natively (t2v stays t2v; multi_frames generation mode).
|
| 7 |
+
2. nodes/basic.py - _multitrack_task_type mirrors the native values.
|
| 8 |
+
3. utils/llm_api.py - reference-mode with zero media raises; t2v maps
|
| 9 |
+
to the cloud-native text-only mode.
|
| 10 |
4. moxie_loader.py - schema shows a single model picker; execute()
|
| 11 |
auto-picks LoRA/VAE/CLIP from the pack's models/ folders and still
|
| 12 |
applies the LoRA to model+clip at strength 1.0.
|
|
|
|
| 88 |
|
| 89 |
|
| 90 |
# ---------------------------------------------------------------------------
|
| 91 |
+
# 1. utils/h3_project.py - T2V resolves natively (upstream behavior)
|
| 92 |
# ---------------------------------------------------------------------------
|
| 93 |
|
| 94 |
def verify_h3_project():
|
|
|
|
| 98 |
|
| 99 |
h3_ns = extract_functions(
|
| 100 |
h3_file,
|
| 101 |
+
["h3_task_type", "h3_generation_mode", "_frame_value"],
|
|
|
|
| 102 |
)
|
|
|
|
|
|
|
| 103 |
|
| 104 |
def muted_image(image):
|
| 105 |
return bool(isinstance(image, dict) and image.get("muted"))
|
|
|
|
| 127 |
content["images"] = images
|
| 128 |
return {"start_frame": 0, "end_frame": 48, "task": {"content": content}}
|
| 129 |
|
| 130 |
+
check("default mode, no images -> t2v",
|
| 131 |
+
h3_task_type(entry_for(mode="default"), make_info()) == "t2v")
|
| 132 |
+
check("no task_mode, no images -> t2v",
|
| 133 |
+
h3_task_type(entry_for(), make_info()) == "t2v")
|
| 134 |
+
check("explicit t2v -> t2v",
|
| 135 |
+
h3_task_type(entry_for(task_type="t2v"), make_info()) == "t2v")
|
| 136 |
+
check("explicit T2V (uppercase) -> t2v",
|
| 137 |
+
h3_task_type(entry_for(task_type="T2V"), make_info()) == "t2v")
|
| 138 |
check("explicit custom type passes through",
|
| 139 |
h3_task_type(entry_for(task_type="wan-2.2-fun"), make_info()) == "wan-2.2-fun")
|
| 140 |
+
check("muted images ignored -> t2v",
|
| 141 |
+
h3_task_type(entry_for(images=[{"muted": True}]), make_info()) == "t2v")
|
| 142 |
check("one active image -> i2v unchanged",
|
| 143 |
h3_task_type(entry_for(images=[{"id": "a"}]), make_info()) == "i2v")
|
| 144 |
check("ref mode, no video -> r2v",
|
|
|
|
| 150 |
check("edit mode, no images -> v2v",
|
| 151 |
h3_task_type(entry_for(mode="edit"), make_info()) == "v2v")
|
| 152 |
|
| 153 |
+
check("generation_mode(t2v) -> multi_frames",
|
| 154 |
+
h3_generation_mode("t2v") == "multi_frames")
|
| 155 |
check("generation_mode(r2v) -> reference",
|
| 156 |
h3_generation_mode("r2v") == "reference")
|
| 157 |
check("generation_mode(rv2v) -> reference",
|
|
|
|
| 172 |
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "nodes", "basic.py"
|
| 173 |
)
|
| 174 |
resolver = extract_functions(basic_file, ["_multitrack_task_type"])["_multitrack_task_type"]
|
| 175 |
+
check("explicit t2v -> t2v",
|
| 176 |
+
resolver({"content": {"task_type": "t2v"}}, 0, False) == "t2v")
|
| 177 |
+
check("default mode, no images -> t2v",
|
| 178 |
+
resolver({"content": {"task_mode": "default"}}, 0, False) == "t2v")
|
| 179 |
+
check("no content -> t2v", resolver({}, 0, False) == "t2v")
|
| 180 |
check("custom type kept",
|
| 181 |
resolver({"content": {"task_type": "wan-2.2-fun"}}, 0, False) == "wan-2.2-fun")
|
| 182 |
check("ref mode no video -> r2v",
|
|
|
|
| 188 |
|
| 189 |
|
| 190 |
# ---------------------------------------------------------------------------
|
| 191 |
+
# 3. utils/llm_api.py - reference-mode needs media; t2v is the text-only path
|
| 192 |
# ---------------------------------------------------------------------------
|
| 193 |
|
| 194 |
def verify_llm_api():
|
|
|
|
| 197 |
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "utils", "llm_api.py"
|
| 198 |
)
|
| 199 |
media_resolver = extract_functions(llm_file, ["_h3_media_for_task_type"])["_h3_media_for_task_type"]
|
| 200 |
+
|
| 201 |
+
def raises_requires_media(task_type):
|
| 202 |
+
try:
|
| 203 |
+
media_resolver(task_type, [], [], [])
|
| 204 |
+
except ValueError as exc:
|
| 205 |
+
return "requires reference media" in str(exc)
|
| 206 |
+
return False
|
| 207 |
+
|
| 208 |
+
check("r2v with zero media raises (upstream behavior)",
|
| 209 |
+
raises_requires_media("r2v"))
|
| 210 |
+
check("rv2v with zero media raises",
|
| 211 |
+
raises_requires_media("rv2v"))
|
| 212 |
check("r2v with media -> r2va",
|
| 213 |
media_resolver("r2v", ["img1", "img2"], ["vid"], ["aud"]) == ("r2va", ["img1", "img2"], ["vid"], ["aud"]))
|
| 214 |
check("direct t2v still -> t2va",
|
|
|
|
| 330 |
sys.modules["comfy.ldm.modules"] = comfy_ldm_modules
|
| 331 |
sys.modules["comfy.ldm.modules.attention"] = comfy_attention
|
| 332 |
|
| 333 |
+
# Minimal torch stand-in: moxie_loader only touches dtype constants and
|
| 334 |
+
# torch.device("cpu") at execution time.
|
| 335 |
+
sys.modules["torch"] = types.SimpleNamespace(
|
| 336 |
+
float8_e4m3fn="float8_e4m3fn",
|
| 337 |
+
float8_e5m2="float8_e5m2",
|
| 338 |
+
device=lambda *args, **kwargs: ("device",) + tuple(args),
|
| 339 |
+
)
|
| 340 |
+
|
| 341 |
|
| 342 |
def _load_loader_module():
|
| 343 |
pack_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
tests/test_h3_project.py
CHANGED
|
@@ -93,24 +93,7 @@ def test_h3_task_type_ignores_muted_reference_images():
|
|
| 93 |
entry = h3_task_entries(info)[0]
|
| 94 |
entry["task"]["content"]["images"] = [{"muted": True}]
|
| 95 |
|
| 96 |
-
|
| 97 |
-
# exact same value as R2V.
|
| 98 |
-
assert h3_task_type(entry, info) == "r2v"
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
def test_h3_task_type_normalizes_explicit_t2v_to_r2v():
|
| 102 |
-
info = _tracks_info()
|
| 103 |
-
entry = h3_task_entries(info)[0]
|
| 104 |
-
entry["task"]["content"]["task_type"] = "t2v"
|
| 105 |
-
|
| 106 |
-
assert h3_task_type(entry, info) == "r2v"
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
def test_h3_generation_mode_maps_t2v_to_reference():
|
| 110 |
-
# Belt and braces: even a raw t2v value must behave exactly like R2V.
|
| 111 |
-
assert h3_generation_mode("t2v") == "reference"
|
| 112 |
-
assert h3_generation_mode("r2v") == "reference"
|
| 113 |
-
assert h3_generation_mode("i2v") == "multi_frames"
|
| 114 |
|
| 115 |
|
| 116 |
def test_parse_tracks_info_rejects_invalid_dimensions():
|
|
|
|
| 93 |
entry = h3_task_entries(info)[0]
|
| 94 |
entry["task"]["content"]["images"] = [{"muted": True}]
|
| 95 |
|
| 96 |
+
assert h3_task_type(entry, info) == "t2v"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
|
| 99 |
def test_parse_tracks_info_rejects_invalid_dimensions():
|
tests/test_llm_api.py
CHANGED
|
@@ -340,9 +340,6 @@ def test_video_data_uri_enforces_duration_even_when_file_is_under_size_limit(mon
|
|
| 340 |
("l2v", "i2va", 1, 0, 0),
|
| 341 |
("v2v", "r2va", 2, 1, 1),
|
| 342 |
("r2v", "r2va", 2, 1, 1),
|
| 343 |
-
# Reference-mode with zero media falls back to the cloud's native
|
| 344 |
-
# text-only mode (T2V selections resolve to r2v upstream).
|
| 345 |
-
("r2v", "t2va", 0, 0, 0),
|
| 346 |
("vi2v", "r2va", 2, 1, 1),
|
| 347 |
("rv2v", "r2va", 2, 1, 1),
|
| 348 |
],
|
|
|
|
| 340 |
("l2v", "i2va", 1, 0, 0),
|
| 341 |
("v2v", "r2va", 2, 1, 1),
|
| 342 |
("r2v", "r2va", 2, 1, 1),
|
|
|
|
|
|
|
|
|
|
| 343 |
("vi2v", "r2va", 2, 1, 1),
|
| 344 |
("rv2v", "r2va", 2, 1, 1),
|
| 345 |
],
|
tests/test_minimax_node.py
CHANGED
|
@@ -2305,8 +2305,7 @@ def test_multitrack_h3_project_expands_single_task_sampling_pipeline(monkeypatch
|
|
| 2305 |
assert nodes_by_type["KSamplerSelect"]["inputs"]["sampler_name"] == "er_sde"
|
| 2306 |
assert "ManualSigmas" in nodes_by_type
|
| 2307 |
conditioning = nodes_by_type["easy minimaxH3ToVideo"]["inputs"]
|
| 2308 |
-
|
| 2309 |
-
assert conditioning["mode"] == "reference"
|
| 2310 |
assert conditioning["ref_image_size"] == "match"
|
| 2311 |
assert (conditioning["width"], conditioning["height"]) == (1344, 768)
|
| 2312 |
assert "SamplerCustomAdvanced" in nodes_by_type
|
|
|
|
| 2305 |
assert nodes_by_type["KSamplerSelect"]["inputs"]["sampler_name"] == "er_sde"
|
| 2306 |
assert "ManualSigmas" in nodes_by_type
|
| 2307 |
conditioning = nodes_by_type["easy minimaxH3ToVideo"]["inputs"]
|
| 2308 |
+
assert conditioning["mode"] == "multi_frames"
|
|
|
|
| 2309 |
assert conditioning["ref_image_size"] == "match"
|
| 2310 |
assert (conditioning["width"], conditioning["height"]) == (1344, 768)
|
| 2311 |
assert "SamplerCustomAdvanced" in nodes_by_type
|
tests/test_multitrack_info_output.py
CHANGED
|
@@ -1369,9 +1369,7 @@ def test_multitrack_editor_prompt_override_preserves_explicit_task_type():
|
|
| 1369 |
|
| 1370 |
assert task_content["task_type"] == "t2v"
|
| 1371 |
assert task_content["task_mode"] == "default"
|
| 1372 |
-
|
| 1373 |
-
# normalize T2V to the exact same value as R2V.
|
| 1374 |
-
assert task_result.values[2] == "r2v"
|
| 1375 |
|
| 1376 |
|
| 1377 |
def test_multitrack_editor_prompt_override_outputs_custom_task_type_string():
|
|
|
|
| 1369 |
|
| 1370 |
assert task_content["task_type"] == "t2v"
|
| 1371 |
assert task_content["task_mode"] == "default"
|
| 1372 |
+
assert task_result.values[2] == "t2v"
|
|
|
|
|
|
|
| 1373 |
|
| 1374 |
|
| 1375 |
def test_multitrack_editor_prompt_override_outputs_custom_task_type_string():
|
utils/h3_project.py
CHANGED
|
@@ -400,19 +400,6 @@ def h3_second_pass_dimensions(
|
|
| 400 |
)
|
| 401 |
|
| 402 |
|
| 403 |
-
# The shipped Moxie model set is reference-conditioned (r2v): a T2V selection
|
| 404 |
-
# must drive the exact same value as R2V so the model is never conditioned as
|
| 405 |
-
# a plain text-to-video task.
|
| 406 |
-
_T2V_EQUIVALENT_TASK_TYPE = "r2v"
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
def _normalize_task_type(task_type: str) -> str:
|
| 410 |
-
normalized = task_type.strip().lower()
|
| 411 |
-
if normalized == "t2v":
|
| 412 |
-
return _T2V_EQUIVALENT_TASK_TYPE
|
| 413 |
-
return normalized
|
| 414 |
-
|
| 415 |
-
|
| 416 |
def h3_task_type(entry: dict[str, Any], info: dict[str, Any]) -> str:
|
| 417 |
task = entry.get("task", {})
|
| 418 |
content = task.get("content", {}) if isinstance(task, dict) else {}
|
|
@@ -420,7 +407,7 @@ def h3_task_type(entry: dict[str, Any], info: dict[str, Any]) -> str:
|
|
| 420 |
content = {}
|
| 421 |
explicit_type = content.get("task_type")
|
| 422 |
if isinstance(explicit_type, str) and explicit_type.strip():
|
| 423 |
-
return
|
| 424 |
|
| 425 |
start_frame = _frame_value(entry.get("start_frame"))
|
| 426 |
end_frame = _frame_value(entry.get("end_frame"))
|
|
@@ -452,7 +439,7 @@ def h3_task_type(entry: dict[str, Any], info: dict[str, Any]) -> str:
|
|
| 452 |
return "rv2v" if has_video else "r2v"
|
| 453 |
if mode == "edit":
|
| 454 |
return "vi2v" if image_count > 0 else "v2v"
|
| 455 |
-
return "i2v" if image_count > 0 else
|
| 456 |
|
| 457 |
|
| 458 |
def _h3_locked_track(
|
|
@@ -514,11 +501,7 @@ def h3_generation_mode(task_type: str) -> str:
|
|
| 514 |
return "reference"
|
| 515 |
if normalized == "l2v":
|
| 516 |
return "last_frame"
|
| 517 |
-
if normalized
|
| 518 |
-
# Belt and braces: T2V must behave exactly like R2V even if a raw
|
| 519 |
-
# t2v value bypasses h3_task_type.
|
| 520 |
-
return "reference"
|
| 521 |
-
if normalized == "i2v":
|
| 522 |
return "multi_frames"
|
| 523 |
raise ValueError(f"Unsupported H3 task type: {task_type}")
|
| 524 |
|
|
|
|
| 400 |
)
|
| 401 |
|
| 402 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
def h3_task_type(entry: dict[str, Any], info: dict[str, Any]) -> str:
|
| 404 |
task = entry.get("task", {})
|
| 405 |
content = task.get("content", {}) if isinstance(task, dict) else {}
|
|
|
|
| 407 |
content = {}
|
| 408 |
explicit_type = content.get("task_type")
|
| 409 |
if isinstance(explicit_type, str) and explicit_type.strip():
|
| 410 |
+
return explicit_type.strip().lower()
|
| 411 |
|
| 412 |
start_frame = _frame_value(entry.get("start_frame"))
|
| 413 |
end_frame = _frame_value(entry.get("end_frame"))
|
|
|
|
| 439 |
return "rv2v" if has_video else "r2v"
|
| 440 |
if mode == "edit":
|
| 441 |
return "vi2v" if image_count > 0 else "v2v"
|
| 442 |
+
return "i2v" if image_count > 0 else "t2v"
|
| 443 |
|
| 444 |
|
| 445 |
def _h3_locked_track(
|
|
|
|
| 501 |
return "reference"
|
| 502 |
if normalized == "l2v":
|
| 503 |
return "last_frame"
|
| 504 |
+
if normalized in {"t2v", "i2v"}:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 505 |
return "multi_frames"
|
| 506 |
raise ValueError(f"Unsupported H3 task type: {task_type}")
|
| 507 |
|
utils/llm_api.py
CHANGED
|
@@ -925,11 +925,7 @@ class PromptEnhancerClient:
|
|
| 925 |
return "i2va", selected_images, [], []
|
| 926 |
if normalized_type in {"v2v", "r2v", "vi2v", "rv2v"}:
|
| 927 |
if not (images or videos or audios):
|
| 928 |
-
|
| 929 |
-
# model handles text-only renders in reference conditioning,
|
| 930 |
-
# but the cloud API has a native text-only mode - use it
|
| 931 |
-
# instead of failing (T2V selections resolve to r2v).
|
| 932 |
-
return "t2va", [], [], []
|
| 933 |
if len(images) > 9:
|
| 934 |
raise ValueError("MiniMax r2va supports at most 9 reference images.")
|
| 935 |
if len(videos) > 3:
|
|
|
|
| 925 |
return "i2va", selected_images, [], []
|
| 926 |
if normalized_type in {"v2v", "r2v", "vi2v", "rv2v"}:
|
| 927 |
if not (images or videos or audios):
|
| 928 |
+
raise ValueError(f"MiniMax {normalized_type} requires reference media.")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 929 |
if len(images) > 9:
|
| 930 |
raise ValueError("MiniMax r2va supports at most 9 reference images.")
|
| 931 |
if len(videos) > 3:
|
web/js/editor-loader.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Editor bundle loader.
|
| 2 |
+
//
|
| 3 |
+
// WHY THIS FILE EXISTS
|
| 4 |
+
// ComfyUI core (nodes.py, load_custom_node) lets a pack's WEB_DIRECTORY
|
| 5 |
+
// overwrite its EXTENSION_WEB_DIRS entry after the pack's __init__.py has
|
| 6 |
+
// run. This pack ships WEB_DIRECTORY = "./web" (the helper files next to
|
| 7 |
+
// this loader), so core's static mount and the browser's /extensions listing
|
| 8 |
+
// only ever see THIS directory - never dist/release. The React editor entry
|
| 9 |
+
// (dist/release/index.js) would therefore never be imported on a fresh
|
| 10 |
+
// browser, and the editor only appeared for people whose browser still held
|
| 11 |
+
// an old cached copy.
|
| 12 |
+
//
|
| 13 |
+
// This loader bridges that gap: the frontend imports every listed extension
|
| 14 |
+
// file (this one included), and this file then imports the real editor entry
|
| 15 |
+
// from the pack's own static mount "/<pack>/index.js", which __init__.py
|
| 16 |
+
// serves with "Cache-Control: no-cache, must-revalidate". The entry file is
|
| 17 |
+
// therefore always revalidated, and its relative chunk imports
|
| 18 |
+
// ("./chunks/...") resolve against the same mount, which serves the
|
| 19 |
+
// content-hashed chunk files that ship next to it. No cache can pin a stale
|
| 20 |
+
// editor bundle anymore.
|
| 21 |
+
//
|
| 22 |
+
// The pack folder name is derived from this file's own URL
|
| 23 |
+
// (.../extensions/<pack>/js/editor-loader.js), so the loader works no matter
|
| 24 |
+
// what the pack directory is called.
|
| 25 |
+
|
| 26 |
+
const segments = new URL(import.meta.url).pathname
|
| 27 |
+
.split('/')
|
| 28 |
+
.filter(Boolean)
|
| 29 |
+
.map(decodeURIComponent);
|
| 30 |
+
|
| 31 |
+
const extensionsIndex = segments.lastIndexOf('extensions');
|
| 32 |
+
const packName = extensionsIndex >= 0 ? segments[extensionsIndex + 1] : null;
|
| 33 |
+
|
| 34 |
+
if (!packName) {
|
| 35 |
+
console.warn(
|
| 36 |
+
'[Moxie Multimedia Suite] editor loader could not resolve the pack folder from',
|
| 37 |
+
import.meta.url,
|
| 38 |
+
);
|
| 39 |
+
} else {
|
| 40 |
+
// Base prefix covers deployments behind a sub-path reverse proxy
|
| 41 |
+
// ("/comfyui/extensions/<pack>/..." -> "/comfyui/"); the pack's own
|
| 42 |
+
// static mount sits at "<base><pack>/".
|
| 43 |
+
const base = '/' + segments.slice(0, extensionsIndex).join('/') + '/';
|
| 44 |
+
// Top-level await: extension scripts are awaited before ComfyUI registers
|
| 45 |
+
// node definitions, so the editor's registerExtension()/custom-widget
|
| 46 |
+
// hooks stay in the normal loading order.
|
| 47 |
+
await import(`${base}${packName}/index.js`);
|
| 48 |
+
}
|