Author SHA1 Message Date
brantje af680e8696 Remove repository cloning code from install.py and update README.md to include notes on required repositories. 2025-04-30 06:50:55 +00:00
Sander f680891251 Update pyproject.toml 2025-04-24 14:58:39 +02:00
Sander b63fb8746a Update pyproject.toml 2025-04-24 14:56:47 +02:00
Sander e118268866 Update README.md 2025-04-24 14:56:05 +02:00
Sander 360c073bd1 Create main.yml 2025-04-24 14:49:55 +02:00
Sander 4b608ba8d8 Update pyproject.toml 2025-04-24 14:49:11 +02:00
6 changed files with 109 additions and 93 deletions
+20
View File
@@ -0,0 +1,20 @@
name: Publish to Comfy registry
on:
workflow_dispatch:
push:
branches:
- main
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:
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }} ## Add your own personal access token to your Github Repository secrets and reference it here.
+13
View File
@@ -4,6 +4,19 @@
<a href="https://huggingface.co/spaces/AI4Editing/MagicQuill"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)"></a>
<a href="https://creativecommons.org/licenses/by-sa/4.0/"><img src="https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg"></a>
# Fixed
- [x] SD1.5
Todo
- [ ] SDXL
- [ ] FLUX
Note:
[Brushnet](https://github.com/nullquant/ComfyUI-BrushNet) and [ComfyUI ControlNet Aux](https://github.com/Fannovel16/comfyui_controlnet_aux) are required.
https://github.com/user-attachments/assets/8ee9663a-fef2-484a-a0b7-8427ab590424
There is an HD video on [Youtube](https://www.youtube.com/watch?v=5DiKfONMnE4).
+4 -49
View File
@@ -1,55 +1,10 @@
import os
import subprocess
from huggingface_hub import snapshot_download, hf_hub_download
from huggingface_hub import snapshot_download
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
models_dir = os.path.abspath(os.path.join(parent_dir, '..', "models"))
print(models_dir)
hugging_face_repos = [
{
'repo_id': 'LiuZichen/MagicQuill-models',
'local_dir': models_dir
},
# SDXL
{
'repo_id': 'xinsir/controlnet-scribble-sdxl-1.0',
'local_dir': os.path.join(models_dir, 'controlnet', 'SDXL'),
'filename': 'diffusion_pytorch_model.safetensors',
'target_filename': 'sdxl-controlnet-scribble-1.0.safetensors'
},
{
'repo_id': 'briaai/BRIA-2.3-ControlNet-ColorGrid',
'local_dir': os.path.join(models_dir, 'controlnet', 'SDXL'),
'filename': 'bria_23_controlnet_colorgrid.safetensors',
'target_filename': 'bria_23_controlnet_colorgrid.safetensors'
},
{
'repo_id': 'fullnonstop/random_mask_brushnet_ckpt_sdxl_v0',
'local_dir': os.path.join(models_dir, 'inpaint', 'SDXL'),
'filename': 'random_mask_brushnet_ckpt_sdxl_v0.safetensors',
'target_filename': 'random_mask_brushnet_ckpt_sdxl_v0.safetensors'
}
]
for repo in hugging_face_repos:
if 'filename' in repo:
filename = hf_hub_download(repo_id=repo['repo_id'], local_dir=repo['local_dir'], filename=repo['filename'])
current_path = os.path.join(repo['local_dir'], filename)
target_path = os.path.join(repo['local_dir'], repo['target_filename'])
if os.path.exists(current_path):
if current_path != target_path:
os.rename(current_path, target_path)
else:
snapshot_download(repo_id=repo['repo_id'], local_dir=repo['local_dir'])
repos = {
'ComfyUI_BrushNet': 'https://github.com/nullquant/ComfyUI-BrushNet',
'comfyui_controlnet_aux': 'https://github.com/Fannovel16/comfyui_controlnet_aux'
}
for name, url in repos.items():
target_dir = os.path.join(parent_dir, name)
if not os.path.exists(target_dir):
subprocess.run(['git', 'clone', url, target_dir], check=True)
# Download the model from the Hugging Face Hub
repo_id = "LiuZichen/MagicQuill-models" # or any other model/dataset ID
snapshot_download(repo_id=repo_id, local_dir=models_dir)
+1 -9
View File
@@ -284,14 +284,6 @@ async def run_magic_quill(request):
sampler_name = post.get("sampler_name", "euler_ancestral")
scheduler = post.get("scheduler", "exponential")
if "SDXL" in checkpoint_name:
base_model_version = "SDXL"
elif "SD1.5" in checkpoint_name:
base_model_version = "SD1.5"
else:
raise ValueError(f"Could not determine base model version from checkpoint name: {checkpoint_name} use base_model_version parameter")
print(f"Using files - Main: {main_image_filename}, Original: {original_image_file}, Add Color: {add_color_image_file}, Add Edge: {add_edge_image_file}, Remove Edge: {remove_edge_image_file}")
# Call painter_execute with file paths instead of tensors
@@ -388,7 +380,7 @@ class MagicQuill(object):
"clip": ("CLIP",),
"vae": ("VAE",),
"base_model_version": (['SD1.5', 'SDXL'], {"default": "SD1.5"}),
"base_model_version": (['SD1.5'], {"default": "SD1.5"}),
"positive_prompt": ("STRING", {"default": ""}),
"negative_prompt": ("STRING", {"default": ""}),
"dtype": (['float16', 'bfloat16', 'float32', 'float64'], {"default": "float16"}),
+71 -29
View File
@@ -1,35 +1,77 @@
[tool.poetry]
name = "ComfyUI-MagicQuill"
version = "1.0.0"
description = "Fixed version of the original MagicQuill node."
authors = ["brantje <brantje@gmail.com>"]
license = { text = "MIT License" }
readme = "README.md"
[tool.poetry.dependencies]
pynvml = "^11.4.0"
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[project]
name = "llava"
version = "1.2.2.post1"
description = "Towards GPT-4 like large language and visual assistant."
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
]
dependencies = [
"transformers==4.37.2", "tokenizers==0.15.1", "sentencepiece==0.2.0", "shortuuid",
"accelerate==0.33.0", "peft", "bitsandbytes",
"pydantic", "markdown2[all]", "numpy", "scikit-learn==1.2.2",
"gradio==5.4.0", "gradio_client==1.4.2", "requests", "httpx==0.24.1", "uvicorn", "fastapi",
"einops==0.6.1", "einops-exts==0.0.4", "timm==0.6.13",
]
[project.optional-dependencies]
train = ["deepspeed==0.12.6", "ninja", "wandb"]
build = ["build", "twine"]
name = "comfyui_magicquill_fixed" # Unique identifier for your node. Immutable after creation..
description = "Fixed version of the original MagicQuill node. Required nodes: ComfyUI-Brushnet and ComfyUI Controlnet AUX"
version = "1.0.0" # Custom Node version. Must be semantically versioned.
dependencies = [
'opencv-python',
'diffusers',
'torchsde',
'protobuf',
'transformers',
'tokenizers',
'sentencepiece',
'shortuuid',
'accelerate',
'peft',
'bitsandbytes',
'pydantic',
'markdown2',
'scikit-learn',
'requests',
'httpx',
'uvicorn',
'fastapi',
'einops',
'einops-exts',
'timm',
'webcolors',
'torch',
'importlib_metadata',
'huggingface_hub',
'scipy',
'opencv-python',
'filelock',
'numpy',
'Pillow',
'einops',
'torchvision',
'pyyaml',
'scikit-image',
'python-dateutil',
'mediapipe',
'svglib',
'fvcore',
'yapf',
'omegaconf',
'ftfy',
'addict',
'yacs',
'trimesh[easy]',
'albumentations',
'scikit-learn',
'matplotlib'
] # Filled in from requirements.txt
[project.urls]
"Homepage" = "https://llava-vl.github.io"
"Bug Tracker" = "https://github.com/haotian-liu/LLaVA/issues"
Repository = "https://github.com/brantje/ComfyUI_MagicQuill"
[tool.setuptools.packages.find]
exclude = ["assets*", "benchmark*", "docs", "dist*", "playground*", "scripts*", "tests*"]
[tool.wheel]
exclude = ["assets*", "benchmark*", "docs", "dist*", "playground*", "scripts*", "tests*"]
[tool.comfy]
PublisherId = "brantje"
DisplayName = "ComfyUI MagicQuill (fixed)"
-6
View File
@@ -40,14 +40,8 @@ class ScribbleColorEditModel():
edge_controlnet_name = "control_v11p_sd15_scribble.safetensors"
color_controlnet_name = "color_finetune.safetensors"
brushnet_name = os.path.join("brushnet", "random_mask_brushnet_ckpt", "diffusion_pytorch_model.safetensors")
elif base_model_version == "SDXL":
edge_controlnet_name = "SDXL/sdxl-controlnet-scribble-1.0.safetensors"
color_controlnet_name = "SDXL/bria_23_controlnet_colorgrid.safetensors"
brushnet_name = os.path.join("SDXL", "random_mask_brushnet_ckpt_sdxl_v0.safetensors")
else:
raise ValueError("Invalid base_model_version, not supported yet!!!: {}".format(base_model_version))
print(f"Loading edge controlnet: {edge_controlnet_name} color controlnet: {color_controlnet_name} brushnet: {brushnet_name}")
self.edge_controlnet = self.controlnet_loader.load_controlnet(edge_controlnet_name)[0]
self.color_controlnet = self.controlnet_loader.load_controlnet(color_controlnet_name)[0]
self.brushnet_loader.inpaint_files = get_files_with_extension('inpaint')