From b038659889e8907d856e6c647575bd78101a59f1 Mon Sep 17 00:00:00 2001 From: Clybius Date: Mon, 16 Jun 2025 16:06:40 -0500 Subject: [PATCH] chore: Add github workflow & Remove comment & Change defaults --- .github/workflows/publish.yml | 22 ++++++++++++++++++++++ chroma_NAG.py | 8 ++++---- 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a4fd892 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,22 @@ +name: Publish to Comfy registry +on: + workflow_dispatch: + push: + branches: + - main + - master + paths: + - "pyproject.toml" + +jobs: + publish-node: + name: Publish Custom Node to registry + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Publish Custom Node + uses: Comfy-Org/publish-node-action@main + with: + ## Add your own personal access token to your Github Repository secrets and reference it here. + personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }} diff --git a/chroma_NAG.py b/chroma_NAG.py index d541e7c..4e7b52e 100644 --- a/chroma_NAG.py +++ b/chroma_NAG.py @@ -186,8 +186,8 @@ class ChromaNAG: return { "required": { "model": ("MODEL",), - "conditioning": ("CONDITIONING",), # Positive conditioning - "nag_scale": ("FLOAT", {"default": 11.0, "min": 0.0, "max": 100.0, "step": 0.01}), + "conditioning": ("CONDITIONING",), + "nag_scale": ("FLOAT", {"default": 5.0, "min": -100.0, "max": 100.0, "step": 0.01}), "nag_alpha": ("FLOAT", {"default": 0.25, "min": 0.0, "max": 1.0, "step": 0.01}), "nag_tau": ("FLOAT", {"default": 2.5, "min": 0.0, "max": 10.0, "step": 0.01}), } @@ -205,7 +205,7 @@ class ChromaNAG: device = mm.get_torch_device() #dtype = mm.unet_dtype() - # The NAG context is derived from the positive prompt's embeddings. + # The NAG context is derived from the negative prompt's embeddings. # For FLUX/Chroma, the conditioning input is already embedded. # Shape: [1, sequence_length, embedding_dim] nag_context = conditioning[0][0].clone() @@ -213,7 +213,7 @@ class ChromaNAG: model_clone = model.clone() diffusion_model = model_clone.get_model_object("diffusion_model") diffusion_model.txt_in.to(device) - txt = diffusion_model.txt_in(nag_context.to(device)) + txt = diffusion_model.txt_in(nag_context.to(device, diffusion_model.txt_in.dtype)) # Chroma models have `double_blocks` where image and text tokens interact. # This is the equivalent of a cross-attention stage in other models.