mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-24 13:20:19 +08:00
Merge branch 'comfyanonymous:master' into master
This commit is contained in:
commit
076bee69a4
53
.github/workflows/test-ci.yml
vendored
53
.github/workflows/test-ci.yml
vendored
@ -20,7 +20,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos, linux, windows]
|
# os: [macos, linux, windows]
|
||||||
|
os: [macos, linux]
|
||||||
python_version: ["3.9", "3.10", "3.11", "3.12"]
|
python_version: ["3.9", "3.10", "3.11", "3.12"]
|
||||||
cuda_version: ["12.1"]
|
cuda_version: ["12.1"]
|
||||||
torch_version: ["stable"]
|
torch_version: ["stable"]
|
||||||
@ -31,9 +32,9 @@ jobs:
|
|||||||
- os: linux
|
- os: linux
|
||||||
runner_label: [self-hosted, Linux]
|
runner_label: [self-hosted, Linux]
|
||||||
flags: ""
|
flags: ""
|
||||||
- os: windows
|
# - os: windows
|
||||||
runner_label: [self-hosted, Windows]
|
# runner_label: [self-hosted, Windows]
|
||||||
flags: ""
|
# flags: ""
|
||||||
runs-on: ${{ matrix.runner_label }}
|
runs-on: ${{ matrix.runner_label }}
|
||||||
steps:
|
steps:
|
||||||
- name: Test Workflows
|
- name: Test Workflows
|
||||||
@ -45,28 +46,28 @@ jobs:
|
|||||||
google_credentials: ${{ secrets.GCS_SERVICE_ACCOUNT_JSON }}
|
google_credentials: ${{ secrets.GCS_SERVICE_ACCOUNT_JSON }}
|
||||||
comfyui_flags: ${{ matrix.flags }}
|
comfyui_flags: ${{ matrix.flags }}
|
||||||
|
|
||||||
test-win-nightly:
|
# test-win-nightly:
|
||||||
strategy:
|
# strategy:
|
||||||
fail-fast: true
|
# fail-fast: true
|
||||||
matrix:
|
# matrix:
|
||||||
os: [windows]
|
# os: [windows]
|
||||||
python_version: ["3.9", "3.10", "3.11", "3.12"]
|
# python_version: ["3.9", "3.10", "3.11", "3.12"]
|
||||||
cuda_version: ["12.1"]
|
# cuda_version: ["12.1"]
|
||||||
torch_version: ["nightly"]
|
# torch_version: ["nightly"]
|
||||||
include:
|
# include:
|
||||||
- os: windows
|
# - os: windows
|
||||||
runner_label: [self-hosted, Windows]
|
# runner_label: [self-hosted, Windows]
|
||||||
flags: ""
|
# flags: ""
|
||||||
runs-on: ${{ matrix.runner_label }}
|
# runs-on: ${{ matrix.runner_label }}
|
||||||
steps:
|
# steps:
|
||||||
- name: Test Workflows
|
# - name: Test Workflows
|
||||||
uses: comfy-org/comfy-action@main
|
# uses: comfy-org/comfy-action@main
|
||||||
with:
|
# with:
|
||||||
os: ${{ matrix.os }}
|
# os: ${{ matrix.os }}
|
||||||
python_version: ${{ matrix.python_version }}
|
# python_version: ${{ matrix.python_version }}
|
||||||
torch_version: ${{ matrix.torch_version }}
|
# torch_version: ${{ matrix.torch_version }}
|
||||||
google_credentials: ${{ secrets.GCS_SERVICE_ACCOUNT_JSON }}
|
# google_credentials: ${{ secrets.GCS_SERVICE_ACCOUNT_JSON }}
|
||||||
comfyui_flags: ${{ matrix.flags }}
|
# comfyui_flags: ${{ matrix.flags }}
|
||||||
|
|
||||||
test-unix-nightly:
|
test-unix-nightly:
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
41
comfy_extras/nodes_mahiro.py
Normal file
41
comfy_extras/nodes_mahiro.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import torch
|
||||||
|
import torch.nn.functional as F
|
||||||
|
|
||||||
|
class Mahiro:
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {"required": {"model": ("MODEL",),
|
||||||
|
}}
|
||||||
|
RETURN_TYPES = ("MODEL",)
|
||||||
|
RETURN_NAMES = ("patched_model",)
|
||||||
|
FUNCTION = "patch"
|
||||||
|
CATEGORY = "_for_testing"
|
||||||
|
DESCRIPTION = "Modify the guidance to scale more on the 'direction' of the positive prompt rather than the difference between the negative prompt."
|
||||||
|
def patch(self, model):
|
||||||
|
m = model.clone()
|
||||||
|
def mahiro_normd(args):
|
||||||
|
scale: float = args['cond_scale']
|
||||||
|
cond_p: torch.Tensor = args['cond_denoised']
|
||||||
|
uncond_p: torch.Tensor = args['uncond_denoised']
|
||||||
|
#naive leap
|
||||||
|
leap = cond_p * scale
|
||||||
|
#sim with uncond leap
|
||||||
|
u_leap = uncond_p * scale
|
||||||
|
cfg = args["denoised"]
|
||||||
|
merge = (leap + cfg) / 2
|
||||||
|
normu = torch.sqrt(u_leap.abs()) * u_leap.sign()
|
||||||
|
normm = torch.sqrt(merge.abs()) * merge.sign()
|
||||||
|
sim = F.cosine_similarity(normu, normm).mean()
|
||||||
|
simsc = 2 * (sim+1)
|
||||||
|
wm = (simsc*cfg + (4-simsc)*leap) / 4
|
||||||
|
return wm
|
||||||
|
m.set_model_sampler_post_cfg_function(mahiro_normd)
|
||||||
|
return (m, )
|
||||||
|
|
||||||
|
NODE_CLASS_MAPPINGS = {
|
||||||
|
"Mahiro": Mahiro
|
||||||
|
}
|
||||||
|
|
||||||
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
|
"Mahiro": "Mahiro is so cute that she deserves a better guidance function!! (。・ω・。)",
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user