Skip to content

Commit

Permalink
The Impact Subpack must now be installed separately.
Browse files Browse the repository at this point in the history
  • Loading branch information
ltdrdata committed Dec 11, 2024
1 parent 455e993 commit 64f7097
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 231 deletions.
17 changes: 4 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

# ComfyUI-Impact-Pack

**Custom nodes pack for ComfyUI**
This custom node helps to conveniently enhance images through Detector, Detailer, Upscaler, Pipe, and more.
**Custom node pack for ComfyUI**
This node pack helps to conveniently enhance images through Detector, Detailer, Upscaler, Pipe, and more.

NOTE: The UltralyticsDetectorProvider node is not part of the ComfyUI-Impact-Pack. To use the UltralyticsDetectorProvider node, please install the ComfyUI-Impact-Subpack separately.

## NOTICE
* V8.0: The `Impact Subpack` is no longer installed automatically. To use `UltralyticsDetectorProvider` nodes, please install the `Impact Subpack` separately.
* V7.6: Automatic installation is no longer supported. Please install using ComfyUI-Manager, or manually install requirements.txt and run install.py to complete the installation.
* V7.0: Supports Switch based on Execution Model Inversion.
* V6.0: Supports FLUX.1 model in Impact KSampler, Detailers, PreviewBridgeLatent
Expand All @@ -33,9 +35,6 @@ This custom node helps to conveniently enhance images through Detector, Detailer
## Custom Nodes
### [Detector nodes](https://github.com/ltdrdata/ComfyUI-extension-tutorials/blob/Main/ComfyUI-Impact-Pack/tutorial/detectors.md)
* `SAMLoader` - Loads the SAM model.
* `UltralyticsDetectorProvider` - Loads the Ultralystics model to provide SEGM_DETECTOR, BBOX_DETECTOR.
- Unlike `MMDetDetectorProvider`, for segm models, `BBOX_DETECTOR` is also provided.
- The various models available in UltralyticsDetectorProvider can be downloaded through **ComfyUI-Manager**.
* `ONNXDetectorProvider` - Loads the ONNX model to provide BBOX_DETECTOR.
* `CLIPSegDetectorProvider` - Wrapper for CLIPSeg to provide BBOX_DETECTOR.
* You need to install the ComfyUI-CLIPSeg node extension.
Expand Down Expand Up @@ -312,12 +311,6 @@ This custom node helps to conveniently enhance images through Detector, Detailer
* To use the existing deprecated legacy nodes, you need to enable the MMDet usage configuration.


