mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-22 03:37:01 +08:00
merge master[24.05.23] and initial local repo
This commit is contained in:
parent
6c23854f54
commit
f0d3442f16
5
.gitignore
vendored
5
.gitignore
vendored
@ -15,4 +15,7 @@ venv/
|
|||||||
!/web/extensions/logging.js.example
|
!/web/extensions/logging.js.example
|
||||||
!/web/extensions/core/
|
!/web/extensions/core/
|
||||||
/tests-ui/data/object_info.json
|
/tests-ui/data/object_info.json
|
||||||
/user/
|
/user/
|
||||||
|
my_workflows/*
|
||||||
|
*.log
|
||||||
|
login/*
|
||||||
24
.vscode/launch.json
vendored
Normal file
24
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Current File",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${file}",
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "launch",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "main.py",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"args": ["--cuda-device", "3", "--listen", "0.0.0.0", "--port", "38188"],
|
||||||
|
"env": {"http_proxy":"http://127.0.0.1:7890", "https_proxy":"http://127.0.0.1:7890"}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -33,7 +33,7 @@ class EnumAction(argparse.Action):
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
parser.add_argument("--listen", type=str, default="127.0.0.1", metavar="IP", nargs="?", const="0.0.0.0", help="Specify the IP address to listen on (default: 127.0.0.1). If --listen is provided without an argument, it defaults to 0.0.0.0. (listens on all)")
|
parser.add_argument("--listen", type=str, default="0.0.0.0", metavar="IP", nargs="?", const="0.0.0.0", help="Specify the IP address to listen on (default: 127.0.0.1). If --listen is provided without an argument, it defaults to 0.0.0.0. (listens on all)")
|
||||||
parser.add_argument("--port", type=int, default=8188, help="Set the listen port.")
|
parser.add_argument("--port", type=int, default=8188, help="Set the listen port.")
|
||||||
parser.add_argument("--tls-keyfile", type=str, help="Path to TLS (SSL) key file. Enables TLS, makes app accessible at https://... requires --tls-certfile to function")
|
parser.add_argument("--tls-keyfile", type=str, help="Path to TLS (SSL) key file. Enables TLS, makes app accessible at https://... requires --tls-certfile to function")
|
||||||
parser.add_argument("--tls-certfile", type=str, help="Path to TLS (SSL) certificate file. Enables TLS, makes app accessible at https://... requires --tls-keyfile to function")
|
parser.add_argument("--tls-certfile", type=str, help="Path to TLS (SSL) certificate file. Enables TLS, makes app accessible at https://... requires --tls-keyfile to function")
|
||||||
|
|||||||
@ -256,9 +256,11 @@ class ModelPatcher:
|
|||||||
|
|
||||||
def patch_model(self, device_to=None, patch_weights=True):
|
def patch_model(self, device_to=None, patch_weights=True):
|
||||||
for k in self.object_patches:
|
for k in self.object_patches:
|
||||||
old = comfy.utils.set_attr(self.model, k, self.object_patches[k])
|
# old = comfy.utils.set_attr(self.model, k, self.object_patches[k])
|
||||||
|
old = comfy.utils.get_attr(self.model, k) # ref :https://github.com/lllyasviel/stable-diffusion-webui-forge/commit/e48533bdcd08118c5cd7e2c1de14c91c3b7fc8ec#diff-7c5f4df48e8675674db0152893d57c9df52fd048df14e82d9f9c08154265e368
|
||||||
if k not in self.object_patches_backup:
|
if k not in self.object_patches_backup:
|
||||||
self.object_patches_backup[k] = old
|
self.object_patches_backup[k] = old
|
||||||
|
comfy.utils.set_attr_raw(self.model, k, self.object_patches[k]) # ref :https://github.com/lllyasviel/stable-diffusion-webui-forge/commit/e48533bdcd08118c5cd7e2c1de14c91c3b7fc8ec#diff-7c5f4df48e8675674db0152893d57c9df52fd048df14e82d9f9c08154265e368
|
||||||
|
|
||||||
if patch_weights:
|
if patch_weights:
|
||||||
model_sd = self.model_state_dict()
|
model_sd = self.model_state_dict()
|
||||||
@ -494,6 +496,7 @@ class ModelPatcher:
|
|||||||
|
|
||||||
keys = list(self.object_patches_backup.keys())
|
keys = list(self.object_patches_backup.keys())
|
||||||
for k in keys:
|
for k in keys:
|
||||||
comfy.utils.set_attr(self.model, k, self.object_patches_backup[k])
|
# comfy.utils.set_attr(self.model, k, self.object_patches_backup[k])
|
||||||
|
comfy.utils.set_attr_raw(self.model, k, self.object_patches_backup[k])
|
||||||
|
|
||||||
self.object_patches_backup.clear()
|
self.object_patches_backup.clear()
|
||||||
|
|||||||
@ -298,6 +298,13 @@ def set_attr(obj, attr, value):
|
|||||||
setattr(obj, attrs[-1], value)
|
setattr(obj, attrs[-1], value)
|
||||||
return prev
|
return prev
|
||||||
|
|
||||||
|
# ref: https://github.com/lllyasviel/stable-diffusion-webui-forge/commit/e48533bdcd08118c5cd7e2c1de14c91c3b7fc8ec#diff-7c5f4df48e8675674db0152893d57c9df52fd048df14e82d9f9c08154265e368
|
||||||
|
def set_attr_raw(obj, attr, value):
|
||||||
|
attrs = attr.split(".")
|
||||||
|
for name in attrs[:-1]:
|
||||||
|
obj = getattr(obj, name)
|
||||||
|
setattr(obj, attrs[-1], value)
|
||||||
|
|
||||||
def set_attr_param(obj, attr, value):
|
def set_attr_param(obj, attr, value):
|
||||||
return set_attr(obj, attr, torch.nn.Parameter(value, requires_grad=False))
|
return set_attr(obj, attr, torch.nn.Parameter(value, requires_grad=False))
|
||||||
|
|
||||||
|
|||||||
@ -1,42 +0,0 @@
|
|||||||
#Rename this to extra_model_paths.yaml and ComfyUI will load it
|
|
||||||
|
|
||||||
|
|
||||||
#config for a1111 ui
|
|
||||||
#all you have to do is change the base_path to where yours is installed
|
|
||||||
a111:
|
|
||||||
base_path: path/to/stable-diffusion-webui/
|
|
||||||
|
|
||||||
checkpoints: models/Stable-diffusion
|
|
||||||
configs: models/Stable-diffusion
|
|
||||||
vae: models/VAE
|
|
||||||
loras: |
|
|
||||||
models/Lora
|
|
||||||
models/LyCORIS
|
|
||||||
upscale_models: |
|
|
||||||
models/ESRGAN
|
|
||||||
models/RealESRGAN
|
|
||||||
models/SwinIR
|
|
||||||
embeddings: embeddings
|
|
||||||
hypernetworks: models/hypernetworks
|
|
||||||
controlnet: models/ControlNet
|
|
||||||
|
|
||||||
#config for comfyui
|
|
||||||
#your base path should be either an existing comfy install or a central folder where you store all of your models, loras, etc.
|
|
||||||
|
|
||||||
#comfyui:
|
|
||||||
# base_path: path/to/comfyui/
|
|
||||||
# checkpoints: models/checkpoints/
|
|
||||||
# clip: models/clip/
|
|
||||||
# clip_vision: models/clip_vision/
|
|
||||||
# configs: models/configs/
|
|
||||||
# controlnet: models/controlnet/
|
|
||||||
# embeddings: models/embeddings/
|
|
||||||
# loras: models/loras/
|
|
||||||
# upscale_models: models/upscale_models/
|
|
||||||
# vae: models/vae/
|
|
||||||
|
|
||||||
#other_ui:
|
|
||||||
# base_path: path/to/ui
|
|
||||||
# checkpoints: models/checkpoints
|
|
||||||
# gligen: models/gligen
|
|
||||||
# custom_nodes: path/custom_nodes
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.4 KiB |
@ -1,6 +1,6 @@
|
|||||||
torch
|
#torch
|
||||||
torchsde
|
torchsde
|
||||||
torchvision
|
#torchvision
|
||||||
einops
|
einops
|
||||||
transformers>=4.25.1
|
transformers>=4.25.1
|
||||||
safetensors>=0.3.0
|
safetensors>=0.3.0
|
||||||
|
|||||||
2
styles/n-styles.csv
Normal file
2
styles/n-styles.csv
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
name,prompt,negative_prompt
|
||||||
|
NAI,"masterpiece, best quality, masterpiece, asuka langley sitting cross legged on a chair","lowres, bad anatomy, bad hands"
|
||||||
|
65
test_notebook.ipynb
Normal file
65
test_notebook.ipynb
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"names = [{'content': 'SUPIR/SUPIR-v0F_fp16.safetensors', 'image': None}, {'content': 'SUPIR/SUPIR-v0Q_fp16.safetensors', 'image': None}, {'content': 'TripoSR.ckpt', 'image': None}, {'content': 'sdXL/9527DetailRealistic_v40Lighting4S.safetensors', 'image': 'checkpoints/sdXL/9527DetailRealistic_v40Lighting4S.png'}, {'content': 'sdXL/albedobaseXL_v21.safetensors', 'image': 'checkpoints/sdXL/albedobaseXL_v21.png'}, {'content': 'sdXL/dreamshaperXL_v21TurboDPMSDE.safetensors', 'image': 'checkpoints/sdXL/dreamshaperXL_v21TurboDPMSDE.png'}, {'content': 'sdXL/enjoyXLSuperRealistic_v20.safetensors', 'image': 'checkpoints/sdXL/enjoyXLSuperRealistic_v20.png'}, {'content': 'sdXL/juggernautXL_v9Rdphoto2Lightning.safetensors', 'image': None}, {'content': 'sdXL/mklanRealistic_v220realistic.safetensors', 'image': 'checkpoints/sdXL/mklanRealistic_v220realistic.png'}, {'content': 'sdXL/platypusPhotorealism_v3Lightning.safetensors', 'image': 'checkpoints/sdXL/platypusPhotorealism_v3Lightning.jpeg'}, {'content': 'sdXL/realvisxlV40_v40LightningBakedvae.safetensors', 'image': 'checkpoints/sdXL/realvisxlV40_v40LightningBakedvae.jpeg'}, {'content': 'sdXL/sdXL_v10.safetensors', 'image': None}, {'content': 'sdXL/sdXL_v10Refiner.safetensors', 'image': None}, {'content': 'sdXL/sdxl10ArienmixxlAsian_v45Pruned.safetensors', 'image': 'checkpoints/sdXL/sdxl10ArienmixxlAsian_v45Pruned.png'}, {'content': 'sdXL/二次元/MR_3DQ/MR 3DQ _SDXL V0.2.safetensors', 'image': 'checkpoints/sdXL/二次元/MR_3DQ/MR 3DQ _SDXL V0.2.png'}, {'content': 'sd_15/AWPortraitWW_Lite_1.0.safetensors', 'image': 'checkpoints/sd_15/AWPortraitWW_Lite_1.0.jpg'}, {'content': 'sd_15/Chilloutmix-Ni-pruned-fp16-fix.safetensors', 'image': 'checkpoints/sd_15/Chilloutmix-Ni-pruned-fp16-fix.jpeg'}, {'content': 'sd_15/XXMixUnreal_v1.0.safetensors', 'image': 'checkpoints/sd_15/XXMixUnreal_v1.0.png'}, {'content': 'sd_15/chilloutmix-Ni.safetensors', 'image': 'checkpoints/sd_15/chilloutmix-Ni.png'}, {'content': 'sd_15/majicmixRealistic_v7-inpainting.safetensors', 'image': None}, {'content': 'sd_15/majicmixRealistic_v7.safetensors', 'image': 'checkpoints/sd_15/majicmixRealistic_v7.png'}, {'content': 'sd_15/realisticVisionV60B1_v60B1VAE.safetensors', 'image': 'checkpoints/sd_15/realisticVisionV60B1_v60B1VAE.jpeg'}, {'content': 'sd_15/v1-5-pruned-emaonly.safetensors', 'image': None}, {'content': 'sd_15/v1-5-pruned.safetensors', 'image': None}, {'content': 'sd_15_TextEffect/Realistic_Vision_V4.0_fp16-no-ema.safetensors', 'image': None}, {'content': 'sd_15_TextEffect/Realistic_Vision_V5.1_fp16-no-ema.safetensors', 'image': None}, {'content': 'sd_15_TextEffect/blazingDrive_V08c.safetensors', 'image': 'checkpoints/sd_15_TextEffect/blazingDrive_V08c.jpeg'}, {'content': 'sd_15_TextEffect/dreamlike-anime-1.0.safetensors', 'image': 'checkpoints/sd_15_TextEffect/dreamlike-anime-1.0.jpg'}, {'content': 'sd_15_TextEffect/majicmixRealistic_betterV2V25.safetensors', 'image': None}, {'content': 'sd_15_TextEffect/majicmixRealistic_v6.safetensors', 'image': None}, {'content': 'sd_15_TextEffect/revAnimated_v122EOL.safetensors', 'image': None}]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"[{'content': 'sd_15/AWPortraitWW_Lite_1.0.safetensors', 'image': 'checkpoints/sd_15/AWPortraitWW_Lite_1.0.jpg'}, {'content': 'sd_15/Chilloutmix-Ni-pruned-fp16-fix.safetensors', 'image': 'checkpoints/sd_15/Chilloutmix-Ni-pruned-fp16-fix.jpeg'}, {'content': 'sd_15/chilloutmix-Ni.safetensors', 'image': 'checkpoints/sd_15/chilloutmix-Ni.png'}, {'content': 'sd_15/majicmixRealistic_v7-inpainting.safetensors', 'image': None}, {'content': 'sd_15/majicmixRealistic_v7.safetensors', 'image': 'checkpoints/sd_15/majicmixRealistic_v7.png'}, {'content': 'sd_15/realisticVisionV60B1_v60B1VAE.safetensors', 'image': 'checkpoints/sd_15/realisticVisionV60B1_v60B1VAE.jpeg'}, {'content': 'sd_15/v1-5-pruned-emaonly.safetensors', 'image': None}, {'content': 'sd_15/v1-5-pruned.safetensors', 'image': None}, {'content': 'sd_15/XXMixUnreal_v1.0.safetensors', 'image': 'checkpoints/sd_15/XXMixUnreal_v1.0.png'}, {'content': 'sd_15_TextEffect/blazingDrive_V08c.safetensors', 'image': 'checkpoints/sd_15_TextEffect/blazingDrive_V08c.jpeg'}, {'content': 'sd_15_TextEffect/dreamlike-anime-1.0.safetensors', 'image': 'checkpoints/sd_15_TextEffect/dreamlike-anime-1.0.jpg'}, {'content': 'sd_15_TextEffect/majicmixRealistic_betterV2V25.safetensors', 'image': None}, {'content': 'sd_15_TextEffect/majicmixRealistic_v6.safetensors', 'image': None}, {'content': 'sd_15_TextEffect/Realistic_Vision_V4.0_fp16-no-ema.safetensors', 'image': None}, {'content': 'sd_15_TextEffect/Realistic_Vision_V5.1_fp16-no-ema.safetensors', 'image': None}, {'content': 'sd_15_TextEffect/revAnimated_v122EOL.safetensors', 'image': None}, {'content': 'sdXL/9527DetailRealistic_v40Lighting4S.safetensors', 'image': 'checkpoints/sdXL/9527DetailRealistic_v40Lighting4S.png'}, {'content': 'sdXL/albedobaseXL_v21.safetensors', 'image': 'checkpoints/sdXL/albedobaseXL_v21.png'}, {'content': 'sdXL/dreamshaperXL_v21TurboDPMSDE.safetensors', 'image': 'checkpoints/sdXL/dreamshaperXL_v21TurboDPMSDE.png'}, {'content': 'sdXL/enjoyXLSuperRealistic_v20.safetensors', 'image': 'checkpoints/sdXL/enjoyXLSuperRealistic_v20.png'}, {'content': 'sdXL/juggernautXL_v9Rdphoto2Lightning.safetensors', 'image': None}, {'content': 'sdXL/mklanRealistic_v220realistic.safetensors', 'image': 'checkpoints/sdXL/mklanRealistic_v220realistic.png'}, {'content': 'sdXL/platypusPhotorealism_v3Lightning.safetensors', 'image': 'checkpoints/sdXL/platypusPhotorealism_v3Lightning.jpeg'}, {'content': 'sdXL/realvisxlV40_v40LightningBakedvae.safetensors', 'image': 'checkpoints/sdXL/realvisxlV40_v40LightningBakedvae.jpeg'}, {'content': 'sdXL/sdxl10ArienmixxlAsian_v45Pruned.safetensors', 'image': 'checkpoints/sdXL/sdxl10ArienmixxlAsian_v45Pruned.png'}, {'content': 'sdXL/sdXL_v10.safetensors', 'image': None}, {'content': 'sdXL/sdXL_v10Refiner.safetensors', 'image': None}, {'content': 'sdXL/二次元/MR_3DQ/MR 3DQ _SDXL V0.2.safetensors', 'image': 'checkpoints/sdXL/二次元/MR_3DQ/MR 3DQ _SDXL V0.2.png'}, {'content': 'SUPIR/SUPIR-v0F_fp16.safetensors', 'image': None}, {'content': 'SUPIR/SUPIR-v0Q_fp16.safetensors', 'image': None}, {'content': 'TripoSR.ckpt', 'image': None}]\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"def get_name(ele:dict):\n",
|
||||||
|
" # print(ele)\n",
|
||||||
|
" name = ele[\"content\"].replace(\"/\", \"__\").lower()\n",
|
||||||
|
" \n",
|
||||||
|
" return name\n",
|
||||||
|
"\n",
|
||||||
|
"names.sort(key=get_name)\n",
|
||||||
|
"print(names)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "fooocus",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.10.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
||||||
16
test_xformers.py
Normal file
16
test_xformers.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# ref :https://github.com/facebookresearch/xformers/issues/845
|
||||||
|
|
||||||
|
|
||||||
|
import xformers
|
||||||
|
import xformers.ops
|
||||||
|
import torch,os
|
||||||
|
os.environ["MAX_BLOCK_SIZE"] = "655350"
|
||||||
|
os.environ["CUDA_VISIBLE_DEVICES"] = "3"
|
||||||
|
os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
|
||||||
|
|
||||||
|
q = torch.zeros(([65536, 16, 80])).cuda()
|
||||||
|
k = torch.zeros(([65536, 16, 80])).cuda()
|
||||||
|
v = torch.zeros(([65536, 16, 80])).cuda()
|
||||||
|
out = xformers.ops.memory_efficient_attention(q, k, v, attn_bias=None)
|
||||||
|
|
||||||
|
print("Done.")
|
||||||
Loading…
x
Reference in New Issue
Block a user