Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3cabc86ee | ||
|
|
69529c6784 | ||
|
|
3902292033 | ||
|
|
c0f58ee0a7 | ||
|
|
81ca9190f9 | ||
|
|
20999f24ad | ||
|
|
3407fdd404 | ||
|
|
bebdf19035 | ||
|
|
dab74c91c9 | ||
|
|
088c149880 | ||
|
|
f92a308602 |
@@ -2,6 +2,38 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
### The PyTorch restore after a nodepack installs the builds that were installed before
|
||||
|
||||
When a nodepack changed torch or torchvision and the torch from before had
|
||||
no local label, Manager installed the newest releases, and through uv
|
||||
nothing. For a torch with a label it installed the versions of a table that
|
||||
ends at 2.7.0, or the newest nightly build. A nodepack that removed torch,
|
||||
or removed torchvision and left torch as it was, ended the restore with
|
||||
`Failed to restore PyTorch`.
|
||||
|
||||
Now Manager installs each of torch, torchvision and torchaudio that is not
|
||||
the build it was before as that build, such as `torch===2.14.0+cu130` from
|
||||
`https://download.pytorch.org/whl/cu130`. A torchvision or torchaudio whose
|
||||
build cannot be had is replaced by one that fits that torch. A package that
|
||||
this torch requires is installed again with it when another package wrote
|
||||
over one of its files, as a torch of another CUDA version does with the
|
||||
CUDA libraries. A last command resolves torch with torchvision and
|
||||
torchaudio: what fits that torch stays, what does not is replaced, and a
|
||||
dependency that the nodepack removed comes back.
|
||||
|
||||
Then Manager checks in a separate process that torch, torchvision and
|
||||
torchaudio work. For a torch that does not, the packages it requires that
|
||||
lack a file are installed again. A torchvision or torchaudio that does not
|
||||
is installed again from torch's index. What still does not work is named in
|
||||
an ERROR line. When the torch from before cannot be had, Manager restores
|
||||
by its version table as before; the table now goes up to 2.15.0. With uv,
|
||||
the command that installs torch, or a changed torchvision or torchaudio, at
|
||||
its build is sent only in a form that a dry run resolved, and once more
|
||||
when it fails while it installs. For safety the restore does not start when
|
||||
the disk has less free space than it can take: twice the size of what it
|
||||
installs again with pip, one and a half times with uv. pip runs without its
|
||||
cache during the restore, so that it holds each wheel once.
|
||||
|
||||
### cm-cli reinstall keeps the version that is installed
|
||||
|
||||
`cm-cli reinstall <nodepack>` without a version removed the nodepack and
|
||||
|
||||
@@ -61902,6 +61902,28 @@
|
||||
"install_type": "git-clone",
|
||||
"description": "Generate Wan videos and retrieve task results. Requires an Ace Data Cloud API key. Generation is metered."
|
||||
},
|
||||
{
|
||||
"author": "AceDataCloud",
|
||||
"title": "ACE Music",
|
||||
"id": "ace-acemusic",
|
||||
"reference": "https://github.com/AceDataCloud/ACEMusicComfyUI",
|
||||
"files": [
|
||||
"https://github.com/AceDataCloud/ACEMusicComfyUI"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Generate ACE Music songs and lyrics, import reference assets, and retrieve results by task ID. Requires an Ace Data Cloud API key. Generation and reference imports are metered."
|
||||
},
|
||||
{
|
||||
"author": "AceDataCloud",
|
||||
"title": "GPT Image",
|
||||
"id": "gpt-image",
|
||||
"reference": "https://github.com/AceDataCloud/GPTImageComfyUI",
|
||||
"files": [
|
||||
"https://github.com/AceDataCloud/GPTImageComfyUI"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Generate and edit images with GPT Image, retrieve task results, and load the resulting images in ComfyUI. Requires an Ace Data Cloud API key. Generation and editing are metered."
|
||||
},
|
||||
{
|
||||
"author": "NotUsingGithub",
|
||||
"title": "Wan27",
|
||||
@@ -62788,6 +62810,26 @@
|
||||
"install_type": "git-clone",
|
||||
"description": "Find misspelled text in photos and AI-generated images with Gemini, then use an image-editing workflow to fix localized text and review spelling and style. Includes check-only and SenseNova U1.6 examples."
|
||||
},
|
||||
{
|
||||
"author": "Raykosan (RaykoStudio)",
|
||||
"title": "ComfyUI-RS_WorkspaceManager",
|
||||
"reference": "https://github.com/Raykosan/ComfyUI-RS_WorkspaceManager",
|
||||
"files": [
|
||||
"https://github.com/Raykosan/ComfyUI-RS_WorkspaceManager"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Workflow Preset Manager and Interface Settings Backup for ComfyUI."
|
||||
},
|
||||
{
|
||||
"author": "assetfeed",
|
||||
"title": "AssetFeed",
|
||||
"reference": "https://github.com/assetfeed/comfyui-assetfeed",
|
||||
"files": [
|
||||
"https://github.com/assetfeed/comfyui-assetfeed"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Nodes for the AssetFeed API: AssetFeed OCR reads the text in an image, and AssetFeed AI Text Check estimates the AI-written share of an English text. Needs an ASSETFEED_API_KEY environment variable; images and text are sent to api.assetfeed.com; data handling is in the README."
|
||||
},
|
||||
{
|
||||
"author": "ntdviet",
|
||||
"title": "ntdviet/comfyui-ext",
|
||||
|
||||
+355
-12
@@ -2,6 +2,8 @@
|
||||
description:
|
||||
`manager_util` is the lightest module shared across the prestartup_script, main code, and cm-cli of ComfyUI-Manager.
|
||||
"""
|
||||
import csv
|
||||
import sysconfig
|
||||
import importlib.metadata
|
||||
import traceback
|
||||
import ipaddress
|
||||
@@ -9,9 +11,11 @@ import socket
|
||||
|
||||
import aiohttp
|
||||
import json
|
||||
import math
|
||||
import threading
|
||||
import os
|
||||
import shutil
|
||||
import contextlib
|
||||
from datetime import datetime
|
||||
import subprocess
|
||||
import tempfile
|
||||
@@ -1091,9 +1095,21 @@ def parse_requirement_line(line):
|
||||
|
||||
|
||||
torch_torchvision_torchaudio_version_map = {
|
||||
'2.15.0': ('0.29.2', '2.11.*'),
|
||||
'2.14.1': ('0.29.1', '2.11.*'),
|
||||
'2.14.0': ('0.29.0', '2.11.*'),
|
||||
'2.13.0': ('0.28.0', '2.11.*'),
|
||||
'2.12.1': ('0.27.1', '2.11.*'),
|
||||
'2.12.0': ('0.27.0', '2.11.*'),
|
||||
'2.11.0': ('0.26.0', '2.11.*'),
|
||||
'2.10.0': ('0.25.0', '2.10.0'),
|
||||
'2.9.1': ('0.24.1', '2.9.1'),
|
||||
'2.9.0': ('0.24.0', '2.9.0'),
|
||||
'2.8.0': ('0.23.0', '2.8.0'),
|
||||
'2.7.1': ('0.22.1', '2.7.1'),
|
||||
'2.7.0': ('0.22.0', '2.7.0'),
|
||||
'2.6.0': ('0.21.0', '2.6.0'),
|
||||
'2.5.1': ('0.20.0', '2.5.0'),
|
||||
'2.5.1': ('0.20.1', '2.5.1'),
|
||||
'2.5.0': ('0.20.0', '2.5.0'),
|
||||
'2.4.1': ('0.19.1', '2.4.1'),
|
||||
'2.4.0': ('0.19.0', '2.4.0'),
|
||||
@@ -1105,19 +1121,19 @@ torch_torchvision_torchaudio_version_map = {
|
||||
'2.1.2': ('0.16.2', '2.1.2'),
|
||||
'2.1.1': ('0.16.1', '2.1.1'),
|
||||
'2.1.0': ('0.16.0', '2.1.0'),
|
||||
'2.0.1': ('0.15.2', '2.0.1'),
|
||||
'2.0.1': ('0.15.2', '2.0.2'),
|
||||
'2.0.0': ('0.15.1', '2.0.0'),
|
||||
}
|
||||
|
||||
|
||||
def torch_rollback(prev, packages):
|
||||
def torch_rollback_by_version_table(prev, packages, options=()):
|
||||
spec = prev.split('+')
|
||||
if len(spec) > 1:
|
||||
platform = spec[1]
|
||||
else:
|
||||
cmd = make_pip_cmd(['install', '--force', *packages])
|
||||
cmd = make_pip_cmd(['install', '--force', *packages, *options])
|
||||
logging.info("[ComfyUI-Manager] restore PyTorch to the newest release")
|
||||
subprocess.check_output(cmd, universal_newlines=True)
|
||||
logging.error(cmd)
|
||||
return
|
||||
|
||||
torch_ver = StrictVersion(spec[0])
|
||||
@@ -1126,21 +1142,349 @@ def torch_rollback(prev, packages):
|
||||
|
||||
if torch_torchvision_torchaudio_ver is None:
|
||||
cmd = make_pip_cmd(['install', '--pre', *packages,
|
||||
'--index-url', f"https://download.pytorch.org/whl/nightly/{platform}"])
|
||||
'--index-url', f"https://download.pytorch.org/whl/nightly/{platform}", *options])
|
||||
logging.info("[ComfyUI-Manager] restore PyTorch to nightly version")
|
||||
else:
|
||||
torchvision_ver, torchaudio_ver = torch_torchvision_torchaudio_ver
|
||||
versions = {'torch': torch_ver, 'torchvision': torchvision_ver, 'torchaudio': torchaudio_ver}
|
||||
cmd = make_pip_cmd(['install', *[f'{name}=={versions[name]}' for name in packages],
|
||||
'--index-url', f"https://download.pytorch.org/whl/{platform}"])
|
||||
'--index-url', f"https://download.pytorch.org/whl/{platform}", *options])
|
||||
logging.info(f"[ComfyUI-Manager] restore PyTorch to {torch_ver}+{platform}")
|
||||
|
||||
subprocess.check_output(cmd, universal_newlines=True)
|
||||
|
||||
|
||||
def _pytorch_index(build, option):
|
||||
from packaging.version import Version
|
||||
|
||||
version = Version(build)
|
||||
if version.is_devrelease:
|
||||
return ['--pre', option, f"https://download.pytorch.org/whl/nightly/{version.local or 'cpu'}"]
|
||||
if version.local is not None:
|
||||
return [option, f"https://download.pytorch.org/whl/{version.local}"]
|
||||
return []
|
||||
|
||||
|
||||
def _installed_version(name):
|
||||
try:
|
||||
return importlib.metadata.version(name)
|
||||
except importlib.metadata.PackageNotFoundError:
|
||||
return None
|
||||
|
||||
|
||||
def _recorded_files(name):
|
||||
try:
|
||||
distribution = importlib.metadata.distribution(name)
|
||||
except importlib.metadata.PackageNotFoundError:
|
||||
return []
|
||||
# From the RECORD itself: files() leaves out the missing ones from Python 3.12 on
|
||||
return [(distribution.locate_file(row[0]), int(row[2]))
|
||||
for row in csv.reader((distribution.read_text('RECORD') or '').splitlines()) if len(row) == 3 and row[2]]
|
||||
|
||||
|
||||
def _required_here(name, extras=frozenset()):
|
||||
from packaging.requirements import InvalidRequirement, Requirement
|
||||
|
||||
found = []
|
||||
for line in importlib.metadata.requires(name) or []:
|
||||
try:
|
||||
requirement = Requirement(line)
|
||||
except InvalidRequirement:
|
||||
continue
|
||||
if requirement.marker is None or any(requirement.marker.evaluate({'extra': extra}) for extra in {*extras, ''}):
|
||||
found.append((normalize_pip_name(requirement.name), set(requirement.extras)))
|
||||
return found
|
||||
|
||||
|
||||
def _size_of_pytorch():
|
||||
extras, todo = {}, [(name, set()) for name in ('torch', 'torchvision', 'torchaudio')]
|
||||
while todo:
|
||||
name, wanted = todo.pop()
|
||||
if _installed_version(name) is None or name in extras and wanted <= extras[name]:
|
||||
continue
|
||||
extras[name] = extras.get(name, set()) | wanted
|
||||
todo += _required_here(name, extras[name])
|
||||
return {name: sum(size for _, size in _recorded_files(name)) for name in extras}
|
||||
|
||||
|
||||
def _space_to_restore(installed_before, installed_after, overwritten, size_of_pytorch, times_the_size):
|
||||
return int(times_the_size * sum(size for name, size in size_of_pytorch.items()
|
||||
if installed_after.get(name) != installed_before.get(name) or name in overwritten))
|
||||
|
||||
|
||||
def _overwritten(installed_before, installed_after, required_by_torch):
|
||||
# cuDNN, cuSPARSELt, NCCL and NVSHMEM ship one distribution per CUDA version, all writing the same file paths.
|
||||
return {name: installed_after[name] for name in sorted(required_by_torch)
|
||||
if name in installed_after and installed_before.get(name) == installed_after[name]
|
||||
and any(os.path.isfile(file) and os.path.getsize(file) != size for file, size in _recorded_files(name))}
|
||||
|
||||
|
||||
def _incomplete(required_by_torch):
|
||||
return {name: _installed_version(name) for name in sorted(required_by_torch)
|
||||
if any(not os.path.isfile(file) for file, _ in _recorded_files(name))}
|
||||
|
||||
|
||||
# The metadata of a torchvision or torchaudio can fit torch while its native library does not load beside it: a build
|
||||
# for another CUDA version, or the PyPI build beside a CPU torch. torch imports beside a cuDNN older than the one it
|
||||
# was built for; cudnn.version() compares the two without a GPU, and a CPU build has none to compare.
|
||||
_PYTORCH_CHECKS = {
|
||||
'torch': 'import torch; torch.backends.cudnn.version()',
|
||||
'torchvision': 'import torch, torchvision; torchvision.ops.nms(torch.rand(3, 4) * 10, torch.rand(3), 0.5)',
|
||||
'torchaudio': 'import torch, torchaudio.functional as F; F.lowpass_biquad(torch.rand(1, 100), 16000, 300.0)',
|
||||
}
|
||||
|
||||
|
||||
_CHECK_TIME_LIMIT = 300
|
||||
|
||||
# A .pth file or a module can print to the same stdout when Python starts, and can leave its line without an end.
|
||||
_CHECK_LINE = '[ComfyUI-Manager] PyTorch check:'
|
||||
_CHECK_DID_NOT_RUN = None
|
||||
|
||||
|
||||
def _not_working(names):
|
||||
code = f"print({_CHECK_LINE!r}, flush=True)\n" + ''.join(
|
||||
f"try:\n {_PYTORCH_CHECKS[name]}\n print({f'{_CHECK_LINE} {name}'!r}, flush=True)\nexcept Exception:\n"
|
||||
f" pass\n" for name in names)
|
||||
try:
|
||||
printed = subprocess.run([sys.executable, '-c', code], capture_output=True, text=True,
|
||||
timeout=_CHECK_TIME_LIMIT).stdout.splitlines()
|
||||
except subprocess.TimeoutExpired:
|
||||
return _CHECK_DID_NOT_RUN
|
||||
def told(line):
|
||||
return any(found.endswith(line) for found in printed)
|
||||
|
||||
if not told(_CHECK_LINE):
|
||||
return _CHECK_DID_NOT_RUN
|
||||
return [name for name in names if not told(f'{_CHECK_LINE} {name}')]
|
||||
|
||||
|
||||
class _Pip:
|
||||
# Measured: pip holds a wheel in its temporary folder while it writes the files, at the peak 1.7 times the size of
|
||||
# the files. With its cache it holds the wheel there too, at the peak 2.35 times for a CUDA torch for Windows.
|
||||
times_the_size = 2
|
||||
|
||||
@contextlib.contextmanager
|
||||
def environment(self):
|
||||
before = os.environ.get('PIP_NO_CACHE_DIR')
|
||||
os.environ['PIP_NO_CACHE_DIR'] = '1'
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
if before is None:
|
||||
del os.environ['PIP_NO_CACHE_DIR']
|
||||
else:
|
||||
os.environ['PIP_NO_CACHE_DIR'] = before
|
||||
|
||||
def install(self, name, build, *options):
|
||||
command = make_pip_cmd(['install', *options, f'{name}==={build}', *_pytorch_index(build, '--extra-index-url')])
|
||||
try:
|
||||
subprocess.check_output(command, universal_newlines=True)
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
return True
|
||||
|
||||
@contextlib.contextmanager
|
||||
def putting_back(self, overwritten, torch):
|
||||
# pip installs no distribution of a command again without all the others.
|
||||
pins = [f'{name}=={version}' for name, version in overwritten.items()]
|
||||
with tempfile.TemporaryDirectory() as wheels:
|
||||
if pins:
|
||||
try:
|
||||
subprocess.check_output(make_pip_cmd(['download', '--no-deps', '-d', wheels, *pins,
|
||||
*_pytorch_index(torch, '--extra-index-url')]),
|
||||
universal_newlines=True)
|
||||
except subprocess.CalledProcessError:
|
||||
raise RuntimeError(f"{', '.join(pins)} cannot be had")
|
||||
yield []
|
||||
left = [f'{name}=={version}' for name, version in overwritten.items()
|
||||
if _installed_version(name) == version]
|
||||
if left:
|
||||
subprocess.check_output(make_pip_cmd(['install', '--no-deps', '--force-reinstall', '--no-index',
|
||||
'--find-links', wheels, *left]), universal_newlines=True)
|
||||
|
||||
def own_index(self, torch):
|
||||
return _pytorch_index(torch, '--index-url')
|
||||
|
||||
def install_again(self, broken, requirements, torch):
|
||||
# pip joins PIP_EXTRA_INDEX_URL to an index and takes the highest version of all, which can be a build for
|
||||
# another CUDA version.
|
||||
index = _pytorch_index(torch, '--find-links')
|
||||
if index:
|
||||
*pre, _, url = index
|
||||
index = [*pre, '--no-index', *[option for name in broken for option in ('--find-links', f'{url}/{name}/')]]
|
||||
subprocess.check_output(make_pip_cmd(['install', '--force-reinstall', '--no-deps',
|
||||
*[requirements[name] for name in broken], *index]),
|
||||
universal_newlines=True)
|
||||
|
||||
def install_files_again(self, name, version, torch):
|
||||
subprocess.check_output(make_pip_cmd(['install', '--force-reinstall', '--no-deps', f'{name}=={version}',
|
||||
*_pytorch_index(torch, '--extra-index-url')]), universal_newlines=True)
|
||||
|
||||
|
||||
class _Uv:
|
||||
# Measured: uv unpacks a wheel into its cache and links the files from there, at the peak 1.06 times the size of
|
||||
# the files. Where it copies them, it removes the old build first.
|
||||
times_the_size = 1.5
|
||||
|
||||
def __init__(self):
|
||||
from packaging.version import Version
|
||||
|
||||
# uv's version line can follow what Python prints as it starts.
|
||||
try:
|
||||
printed = subprocess.check_output([*make_pip_cmd([])[:-1], '--version'], universal_newlines=True)
|
||||
except subprocess.CalledProcessError:
|
||||
printed = ''
|
||||
version = re.search(r'^uv (\d+(\.\d+)*)', printed, re.MULTILINE)
|
||||
self.reads_index = version is not None and Version(version[1]) >= Version('0.4.23')
|
||||
|
||||
def environment(self):
|
||||
return contextlib.nullcontext()
|
||||
|
||||
def install(self, name, build, *options):
|
||||
# uv does not put back what it removed when a command fails while it installs, and an install command sent
|
||||
# after it can lay the new build over what is left and report it as installed. uv ends a command when it
|
||||
# cannot reach an index that the command names. A --extra-index-url of the command takes the place of
|
||||
# UV_EXTRA_INDEX_URL.
|
||||
index = _pytorch_index(build, '--extra-index-url')
|
||||
command = make_pip_cmd(['install', *options, f'{name}==={build}', *index])
|
||||
forms = [command, [*command, '--offline']]
|
||||
if index:
|
||||
forms.append([*make_pip_cmd(['install', *options, f'{name}==={build}', *index[:-2]]), '--offline'])
|
||||
for form in forms:
|
||||
try:
|
||||
subprocess.check_output([*form, '--dry-run'], universal_newlines=True, stderr=subprocess.PIPE)
|
||||
except subprocess.CalledProcessError as e:
|
||||
if form is command:
|
||||
reason = '\n'.join(line for line in e.stderr.strip().splitlines()
|
||||
if not line.startswith('Using Python '))
|
||||
continue
|
||||
if form is not command:
|
||||
logging.info("[ComfyUI-Manager] restore PyTorch: the command does not resolve with its indexes, "
|
||||
"installing from uv's cache alone")
|
||||
try:
|
||||
subprocess.check_output(form, universal_newlines=True)
|
||||
except subprocess.CalledProcessError:
|
||||
logging.warning(f"[ComfyUI-Manager] restore PyTorch: installing {name} {build} failed, "
|
||||
f"sending it once more")
|
||||
subprocess.check_output([*form, '--reinstall-package', name], universal_newlines=True)
|
||||
return True
|
||||
logging.warning(f"[ComfyUI-Manager] restore PyTorch: uv does not resolve the command: {reason}")
|
||||
return False
|
||||
|
||||
def putting_back(self, overwritten, torch):
|
||||
return contextlib.nullcontext([option for name in overwritten for option in ('--reinstall-package', name)])
|
||||
|
||||
def own_index(self, torch):
|
||||
# uv reads --index before UV_INDEX, UV_EXTRA_INDEX_URL and the default index, and a --index of the command
|
||||
# takes the place of UV_INDEX.
|
||||
index = _pytorch_index(torch, '--index-url')
|
||||
return [*index, '--index' if self.reads_index else '--extra-index-url', index[-1]] if index else []
|
||||
|
||||
def install_again(self, broken, requirements, torch):
|
||||
again = [option for name in broken for option in ('--reinstall-package', name)]
|
||||
subprocess.check_output(make_pip_cmd(['install', *requirements.values(), *self.own_index(torch), *again]),
|
||||
universal_newlines=True)
|
||||
|
||||
def install_files_again(self, name, version, torch):
|
||||
subprocess.check_output(make_pip_cmd(['install', '--no-deps', f'{name}=={version}',
|
||||
*_pytorch_index(torch, '--extra-index-url'),
|
||||
'--reinstall-package', name]), universal_newlines=True)
|
||||
|
||||
|
||||
def _report_not_working(names):
|
||||
if names is _CHECK_DID_NOT_RUN:
|
||||
logging.warning("[ComfyUI-Manager] restore PyTorch: the check of what works did not run")
|
||||
elif names:
|
||||
logging.error(f"[ComfyUI-Manager] restore PyTorch: does not work after the restore: "
|
||||
f"{', '.join(f'{name} {_installed_version(name)}' for name in names)}")
|
||||
|
||||
|
||||
def torch_rollback(installed_before, installed_after, required_by_torch, size_of_pytorch):
|
||||
from packaging.version import Version
|
||||
|
||||
tool = _Uv() if 'uv' in make_pip_cmd([]) else _Pip()
|
||||
torch = installed_before['torch']
|
||||
packages = [name for name in ('torch', 'torchvision', 'torchaudio')
|
||||
if name in installed_before or name in installed_after]
|
||||
changed = {name: installed_before[name] for name in ('torch', 'torchvision', 'torchaudio')
|
||||
if name in installed_before and installed_after.get(name) != installed_before[name]}
|
||||
logging.info(f"[ComfyUI-Manager] restore PyTorch: {', '.join(f'{name} {build}' for name, build in changed.items())}")
|
||||
|
||||
companions = {name: build for name, build in changed.items() if name != 'torch'}
|
||||
overwritten = _overwritten(installed_before, installed_after, required_by_torch)
|
||||
needed = _space_to_restore(installed_before, installed_after, overwritten, size_of_pytorch, tool.times_the_size)
|
||||
free = shutil.disk_usage(sysconfig.get_path('purelib')).free
|
||||
if free < needed:
|
||||
raise RuntimeError(f"for safety the restore does not start: it can take {math.ceil(needed / 10 ** 6)} MB on "
|
||||
f"the disk of the Python environment, where {free // 10 ** 6} MB are free")
|
||||
with tool.environment():
|
||||
if 'torch' in changed or overwritten:
|
||||
with tool.putting_back(overwritten, torch) as options:
|
||||
torch_installed = tool.install('torch', torch, *options)
|
||||
if not torch_installed:
|
||||
logging.warning(f"[ComfyUI-Manager] restore PyTorch: torch {torch} cannot be had, "
|
||||
f"restoring by the version table instead")
|
||||
torch_rollback_by_version_table(torch, packages, options)
|
||||
if not torch_installed:
|
||||
_report_not_working(_not_working(packages))
|
||||
return
|
||||
|
||||
for name, build in companions.items():
|
||||
if not tool.install(name, build, '--no-deps'):
|
||||
logging.warning(f"[ComfyUI-Manager] restore PyTorch: {name} {build} cannot be had, "
|
||||
f"installing a {name} that fits torch {torch} instead")
|
||||
|
||||
# torchaudio 2.11.0 declares no requirement on torch, so without a bound the resolver takes it beside an older
|
||||
# torch. The bound is the next minor version of torch, as a patch release of torchaudio can be newer than its
|
||||
# torch: 2.0.2 goes with 2.0.1.
|
||||
version = Version(torch)
|
||||
requirement = {'torch': f'torch==={torch}', 'torchvision': 'torchvision',
|
||||
'torchaudio': f'torchaudio<{version.major}.{version.minor + 1}'}
|
||||
requirements = {name: requirement[name] for name in packages}
|
||||
try:
|
||||
subprocess.check_output(make_pip_cmd(['install', *requirements.values(), *tool.own_index(torch)]),
|
||||
universal_newlines=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
logging.warning(f"[ComfyUI-Manager] restore PyTorch: the whole set failed to install, checking what "
|
||||
f"works: {e}")
|
||||
|
||||
broken = _not_working(packages)
|
||||
if broken and 'torch' in broken:
|
||||
# An uninstall takes the files that two distributions share.
|
||||
incomplete = _incomplete(required_by_torch)
|
||||
for name, version in incomplete.items():
|
||||
try:
|
||||
tool.install_files_again(name, version, torch)
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
if incomplete:
|
||||
broken = _not_working(packages)
|
||||
|
||||
if broken and 'torch' not in broken:
|
||||
torchvision = _installed_version('torchvision')
|
||||
if 'torchvision' in broken and torchvision is not None:
|
||||
requirements['torchvision'] = f"torchvision=={Version(torchvision).public}"
|
||||
try:
|
||||
tool.install_again(broken, requirements, torch)
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
broken = _not_working(packages)
|
||||
_report_not_working(broken)
|
||||
|
||||
|
||||
class PIPFixer:
|
||||
def __init__(self, prev_pip_versions, comfyui_path, manager_files_path):
|
||||
self.prev_pip_versions = { **prev_pip_versions }
|
||||
self.required_by_torch, self.size_of_pytorch = set(), {}
|
||||
torch = prev_pip_versions.get('torch')
|
||||
try:
|
||||
list_names_the_installed_torch = torch is not None and _installed_version('torch') == torch
|
||||
if list_names_the_installed_torch:
|
||||
self.required_by_torch, self.size_of_pytorch = ({name for name, _ in _required_here('torch')},
|
||||
_size_of_pytorch())
|
||||
except Exception as e:
|
||||
logging.warning(f"[ComfyUI-Manager] restore PyTorch: what torch requires could not be read, "
|
||||
f"a restore will put no library back: {e!r}")
|
||||
self.comfyui_path = comfyui_path
|
||||
self.manager_files_path = manager_files_path
|
||||
|
||||
@@ -1162,11 +1506,10 @@ class PIPFixer:
|
||||
try:
|
||||
if 'torch' not in self.prev_pip_versions or 'torchvision' not in self.prev_pip_versions:
|
||||
logging.error("[ComfyUI-Manager] PyTorch is not installed")
|
||||
elif self.prev_pip_versions['torch'] != new_pip_versions['torch'] \
|
||||
or self.prev_pip_versions['torchvision'] != new_pip_versions['torchvision']:
|
||||
packages = [name for name in ('torch', 'torchvision', 'torchaudio')
|
||||
if name in self.prev_pip_versions or name in new_pip_versions]
|
||||
torch_rollback(self.prev_pip_versions['torch'], packages)
|
||||
elif any(self.prev_pip_versions[name] != new_pip_versions.get(name) for name in ('torch', 'torchvision')):
|
||||
clear_pip_cache()
|
||||
torch_rollback(self.prev_pip_versions, new_pip_versions, self.required_by_torch,
|
||||
self.size_of_pytorch)
|
||||
except Exception as e:
|
||||
logging.error("[ComfyUI-Manager] Failed to restore PyTorch")
|
||||
logging.error(e)
|
||||
|
||||
@@ -1,5 +1,47 @@
|
||||
{
|
||||
"custom_nodes": [
|
||||
{
|
||||
"author": "AceDataCloud",
|
||||
"title": "GPT Image",
|
||||
"id": "gpt-image",
|
||||
"reference": "https://github.com/AceDataCloud/GPTImageComfyUI",
|
||||
"files": [
|
||||
"https://github.com/AceDataCloud/GPTImageComfyUI"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Generate and edit images with GPT Image, retrieve task results, and load the resulting images in ComfyUI. Requires an Ace Data Cloud API key. Generation and editing are metered."
|
||||
},
|
||||
{
|
||||
"author": "AceDataCloud",
|
||||
"title": "ACE Music",
|
||||
"id": "ace-acemusic",
|
||||
"reference": "https://github.com/AceDataCloud/ACEMusicComfyUI",
|
||||
"files": [
|
||||
"https://github.com/AceDataCloud/ACEMusicComfyUI"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Generate ACE Music songs and lyrics, import reference assets, and retrieve results by task ID. Requires an Ace Data Cloud API key. Generation and reference imports are metered."
|
||||
},
|
||||
{
|
||||
"author": "assetfeed",
|
||||
"title": "AssetFeed",
|
||||
"reference": "https://github.com/assetfeed/comfyui-assetfeed",
|
||||
"files": [
|
||||
"https://github.com/assetfeed/comfyui-assetfeed"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Nodes for the AssetFeed API: AssetFeed OCR reads the text in an image, and AssetFeed AI Text Check estimates the AI-written share of an English text. Needs an ASSETFEED_API_KEY environment variable; images and text are sent to api.assetfeed.com; data handling is in the README."
|
||||
},
|
||||
{
|
||||
"author": "Raykosan (RaykoStudio)",
|
||||
"title": "ComfyUI-RS_WorkspaceManager",
|
||||
"reference": "https://github.com/Raykosan/ComfyUI-RS_WorkspaceManager",
|
||||
"files": [
|
||||
"https://github.com/Raykosan/ComfyUI-RS_WorkspaceManager"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Workflow Preset Manager and Interface Settings Backup for ComfyUI."
|
||||
},
|
||||
{
|
||||
"author": "bewizsky",
|
||||
"title": "Eyes4AI Text Repair",
|
||||
|
||||
+1254
-38
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user