## Ultralytics models
* When using ultralytics models, save them separately in `models/ultralytics/bbox` and `models/ultralytics/segm` depending on the type of model. Many models can be downloaded by searching for `ultralytics` in the Model Manager of ComfyUI-Manager.
* huggingface.co/Bingsu/[adetailer](https://huggingface.co/Bingsu/adetailer/tree/main) - You can download face, people detection models, and clothing detection models.
* ultralytics/[assets](https://github.com/ultralytics/assets/releases/) - You can download various types of detection models other than faces or people.
* civitai/[adetailer](https://civitai.com/search/models?sortBy=models_v5&query=adetailer) - You can download various types detection models....Many models are associated with NSFW content.

## How to activate 'MMDet usage' (DEPRECATED)
* Upon the initial execution, an `impact-pack.ini` file will be generated in the custom_nodes/ComfyUI-Impact-Pack directory.
```
Expand Down Expand Up @@ -359,11 +352,9 @@ mmdet_skip = False

* pip install
* segment-anything
* ultralytics
* scikit-image
* piexif
* opencv-python
* GitPython
* scipy
* numpy<2
* dill
Expand Down
183 changes: 0 additions & 183 deletions install-manual.py

This file was deleted.

39 changes: 8 additions & 31 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@


impact_path = os.path.join(os.path.dirname(__file__), "modules")
subpack_path = os.path.join(os.path.dirname(__file__), "impact_subpack")
subpack_repo = "https://github.com/ltdrdata/ComfyUI-Impact-Subpack"


comfy_path = os.environ.get('COMFYUI_PATH')
if comfy_path is None:
print(f"\n[bold yellow]WARN: The `COMFYUI_PATH` environment variable is not set. Assuming `{os.path.dirname(__file__)}/../../` as the ComfyUI path.[/bold yellow]", file=sys.stderr)
print(f"\nWARN: The `COMFYUI_PATH` environment variable is not set. Assuming `{os.path.dirname(__file__)}/../../` as the ComfyUI path.", file=sys.stderr)
comfy_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))

model_path = os.environ.get('COMFYUI_MODEL_PATH')
Expand All @@ -31,7 +29,7 @@

if model_path is None:
model_path = os.path.abspath(os.path.join(comfy_path, 'models'))
print(f"\n[bold yellow]WARN: The `COMFYUI_MODEL_PATH` environment variable is not set. Assuming `{model_path}` as the ComfyUI path.[/bold yellow]", file=sys.stderr)
print(f"\nWARN: The `COMFYUI_MODEL_PATH` environment variable is not set. Assuming `{model_path}` as the ComfyUI path.", file=sys.stderr)


sys.path.append(impact_path)
Expand Down Expand Up @@ -76,38 +74,11 @@ def process_wrap(cmd_str, cwd=None, handler=None, env=None):
import impact.config

print("### ComfyUI-Impact-Pack: Check dependencies")
def ensure_subpack():
import git
if os.path.exists(subpack_path):
try:
repo = git.Repo(subpack_path)
repo.remotes.origin.pull()
except:
traceback.print_exc()
if platform.system() == 'Windows':
print(f"[ComfyUI-Impact-Pack] Please turn off ComfyUI and remove '{subpack_path}' and restart ComfyUI.")
else:
shutil.rmtree(subpack_path)
git.Repo.clone_from(subpack_repo, subpack_path)
else:
git.Repo.clone_from(subpack_repo, subpack_path)


def install():
subpack_install_script = os.path.join(subpack_path, "install.py")

print(f"### ComfyUI-Impact-Pack: Updating subpack")
ensure_subpack() # The installation of the subpack must take place before ensure_pip. cv2 triggers a permission error.

new_env = os.environ.copy()
new_env["COMFYUI_PATH"] = comfy_path
new_env["COMFYUI_MODEL_PATH"] = model_path

if os.path.exists(subpack_install_script):
process_wrap([sys.executable, 'install.py'], cwd=subpack_path, env=new_env)
else:
print(f"### ComfyUI-Impact-Pack: (Install Failed) Subpack\nFile not found: `{subpack_install_script}`")

# Download model
print("### ComfyUI-Impact-Pack: Check basic models")
sam_path = os.path.join(model_path, "sams")
Expand Down Expand Up @@ -137,6 +108,12 @@ def install():

impact.config.write_config()

# Remove legacy subpack
subpack_path = os.path.join(os.path.dirname(__file__), 'impact_subpack')
if os.path.exists(subpack_path):
shutil.rmtree(subpack_path)
print(f"Legacy subpack is detected. '{subpack_path}' is removed.")

install()

except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion modules/impact/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import configparser
import os

version_code = [7, 14, 3]
version_code = [8, 0]
version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')

dependency_version = 24
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "comfyui-impact-pack"
description = "This extension offers various detector nodes and detailer nodes that allow you to configure a workflow that automatically enhances facial details. And provide iterative upscaler."
version = "7.14.3"
description = "This node pack offers various detector nodes and detailer nodes that allow you to configure a workflow that automatically enhances facial details. And provide iterative upscaler."
version = "8.0"
license = { file = "LICENSE.txt" }
dependencies = ["segment-anything", "scikit-image", "piexif", "transformers", "opencv-python-headless", "GitPython", "scipy>=1.11.4"]

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ scikit-image
piexif
transformers
opencv-python-headless
GitPython
scipy>=1.11.4
numpy<2
dill
Expand Down

0 comments on commit 64f7097

Please sign in to comment.