mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 23:00:51 +08:00
working install from git repo
This commit is contained in:
parent
7a1f064b09
commit
dc4289dbb9
4
MANIFEST.in
Normal file
4
MANIFEST.in
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
recursive-include web *
|
||||||
|
recursive-include comfy/sd1_tokenizer *
|
||||||
|
include comfy/sd1_clip_config.json
|
||||||
|
include comfy/sd2_clip_config.json
|
||||||
0
comfy/cldm/__init__.py
Normal file
0
comfy/cldm/__init__.py
Normal file
@ -17,7 +17,7 @@ def execute_prestartup_script():
|
|||||||
|
|
||||||
node_paths = folder_paths.get_folder_paths("custom_nodes")
|
node_paths = folder_paths.get_folder_paths("custom_nodes")
|
||||||
for custom_node_path in node_paths:
|
for custom_node_path in node_paths:
|
||||||
possible_modules = os.listdir(custom_node_path)
|
possible_modules = os.listdir(custom_node_path) if os.path.exists(custom_node_path) else []
|
||||||
node_prestartup_times = []
|
node_prestartup_times = []
|
||||||
|
|
||||||
for possible_module in possible_modules:
|
for possible_module in possible_modules:
|
||||||
|
|||||||
@ -28,6 +28,7 @@ from comfy.vendor.appdirs import user_data_dir
|
|||||||
|
|
||||||
nodes = import_all_nodes_in_workspace()
|
nodes = import_all_nodes_in_workspace()
|
||||||
|
|
||||||
|
|
||||||
class BinaryEventTypes:
|
class BinaryEventTypes:
|
||||||
PREVIEW_IMAGE = 1
|
PREVIEW_IMAGE = 1
|
||||||
UNENCODED_PREVIEW_IMAGE = 2
|
UNENCODED_PREVIEW_IMAGE = 2
|
||||||
@ -88,8 +89,11 @@ class PromptServer():
|
|||||||
self.app = web.Application(client_max_size=20971520, handler_args={'max_field_size': 16380},
|
self.app = web.Application(client_max_size=20971520, handler_args={'max_field_size': 16380},
|
||||||
middlewares=middlewares)
|
middlewares=middlewares)
|
||||||
self.sockets = dict()
|
self.sockets = dict()
|
||||||
self.web_root = os.path.join(os.path.dirname(
|
web_root_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../web")
|
||||||
os.path.realpath(__file__)), "../../web")
|
if not os.path.exists(web_root_path):
|
||||||
|
from pkg_resources import resource_filename
|
||||||
|
web_root_path = resource_filename('comfy', 'web/')
|
||||||
|
self.web_root = web_root_path
|
||||||
routes = web.RouteTableDef()
|
routes = web.RouteTableDef()
|
||||||
self.routes = routes
|
self.routes = routes
|
||||||
self.last_node_id = None
|
self.last_node_id = None
|
||||||
|
|||||||
0
comfy/extra_samplers/__init__.py
Normal file
0
comfy/extra_samplers/__init__.py
Normal file
0
comfy/k_diffusion/__init__.py
Normal file
0
comfy/k_diffusion/__init__.py
Normal file
0
comfy/ldm/__init__.py
Normal file
0
comfy/ldm/__init__.py
Normal file
0
comfy/ldm/models/__init__.py
Normal file
0
comfy/ldm/models/__init__.py
Normal file
0
comfy/ldm/modules/__init__.py
Normal file
0
comfy/ldm/modules/__init__.py
Normal file
0
comfy/ldm/modules/image_degradation/__init__.py
Normal file
0
comfy/ldm/modules/image_degradation/__init__.py
Normal file
0
comfy/ldm/modules/midas/__init__.py
Normal file
0
comfy/ldm/modules/midas/__init__.py
Normal file
@ -6,6 +6,7 @@ import torch
|
|||||||
import traceback
|
import traceback
|
||||||
import zipfile
|
import zipfile
|
||||||
from . import model_management
|
from . import model_management
|
||||||
|
from pkg_resources import resource_filename
|
||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
class ClipTokenWeightEncoder:
|
class ClipTokenWeightEncoder:
|
||||||
@ -52,6 +53,8 @@ class SD1ClipModel(torch.nn.Module, ClipTokenWeightEncoder):
|
|||||||
else:
|
else:
|
||||||
if textmodel_json_config is None:
|
if textmodel_json_config is None:
|
||||||
textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "sd1_clip_config.json")
|
textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "sd1_clip_config.json")
|
||||||
|
if not os.path.exists(textmodel_json_config):
|
||||||
|
textmodel_json_config = resource_filename('comfy', 'sd1_clip_config.json')
|
||||||
config = CLIPTextConfig.from_json_file(textmodel_json_config)
|
config = CLIPTextConfig.from_json_file(textmodel_json_config)
|
||||||
self.num_layers = config.num_hidden_layers
|
self.num_layers = config.num_hidden_layers
|
||||||
with comfy.ops.use_comfy_ops():
|
with comfy.ops.use_comfy_ops():
|
||||||
@ -318,6 +321,9 @@ class SD1Tokenizer:
|
|||||||
def __init__(self, tokenizer_path=None, max_length=77, pad_with_end=True, embedding_directory=None, embedding_size=768, embedding_key='clip_l'):
|
def __init__(self, tokenizer_path=None, max_length=77, pad_with_end=True, embedding_directory=None, embedding_size=768, embedding_key='clip_l'):
|
||||||
if tokenizer_path is None:
|
if tokenizer_path is None:
|
||||||
tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "sd1_tokenizer")
|
tokenizer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "sd1_tokenizer")
|
||||||
|
if not os.path.exists(os.path.join(tokenizer_path, "tokenizer_config.json")):
|
||||||
|
# package based
|
||||||
|
tokenizer_path = resource_filename('comfy', 'sd1_tokenizer/')
|
||||||
self.tokenizer = CLIPTokenizer.from_pretrained(tokenizer_path)
|
self.tokenizer = CLIPTokenizer.from_pretrained(tokenizer_path)
|
||||||
self.max_length = max_length
|
self.max_length = max_length
|
||||||
self.max_tokens_per_section = self.max_length - 2
|
self.max_tokens_per_section = self.max_length - 2
|
||||||
|
|||||||
0
comfy/sd1_tokenizer/__init__.py
Normal file
0
comfy/sd1_tokenizer/__init__.py
Normal file
@ -1,3 +1,5 @@
|
|||||||
|
from pkg_resources import resource_filename
|
||||||
|
|
||||||
from comfy import sd1_clip
|
from comfy import sd1_clip
|
||||||
import torch
|
import torch
|
||||||
import os
|
import os
|
||||||
@ -9,6 +11,8 @@ class SD2ClipModel(sd1_clip.SD1ClipModel):
|
|||||||
layer_idx=23
|
layer_idx=23
|
||||||
|
|
||||||
textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "sd2_clip_config.json")
|
textmodel_json_config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "sd2_clip_config.json")
|
||||||
|
if not os.path.exists(textmodel_json_config):
|
||||||
|
textmodel_json_config = resource_filename('comfy', 'sd2_clip_config.json')
|
||||||
super().__init__(device=device, freeze=freeze, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, textmodel_path=textmodel_path)
|
super().__init__(device=device, freeze=freeze, layer=layer, layer_idx=layer_idx, textmodel_json_config=textmodel_json_config, textmodel_path=textmodel_path)
|
||||||
self.empty_tokens = [[49406] + [49407] + [0] * 75]
|
self.empty_tokens = [[49406] + [49407] + [0] * 75]
|
||||||
|
|
||||||
|
|||||||
0
comfy/t2i_adapter/__init__.py
Normal file
0
comfy/t2i_adapter/__init__.py
Normal file
0
comfy/taesd/__init__.py
Normal file
0
comfy/taesd/__init__.py
Normal file
20
setup.py
20
setup.py
@ -3,6 +3,7 @@
|
|||||||
import os.path
|
import os.path
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
from pip._internal.index.collector import LinkCollector
|
from pip._internal.index.collector import LinkCollector
|
||||||
from pip._internal.index.package_finder import PackageFinder
|
from pip._internal.index.package_finder import PackageFinder
|
||||||
@ -11,7 +12,7 @@ from pip._internal.models.selection_prefs import SelectionPreferences
|
|||||||
from pip._internal.network.session import PipSession
|
from pip._internal.network.session import PipSession
|
||||||
from pip._internal.req import InstallRequirement
|
from pip._internal.req import InstallRequirement
|
||||||
from pip._vendor.packaging.requirements import Requirement
|
from pip._vendor.packaging.requirements import Requirement
|
||||||
from setuptools import setup, find_packages, find_namespace_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
"""
|
"""
|
||||||
The name of the package.
|
The name of the package.
|
||||||
@ -32,7 +33,7 @@ amd_torch_index = "https://download.pytorch.org/whl/rocm5.4.2"
|
|||||||
The package index to torch built with CUDA.
|
The package index to torch built with CUDA.
|
||||||
Observe the CUDA version is in this URL.
|
Observe the CUDA version is in this URL.
|
||||||
"""
|
"""
|
||||||
nvidia_torch_index = "https://download.pytorch.org/whl/cu118"
|
nvidia_torch_index = "https://download.pytorch.org/whl/nightly/cu118"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
The package index to torch built against CPU features.
|
The package index to torch built against CPU features.
|
||||||
@ -47,6 +48,12 @@ Packages that should have a specific option set when a GPU accelerator is presen
|
|||||||
"""
|
"""
|
||||||
gpu_accelerated_packages = {"rembg": "rembg[gpu]"}
|
gpu_accelerated_packages = {"rembg": "rembg[gpu]"}
|
||||||
|
|
||||||
|
"""
|
||||||
|
Indicates if we're installing an editable (develop) mode package
|
||||||
|
"""
|
||||||
|
is_editable = '--editable' in sys.argv or '-e' in sys.argv or (
|
||||||
|
'python' in sys.argv and 'setup.py' in sys.argv and 'develop' in sys.argv)
|
||||||
|
|
||||||
|
|
||||||
def _is_nvidia() -> bool:
|
def _is_nvidia() -> bool:
|
||||||
system = platform.system().lower()
|
system = platform.system().lower()
|
||||||
@ -137,6 +144,9 @@ def dependencies() -> [str]:
|
|||||||
return _dependencies
|
return _dependencies
|
||||||
|
|
||||||
|
|
||||||
|
package_data = ['sd1_tokenizer/*', '**/*.json']
|
||||||
|
if not is_editable:
|
||||||
|
package_data.append('web/**/*')
|
||||||
setup(
|
setup(
|
||||||
# "comfyui"
|
# "comfyui"
|
||||||
name=package_name,
|
name=package_name,
|
||||||
@ -146,7 +156,8 @@ setup(
|
|||||||
python_requires=">=3.9,<3.12",
|
python_requires=">=3.9,<3.12",
|
||||||
# todo: figure out how to include the web directory to eventually let main live inside the package
|
# todo: figure out how to include the web directory to eventually let main live inside the package
|
||||||
# todo: see https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/ for more about adding plugins
|
# todo: see https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/ for more about adding plugins
|
||||||
packages=find_packages(where="comfy") + find_packages(where="comfy_extras"),
|
packages=find_packages(exclude=[] if is_editable else ['custom_nodes']),
|
||||||
|
include_package_data=True,
|
||||||
install_requires=dependencies(),
|
install_requires=dependencies(),
|
||||||
setup_requires=["pip", "wheel"],
|
setup_requires=["pip", "wheel"],
|
||||||
entry_points={
|
entry_points={
|
||||||
@ -155,4 +166,7 @@ setup(
|
|||||||
'comfyui = comfy.cmd.main:main'
|
'comfyui = comfy.cmd.main:main'
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
package_data={
|
||||||
|
'comfy': package_data
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user