From d45ebb63f6f20b5951645a1a87b250a832a66a77 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sat, 4 Jan 2025 07:20:54 -0500 Subject: [PATCH 1/6] Remove old unused function. --- comfy/model_management.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/comfy/model_management.py b/comfy/model_management.py index 15800a8e..f6dfc18b 100644 --- a/comfy/model_management.py +++ b/comfy/model_management.py @@ -1128,10 +1128,6 @@ def unload_all_models(): free_memory(1e30, get_torch_device()) -def resolve_lowvram_weight(weight, model, key): #TODO: remove - logging.warning("The comfy.model_management.resolve_lowvram_weight function will be removed soon, please stop using it.") - return weight - #TODO: might be cleaner to put this somewhere else import threading From 5cbf79787fe56fdd78476fdbc8ed03231be30c50 Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 5 Jan 2025 01:46:11 -0500 Subject: [PATCH 2/6] Add advanced device option to clip loader nodes. Right click the "Load CLIP" or DualCLIPLoader node and "Show Advanced". --- nodes.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/nodes.py b/nodes.py index 7f9f5aa5..82b1575b 100644 --- a/nodes.py +++ b/nodes.py @@ -913,6 +913,7 @@ class CLIPLoader: def INPUT_TYPES(s): return {"required": { "clip_name": (folder_paths.get_filename_list("text_encoders"), ), "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart"], ), + "device": (["default", "cpu"], {"advanced": True}), }} RETURN_TYPES = ("CLIP",) FUNCTION = "load_clip" @@ -921,7 +922,7 @@ class CLIPLoader: DESCRIPTION = "[Recipes]\n\nstable_diffusion: clip-l\nstable_cascade: clip-g\nsd3: t5 / clip-g / clip-l\nstable_audio: t5\nmochi: t5" - def load_clip(self, clip_name, type="stable_diffusion"): + def load_clip(self, clip_name, type="stable_diffusion", device="default"): if type == "stable_cascade": clip_type = comfy.sd.CLIPType.STABLE_CASCADE elif type == "sd3": @@ -937,8 +938,12 @@ class CLIPLoader: else: clip_type = comfy.sd.CLIPType.STABLE_DIFFUSION + model_options = {} + if device == "cpu": + model_options["load_device"] = model_options["offload_device"] = torch.device("cpu") + clip_path = folder_paths.get_full_path_or_raise("text_encoders", clip_name) - clip = comfy.sd.load_clip(ckpt_paths=[clip_path], embedding_directory=folder_paths.get_folder_paths("embeddings"), clip_type=clip_type) + clip = comfy.sd.load_clip(ckpt_paths=[clip_path], embedding_directory=folder_paths.get_folder_paths("embeddings"), clip_type=clip_type, model_options=model_options) return (clip,) class DualCLIPLoader: @@ -947,6 +952,7 @@ class DualCLIPLoader: return {"required": { "clip_name1": (folder_paths.get_filename_list("text_encoders"), ), "clip_name2": (folder_paths.get_filename_list("text_encoders"), ), "type": (["sdxl", "sd3", "flux", "hunyuan_video"], ), + "device": (["default", "cpu"], {"advanced": True}), }} RETURN_TYPES = ("CLIP",) FUNCTION = "load_clip" @@ -955,7 +961,7 @@ class DualCLIPLoader: DESCRIPTION = "[Recipes]\n\nsdxl: clip-l, clip-g\nsd3: clip-l, clip-g / clip-l, t5 / clip-g, t5\nflux: clip-l, t5" - def load_clip(self, clip_name1, clip_name2, type): + def load_clip(self, clip_name1, clip_name2, type, device="default"): clip_path1 = folder_paths.get_full_path_or_raise("text_encoders", clip_name1) clip_path2 = folder_paths.get_full_path_or_raise("text_encoders", clip_name2) if type == "sdxl": @@ -967,7 +973,11 @@ class DualCLIPLoader: elif type == "hunyuan_video": clip_type = comfy.sd.CLIPType.HUNYUAN_VIDEO - clip = comfy.sd.load_clip(ckpt_paths=[clip_path1, clip_path2], embedding_directory=folder_paths.get_folder_paths("embeddings"), clip_type=clip_type) + model_options = {} + if device == "cpu": + model_options["load_device"] = model_options["offload_device"] = torch.device("cpu") + + clip = comfy.sd.load_clip(ckpt_paths=[clip_path1, clip_path2], embedding_directory=folder_paths.get_folder_paths("embeddings"), clip_type=clip_type, model_options=model_options) return (clip,) class CLIPVisionLoader: From c8a3492c22ad5ff711e24db3a03756fec022afde Mon Sep 17 00:00:00 2001 From: comfyanonymous Date: Sun, 5 Jan 2025 04:29:36 -0500 Subject: [PATCH 3/6] Make the device an optional parameter in the clip loaders. --- nodes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nodes.py b/nodes.py index 82b1575b..1b796ced 100644 --- a/nodes.py +++ b/nodes.py @@ -913,6 +913,8 @@ class CLIPLoader: def INPUT_TYPES(s): return {"required": { "clip_name": (folder_paths.get_filename_list("text_encoders"), ), "type": (["stable_diffusion", "stable_cascade", "sd3", "stable_audio", "mochi", "ltxv", "pixart"], ), + }, + "optional": { "device": (["default", "cpu"], {"advanced": True}), }} RETURN_TYPES = ("CLIP",) @@ -952,6 +954,8 @@ class DualCLIPLoader: return {"required": { "clip_name1": (folder_paths.get_filename_list("text_encoders"), ), "clip_name2": (folder_paths.get_filename_list("text_encoders"), ), "type": (["sdxl", "sd3", "flux", "hunyuan_video"], ), + }, + "optional": { "device": (["default", "cpu"], {"advanced": True}), }} RETURN_TYPES = ("CLIP",) From b65b83af6f5b0aef55f27160d5c1b86400cc79b5 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Sun, 5 Jan 2025 04:32:11 -0500 Subject: [PATCH 4/6] Add update-frontend github action (#6336) * Add update-frontend github action * Update secrets * nit --- .github/workflows/update-frontend.yml | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/update-frontend.yml diff --git a/.github/workflows/update-frontend.yml b/.github/workflows/update-frontend.yml new file mode 100644 index 00000000..0c577478 --- /dev/null +++ b/.github/workflows/update-frontend.yml @@ -0,0 +1,58 @@ +name: Update Frontend Release + +on: + workflow_dispatch: + inputs: + version: + description: "Frontend version to update to (e.g., 1.0.0)" + required: true + type: string + +jobs: + update-frontend: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout ComfyUI + uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install requirements + run: | + python -m pip install --upgrade pip + pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu + pip install -r requirements.txt + pip install wait-for-it + # Frontend asset will be downloaded to ComfyUI/web_custom_versions/Comfy-Org_ComfyUI_frontend/{version} + - name: Start ComfyUI server + run: | + python main.py --cpu --front-end-version Comfy-Org/ComfyUI_frontend@${{ github.event.inputs.version }} 2>&1 | tee console_output.log & + wait-for-it --service 127.0.0.1:8188 -t 30 + - name: Configure Git + run: | + git config --global user.name "GitHub Action" + git config --global user.email "action@github.com" + # Replace existing frontend content with the new version and remove .js.map files + # See https://github.com/Comfy-Org/ComfyUI_frontend/issues/2145 for why we remove .js.map files + - name: Update frontend content + run: | + rm -rf web/ + cp -r web_custom_versions/Comfy-Org_ComfyUI_frontend/${{ github.event.inputs.version }} web/ + rm web/**/*.js.map + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.PR_BOT_PAT }} + commit-message: "Update frontend to v${{ github.event.inputs.version }}" + title: "Frontend Update: v${{ github.event.inputs.version }}" + body: | + Automated PR to update frontend content to version ${{ github.event.inputs.version }} + + This PR was created automatically by the frontend update workflow. + branch: release-${{ github.event.inputs.version }} + base: master + labels: Frontend,dependencies From 7da85fac3fab3d303558643e30500496f420bd41 Mon Sep 17 00:00:00 2001 From: Yoland Yan <4950057+yoland68@users.noreply.github.com> Date: Sun, 5 Jan 2025 01:33:49 -0800 Subject: [PATCH 5/6] Update CODEOWNERS (#6338) Adding yoland and robin to web dir --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 07ac5ab8..814d1ecd 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -17,7 +17,7 @@ /app/ @yoland68 @robinjhuang @huchenlei @webfiltered @pythongosssss @ltdrdata # Frontend assets -/web/ @huchenlei @webfiltered @pythongosssss +/web/ @huchenlei @webfiltered @pythongosssss @yoland68 @robinjhuang # Extra nodes /comfy_extras/ @yoland68 @robinjhuang @huchenlei @pythongosssss @ltdrdata @Kosinkadink From 6620d86318d19562a4410eabc78c27538d54e445 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Sun, 5 Jan 2025 15:26:22 -0600 Subject: [PATCH 6/6] In inner_sample, change "sigmas" to "sampler_sigmas" in transformer_options to not conflict with the "sigmas" that will overwrite "sigmas" in _calc_cond_batch --- comfy/hooks.py | 2 +- comfy/samplers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/hooks.py b/comfy/hooks.py index 79a7090b..3cb0f396 100644 --- a/comfy/hooks.py +++ b/comfy/hooks.py @@ -442,7 +442,7 @@ class HookKeyframeGroup: return False if curr_t == self._curr_t: return False - max_sigma = torch.max(transformer_options["sigmas"]) + max_sigma = torch.max(transformer_options["sample_sigmas"]) prev_index = self._current_index prev_strength = self._current_strength # if met guaranteed steps, look for next keyframe in case need to switch diff --git a/comfy/samplers.py b/comfy/samplers.py index 89464a42..af2b8e11 100644 --- a/comfy/samplers.py +++ b/comfy/samplers.py @@ -849,7 +849,7 @@ class CFGGuider: self.conds = process_conds(self.inner_model, noise, self.conds, device, latent_image, denoise_mask, seed) extra_model_options = comfy.model_patcher.create_model_options_clone(self.model_options) - extra_model_options.setdefault("transformer_options", {})["sigmas"] = sigmas + extra_model_options.setdefault("transformer_options", {})["sample_sigmas"] = sigmas extra_args = {"model_options": extra_model_options, "seed": seed} executor = comfy.patcher_extension.WrapperExecutor.new_class_executor(