Compare commits

..
6 Commits
9 changed files with 80 additions and 33 deletions
+10 -3
View File
@@ -27,15 +27,15 @@ jobs:
steps:
- name: ♻️ Checking out the repository
uses: actions/checkout@v3
- name: "🐍 Setting up Python"
- name: '🐍 Setting up Python'
uses: actions/setup-python@v4
with:
python-version: "3.10.9"
python-version: '3.10.9'
- name: 📦 Building and Bundling wheels
shell: bash
run: |
python -m pip wheel --no-cache-dir -r requirements-wheels.txt -w ./wheels 2>&1 | tee build.log
python -m pip wheel --no-cache-dir -r reqs.txt -w ./wheels 2>&1 | tee build.log
# find source wheels
packages=$(cat build.log | awk -F 'Building wheels for collected packages: ' '{print $2}')
@@ -43,6 +43,13 @@ jobs:
IFS=', ' read -r -a package_array <<< "$packages"
# Save reversed package_array to wheel_order.txt
reversed_array=()
for ((idx=${#package_array[@]}-1; idx>=0; idx--)); do
reversed_array+=("${package_array[idx]}")
done
printf '%s\n' "${reversed_array[@]}" > ./wheels/wheel_order.txt
printf "Autodetect this source package: \e[32m%s\e[0m\n" "${package_array[@]}"
# Iterate through the wheel files and remove those that are not source built
+2 -2
View File
@@ -49,7 +49,7 @@ python scripts/download_models.py
1. 确保您处于用于 ComfyUI 的 Python 环境中。
2. 运行以下命令安装所需的依赖项:
```bash
pip install -r comfy_mtb/requirements.txt
pip install -r comfy_mtb/reqs.txt
```
</details>
@@ -77,7 +77,7 @@ python scripts/download_models.py
!python custom_nodes/comfy_mtb/scripts/download_models.py -y
# install the dependencies
!pip install -r custom_nodes/comfy_mtb/requirements.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
!pip install -r custom_nodes/comfy_mtb/reqs.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
```
如果运行后 colab 抱怨需要重新启动运行时,请重新启动,然后不要重新运行之前的单元格,只运行运行本地隧道的单元格。(可能需要先添加一个包含 `%cd ComfyUI` 的单元格)
+2 -2
View File
@@ -52,7 +52,7 @@ python scripts/download_models.py
1. ComfyUIで使用しているPython環境であることを確認してください。
2. 以下のコマンドを実行して、必要な依存関係をインストールします:
```bash
pip install -r comfy_mtb/requirements.txt
pip install -r comfy_mtb/reqs.txt
```
</details>
@@ -78,7 +78,7 @@ ComfyUI with localtunnel (Recommended Way)**ヘッダーのすぐ後(コード
!python custom_nodes/comfy_mtb/scripts/download_models.py -y
# install the dependencies
!pip install -r custom_nodes/comfy_mtb/requirements.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
!pip install -r custom_nodes/comfy_mtb/reqs.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
```
これを実行した後、colabがランタイムを再起動する必要があると文句を言ったら、それを実行し、それ以前のセルは再実行せず、localtunnelを実行するセルだけを再実行してください。(最初に`%cd ComfyUI`のセルを追加する必要があるかもしれません...)
+2 -2
View File
@@ -48,7 +48,7 @@ On first run the script [tries to symlink](https://github.com/melMass/comfy_mtb/
1. Make sure you are in the Python environment you use for ComfyUI.
2. Install the required dependencies by running the following command:
```bash
pip install -r comfy_mtb/requirements.txt
pip install -r comfy_mtb/reqs.txt
```
</details>
@@ -76,7 +76,7 @@ Add a new code cell just after the **Run ComfyUI with localtunnel (Recommended W
!python custom_nodes/comfy_mtb/scripts/download_models.py -y
# install the dependencies
!pip install -r custom_nodes/comfy_mtb/requirements.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
!pip install -r custom_nodes/comfy_mtb/reqs.txt -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.0/index.html
```
If after running this, colab complains about needing to restart runtime, do it, and then do not rerun earlier cells, just the one to run the localtunnel. (you might have to add a cell with `%cd ComfyUI` first...)
+27 -13
View File
@@ -258,23 +258,16 @@ def import_or_install(requirement, dry=False):
# Install dependencies from requirements.txt
def install_dependencies(dry=False):
parsed_requirements = get_requirements(here / "requirements.txt")
parsed_requirements = get_requirements(here / "reqs.txt")
if not parsed_requirements:
return
print_formatted(
"Installing dependencies from requirements.txt...", "italic", color="yellow"
"Installing dependencies from reqs.txt...", "italic", color="yellow"
)
for requirement in parsed_requirements:
import_or_install(requirement, dry=dry)
if mode == "venv":
parsed_requirements = get_requirements(here / "requirements-wheels.txt")
if not parsed_requirements:
return
for requirement in parsed_requirements:
import_or_install(requirement, dry=dry)
if __name__ == "__main__":
full = False
@@ -328,7 +321,6 @@ if __name__ == "__main__":
# Install dependencies from requirements.txt
# if args.requirements or mode == "venv":
install_dependencies(dry=args.dry)
if (not args.wheels and mode not in ["colab", "embeded"]) and not full:
print_formatted(
@@ -336,6 +328,8 @@ if __name__ == "__main__":
"italic",
color="yellow",
)
install_dependencies(dry=args.dry)
sys.exit()
if mode in ["colab", "embeded"]:
@@ -349,7 +343,7 @@ if __name__ == "__main__":
# - Check the env before proceeding.
missing_wheels = False
parsed_requirements = get_requirements(here / "requirements-wheels.txt")
parsed_requirements = get_requirements(here / "reqs.txt")
if parsed_requirements:
for requirement in parsed_requirements:
installed, pip_name, import_name = try_import(requirement)
@@ -359,7 +353,7 @@ if __name__ == "__main__":
if not missing_wheels:
print_formatted(
f"All required wheels are already installed.", "italic", color="green"
f"All requirements are already installed.", "italic", color="green"
)
sys.exit()
@@ -408,7 +402,7 @@ if __name__ == "__main__":
)
wheels_directory.mkdir(exist_ok=True)
# - Install the wheels
for asset in matching_assets:
asset_name = asset["name"]
asset_download_url = asset["browser_download_url"]
@@ -418,6 +412,7 @@ if __name__ == "__main__":
# - Unzip to wheels dir
whl_files = []
whl_order = None
with zipfile.ZipFile(asset_dest, "r") as zip_ref:
for item in tqdm(zip_ref.namelist(), desc="Extracting", unit="file"):
if item.endswith(".whl"):
@@ -428,6 +423,14 @@ if __name__ == "__main__":
) as target:
whl_files.append(target_path)
shutil.copyfileobj(source, target)
elif item.endswith("order.txt"):
item_basename = os.path.basename(item)
target_path = wheels_directory / item_basename
with zip_ref.open(item) as source, open(
target_path, "wb"
) as target:
whl_order = target_path
shutil.copyfileobj(source, target)
print_formatted(
f"Wheels extracted for {current_platform} to the '{wheels_directory}' directory.",
@@ -436,6 +439,14 @@ if __name__ == "__main__":
)
if whl_files:
if whl_order:
with open(whl_order, "r") as order:
wheel_order_lines = [line.strip() for line in order]
whl_files = sorted(
whl_files,
key=lambda x: wheel_order_lines.index(x.split("-")[0]),
)
for whl_file in tqdm(whl_files, desc="Installing", unit="package"):
whl_path = wheels_directory / whl_file
@@ -470,3 +481,6 @@ if __name__ == "__main__":
print_formatted("Wheels installation completed.", color="green")
else:
print_formatted("No .whl files found. Nothing to install.", color="yellow")
# - Install all remainings
install_dependencies(dry=args.dry)
+3
View File
@@ -12,3 +12,6 @@ protobuf==3.20.2; platform_system == "Windows"
gdown @ git+https://github.com/melMass/gdown@main
mmdet==3.0.0
facexlib==0.3.0
insightface==0.7.3
mmcv==2.0.0
basicsr==1.4.2
-3
View File
@@ -1,3 +0,0 @@
insightface==0.7.3
mmcv==2.0.0
basicsr==1.4.2
+24 -4
View File
@@ -1,12 +1,32 @@
## Core
These 3 script should cannot be used independently and must all be present to work
These 3 scripts cannot be used independently and must all be present to work, they are mostly enhancing the frontend of python nodes
- `comfy_shared`: library of methods used in `mtb_widgets` and `debug`
**mtb_widgets** define ui callbacks, and various widgets like the `COLOR` type:
<img src="https://github.com/melMass/comfy_mtb/assets/7041726/5dbcb714-e1e2-4be7-b0e2-68a6c38c83de" width=400/>
or the `BOOL` type:
<img src="https://github.com/melMass/comfy_mtb/assets/7041726/7601366d-601c-4f4d-b735-1a4b076770b0" width=400/>
There is also `Debug` which is a node that should be able to display any data input, it handle a few cases and fallback to the string representation of the
data otherwise:
![debug](https://github.com/melMass/comfy_mtb/assets/7041726/1f4393e4-1c3d-4807-9501-fe8888bfae25)
## Standalone
These scripts can be taken and placed independently of `comfy_mtb` or any other files, mimicking what pythongosss did for their [Custom Scripts](https://github.com/pythongosssss/ComfyUI-Custom-Scripts/tree/main/js)
These scripts can be taken and placed independently of `comfy_mtb` or any other files, mimicking what pythongosss did for their
- **imageFeed**: a fork of @pythongosssss ' s [image feed](https://github.com/pythongosssss/ComfyUI-Custom-Scripts/tree/main/js), it adds support for: a lightbox to see images bigger, a way to load the current session history (in case of a web page reload), and different icons, most of the work come from the original script.
> **NOTE**
>
> The original imagefeed got updated since and offer more options, ideally I would clean my lightbox thing and PR it to pythongoss later but in the meantime the script will detect if you already use the original one and not load this fork
- ![imagefeed2-hd](https://github.com/melMass/comfy_mtb/assets/7041726/8539f46f-78e1-459a-a11c-fddd44e63ca9)
- **imageFeed**: a fork of pythongosssss's image feed, it adds support for: a lightbox to see images bigger, a way to load the current session history (in case of a web page reload), and different icons, most of the work come from the original script.
- ![imagefeed](https://github.com/melMass/comfy_mtb/assets/7041726/c3acab4b-d28b-4432-a31b-248391aa2ee8)
- **notify**: a basic toast notification system that I use in some places accross mtb, it can be used by simply calling `window.MTB.notify("Hello world!")`
![extract](https://github.com/melMass/comfy_mtb/assets/7041726/450c67fc-a7e9-4bea-ae49-b610d693098d)
+10 -4
View File
@@ -227,7 +227,7 @@ app.registerExtension({
Object.assign(img.style, {
width: '100%',
height: '100%',
objectFit: 'scale-down',
objectFit: 'cover',
})
img.src = `/view?filename=${encodeURIComponent(src.filename)}&type=${
@@ -238,6 +238,10 @@ app.registerExtension({
console.debug(img.src)
img.onload = () => {
but.style.width = `${120 * (img.naturalWidth / img.naturalHeight)}px`
}
but.onclick = () => {
lightboxContainer.style.display = 'flex'
// add the same image to the lightbox
@@ -284,9 +288,11 @@ app.registerExtension({
if (history.outputs) {
for (const key of Object.keys(history.outputs)) {
console.debug(key)
for (const im of history.outputs[key].images) {
console.debug(im)
createImageBtn(im)
if (history.outputs[key].images) {
for (const im of history.outputs[key].images) {
console.debug(im)
createImageBtn(im)
}
}
}
// for (const src of outputs.outputs.images) {