mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-23 04:40:15 +08:00
Merge branch 'comfyanonymous:master' into feature/blockweights
This commit is contained in:
commit
ca9efda21c
@ -1,6 +1,7 @@
|
|||||||
from transformers import CLIPVisionModelWithProjection, CLIPVisionConfig, CLIPImageProcessor
|
from transformers import CLIPVisionModelWithProjection, CLIPVisionConfig, CLIPImageProcessor
|
||||||
from .utils import load_torch_file, transformers_convert
|
from .utils import load_torch_file, transformers_convert
|
||||||
import os
|
import os
|
||||||
|
import torch
|
||||||
|
|
||||||
class ClipVisionModel():
|
class ClipVisionModel():
|
||||||
def __init__(self, json_config):
|
def __init__(self, json_config):
|
||||||
@ -20,7 +21,8 @@ class ClipVisionModel():
|
|||||||
self.model.load_state_dict(sd, strict=False)
|
self.model.load_state_dict(sd, strict=False)
|
||||||
|
|
||||||
def encode_image(self, image):
|
def encode_image(self, image):
|
||||||
inputs = self.processor(images=[image[0]], return_tensors="pt")
|
img = torch.clip((255. * image[0]), 0, 255).round().int()
|
||||||
|
inputs = self.processor(images=[img], return_tensors="pt")
|
||||||
outputs = self.model(**inputs)
|
outputs = self.model(**inputs)
|
||||||
return outputs
|
return outputs
|
||||||
|
|
||||||
|
|||||||
@ -45,6 +45,8 @@ try:
|
|||||||
except:
|
except:
|
||||||
OOM_EXCEPTION = Exception
|
OOM_EXCEPTION = Exception
|
||||||
|
|
||||||
|
XFORMERS_VERSION = ""
|
||||||
|
XFORMERS_ENABLED_VAE = True
|
||||||
if args.disable_xformers:
|
if args.disable_xformers:
|
||||||
XFORMERS_IS_AVAILABLE = False
|
XFORMERS_IS_AVAILABLE = False
|
||||||
else:
|
else:
|
||||||
@ -52,6 +54,17 @@ else:
|
|||||||
import xformers
|
import xformers
|
||||||
import xformers.ops
|
import xformers.ops
|
||||||
XFORMERS_IS_AVAILABLE = True
|
XFORMERS_IS_AVAILABLE = True
|
||||||
|
try:
|
||||||
|
XFORMERS_VERSION = xformers.version.__version__
|
||||||
|
print("xformers version:", XFORMERS_VERSION)
|
||||||
|
if XFORMERS_VERSION.startswith("0.0.18"):
|
||||||
|
print()
|
||||||
|
print("WARNING: This version of xformers has a major bug where you will get black images when generating high resolution images.")
|
||||||
|
print("Please downgrade or upgrade xformers to a different version.")
|
||||||
|
print()
|
||||||
|
XFORMERS_ENABLED_VAE = False
|
||||||
|
except:
|
||||||
|
pass
|
||||||
except:
|
except:
|
||||||
XFORMERS_IS_AVAILABLE = False
|
XFORMERS_IS_AVAILABLE = False
|
||||||
|
|
||||||
@ -223,13 +236,8 @@ def xformers_enabled_vae():
|
|||||||
enabled = xformers_enabled()
|
enabled = xformers_enabled()
|
||||||
if not enabled:
|
if not enabled:
|
||||||
return False
|
return False
|
||||||
try:
|
|
||||||
#0.0.18 has a bug where Nan is returned when inputs are too big (1152x1920 res images and above)
|
return XFORMERS_ENABLED_VAE
|
||||||
if xformers.version.__version__ == "0.0.18":
|
|
||||||
return False
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
return enabled
|
|
||||||
|
|
||||||
def pytorch_attention_enabled():
|
def pytorch_attention_enabled():
|
||||||
return ENABLE_PYTORCH_ATTENTION
|
return ENABLE_PYTORCH_ATTENTION
|
||||||
|
|||||||
@ -257,3 +257,16 @@ button.comfy-queue-btn {
|
|||||||
color: #ddd;
|
color: #ddd;
|
||||||
border-radius: 12px 0 0 12px;
|
border-radius: 12px 0 0 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.litegraph .litemenu-entry.has_submenu {
|
||||||
|
position: relative;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.litemenu-entry.has_submenu::after {
|
||||||
|
content: ">";
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user