mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-13 10:42:59 +08:00
Compare commits
6 Commits
00952cd893
...
5dcf6d1341
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5dcf6d1341 | ||
|
|
49a8e2050d | ||
|
|
25757a53c9 | ||
|
|
1b25f1289e | ||
|
|
e35348aa53 | ||
|
|
cd8c7a2306 |
2
.github/workflows/stable-release.yml
vendored
2
.github/workflows/stable-release.yml
vendored
@ -145,6 +145,8 @@ jobs:
|
|||||||
cp -r ComfyUI/.ci/windows_${{ inputs.rel_name }}_base_files/* ./
|
cp -r ComfyUI/.ci/windows_${{ inputs.rel_name }}_base_files/* ./
|
||||||
cp ../update_comfyui_and_python_dependencies.bat ./update/
|
cp ../update_comfyui_and_python_dependencies.bat ./update/
|
||||||
|
|
||||||
|
echo 'local-portable' > ComfyUI/.comfy_environment
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
"C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=9 -mfb=128 -md=768m -ms=on -mf=BCJ2 ComfyUI_windows_portable.7z ComfyUI_windows_portable
|
"C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=9 -mfb=128 -md=768m -ms=on -mf=BCJ2 ComfyUI_windows_portable.7z ComfyUI_windows_portable
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import uuid
|
|||||||
from typing import Callable, Optional
|
from typing import Callable, Optional
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
import tqdm
|
||||||
|
|
||||||
import comfy.float
|
import comfy.float
|
||||||
import comfy.hooks
|
import comfy.hooks
|
||||||
@ -1651,7 +1652,11 @@ class ModelPatcherDynamic(ModelPatcher):
|
|||||||
self.model.model_loaded_weight_memory += casted_buf.numel() * casted_buf.element_size()
|
self.model.model_loaded_weight_memory += casted_buf.numel() * casted_buf.element_size()
|
||||||
|
|
||||||
force_load_stat = f" Force pre-loaded {len(self.backup)} weights: {self.model.model_loaded_weight_memory // 1024} KB." if len(self.backup) > 0 else ""
|
force_load_stat = f" Force pre-loaded {len(self.backup)} weights: {self.model.model_loaded_weight_memory // 1024} KB." if len(self.backup) > 0 else ""
|
||||||
logging.info(f"Model {self.model.__class__.__name__} prepared for dynamic VRAM loading. {allocated_size // (1024 ** 2)}MB Staged. {num_patches} patches attached.{force_load_stat}")
|
log_key = (self.patches_uuid, allocated_size, num_patches, len(self.backup), self.model.model_loaded_weight_memory)
|
||||||
|
in_loop = bool(getattr(tqdm.tqdm, "_instances", None))
|
||||||
|
level = logging.DEBUG if in_loop and getattr(self, "_last_prepare_log_key", None) == log_key else logging.INFO
|
||||||
|
self._last_prepare_log_key = log_key
|
||||||
|
logging.log(level, f"Model {self.model.__class__.__name__} prepared for dynamic VRAM loading. {allocated_size // (1024 ** 2)}MB Staged. {num_patches} patches attached.{force_load_stat}")
|
||||||
|
|
||||||
self.model.device = device_to
|
self.model.device = device_to
|
||||||
self.model.current_weight_patches_uuid = self.patches_uuid
|
self.model.current_weight_patches_uuid = self.patches_uuid
|
||||||
|
|||||||
@ -54,7 +54,12 @@ class GrokImageNode(IO.ComfyNode):
|
|||||||
inputs=[
|
inputs=[
|
||||||
IO.Combo.Input(
|
IO.Combo.Input(
|
||||||
"model",
|
"model",
|
||||||
options=["grok-imagine-image-pro", "grok-imagine-image", "grok-imagine-image-beta"],
|
options=[
|
||||||
|
"grok-imagine-image-quality",
|
||||||
|
"grok-imagine-image-pro",
|
||||||
|
"grok-imagine-image",
|
||||||
|
"grok-imagine-image-beta",
|
||||||
|
],
|
||||||
),
|
),
|
||||||
IO.String.Input(
|
IO.String.Input(
|
||||||
"prompt",
|
"prompt",
|
||||||
@ -111,10 +116,12 @@ class GrokImageNode(IO.ComfyNode):
|
|||||||
],
|
],
|
||||||
is_api_node=True,
|
is_api_node=True,
|
||||||
price_badge=IO.PriceBadge(
|
price_badge=IO.PriceBadge(
|
||||||
depends_on=IO.PriceBadgeDepends(widgets=["model", "number_of_images"]),
|
depends_on=IO.PriceBadgeDepends(widgets=["model", "number_of_images", "resolution"]),
|
||||||
expr="""
|
expr="""
|
||||||
(
|
(
|
||||||
$rate := $contains(widgets.model, "pro") ? 0.07 : 0.02;
|
$rate := widgets.model = "grok-imagine-image-quality"
|
||||||
|
? (widgets.resolution = "1k" ? 0.05 : 0.07)
|
||||||
|
: ($contains(widgets.model, "pro") ? 0.07 : 0.02);
|
||||||
{"type":"usd","usd": $rate * widgets.number_of_images}
|
{"type":"usd","usd": $rate * widgets.number_of_images}
|
||||||
)
|
)
|
||||||
""",
|
""",
|
||||||
@ -167,7 +174,12 @@ class GrokImageEditNode(IO.ComfyNode):
|
|||||||
inputs=[
|
inputs=[
|
||||||
IO.Combo.Input(
|
IO.Combo.Input(
|
||||||
"model",
|
"model",
|
||||||
options=["grok-imagine-image-pro", "grok-imagine-image", "grok-imagine-image-beta"],
|
options=[
|
||||||
|
"grok-imagine-image-quality",
|
||||||
|
"grok-imagine-image-pro",
|
||||||
|
"grok-imagine-image",
|
||||||
|
"grok-imagine-image-beta",
|
||||||
|
],
|
||||||
),
|
),
|
||||||
IO.Image.Input("image", display_name="images"),
|
IO.Image.Input("image", display_name="images"),
|
||||||
IO.String.Input(
|
IO.String.Input(
|
||||||
@ -228,11 +240,19 @@ class GrokImageEditNode(IO.ComfyNode):
|
|||||||
],
|
],
|
||||||
is_api_node=True,
|
is_api_node=True,
|
||||||
price_badge=IO.PriceBadge(
|
price_badge=IO.PriceBadge(
|
||||||
depends_on=IO.PriceBadgeDepends(widgets=["model", "number_of_images"]),
|
depends_on=IO.PriceBadgeDepends(widgets=["model", "number_of_images", "resolution"]),
|
||||||
expr="""
|
expr="""
|
||||||
(
|
(
|
||||||
$rate := $contains(widgets.model, "pro") ? 0.07 : 0.02;
|
$isQualityModel := widgets.model = "grok-imagine-image-quality";
|
||||||
{"type":"usd","usd": 0.002 + $rate * widgets.number_of_images}
|
$isPro := $contains(widgets.model, "pro");
|
||||||
|
$rate := $isQualityModel
|
||||||
|
? (widgets.resolution = "1k" ? 0.05 : 0.07)
|
||||||
|
: ($isPro ? 0.07 : 0.02);
|
||||||
|
$base := $isQualityModel ? 0.01 : 0.002;
|
||||||
|
$output := $rate * widgets.number_of_images;
|
||||||
|
$isPro
|
||||||
|
? {"type":"usd","usd": $base + $output}
|
||||||
|
: {"type":"range_usd","min_usd": $base + $output, "max_usd": 3 * $base + $output}
|
||||||
)
|
)
|
||||||
""",
|
""",
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
comfyui-frontend-package==1.43.17
|
comfyui-frontend-package==1.43.17
|
||||||
comfyui-workflow-templates==0.9.69
|
comfyui-workflow-templates==0.9.72
|
||||||
comfyui-embedded-docs==0.4.4
|
comfyui-embedded-docs==0.4.4
|
||||||
torch
|
torch
|
||||||
torchsde
|
torchsde
|
||||||
|
|||||||
@ -108,3 +108,46 @@ def test_set_preview_invalid_preview_id(
|
|||||||
body = r.json()
|
body = r.json()
|
||||||
assert r.status_code == 404
|
assert r.status_code == 404
|
||||||
assert body["error"]["code"] == "ASSET_NOT_FOUND"
|
assert body["error"]["code"] == "ASSET_NOT_FOUND"
|
||||||
|
|
||||||
|
|
||||||
|
def test_clear_preview_idempotent_when_no_preview_set(
|
||||||
|
http: requests.Session, api_base: str, asset_factory, make_asset_bytes
|
||||||
|
):
|
||||||
|
"""DELETE /api/assets/{id}/preview returns 204 even if no preview was previously set."""
|
||||||
|
main_data = make_asset_bytes("main_idem_clear.png", 2048)
|
||||||
|
main = asset_factory("main_idem_clear.png", ["input", "unit-tests"], {}, main_data)
|
||||||
|
|
||||||
|
# Asset has no preview at this point — DELETE should still succeed.
|
||||||
|
r_first = http.delete(f"{api_base}/api/assets/{main['id']}/preview", timeout=120)
|
||||||
|
assert r_first.status_code == 204, r_first.text
|
||||||
|
|
||||||
|
# And a second DELETE on the same asset should also be a 204 no-op.
|
||||||
|
r_second = http.delete(f"{api_base}/api/assets/{main['id']}/preview", timeout=120)
|
||||||
|
assert r_second.status_code == 204, r_second.text
|
||||||
|
|
||||||
|
|
||||||
|
def test_set_preview_idempotent_with_same_id(
|
||||||
|
http: requests.Session, api_base: str, asset_factory, make_asset_bytes
|
||||||
|
):
|
||||||
|
"""PUT /api/assets/{id}/preview with the same preview_id twice is a 200 no-op."""
|
||||||
|
main_data = make_asset_bytes("main_idem_set.png", 2048)
|
||||||
|
preview_data = make_asset_bytes("prev_idem_set.png", 1024)
|
||||||
|
|
||||||
|
main = asset_factory("main_idem_set.png", ["input", "unit-tests"], {}, main_data)
|
||||||
|
preview = asset_factory("prev_idem_set.png", ["input", "unit-tests"], {}, preview_data)
|
||||||
|
|
||||||
|
r_first = http.put(
|
||||||
|
f"{api_base}/api/assets/{main['id']}/preview",
|
||||||
|
json={"preview_id": preview["id"]},
|
||||||
|
timeout=120,
|
||||||
|
)
|
||||||
|
assert r_first.status_code == 200, r_first.text
|
||||||
|
assert r_first.json()["preview_id"] == preview["id"]
|
||||||
|
|
||||||
|
r_second = http.put(
|
||||||
|
f"{api_base}/api/assets/{main['id']}/preview",
|
||||||
|
json={"preview_id": preview["id"]},
|
||||||
|
timeout=120,
|
||||||
|
)
|
||||||
|
assert r_second.status_code == 200, r_second.text
|
||||||
|
assert r_second.json()["preview_id"] == preview["id"]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user