mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-07-14 03:16:59 +08:00
Merge branch 'comfyanonymous:master' into directMLChanges
This commit is contained in:
commit
7b82959572
@ -179,7 +179,7 @@ parser.add_argument(
|
|||||||
|
|
||||||
parser.add_argument("--user-directory", type=is_valid_directory, default=None, help="Set the ComfyUI user directory with an absolute path. Overrides --base-directory.")
|
parser.add_argument("--user-directory", type=is_valid_directory, default=None, help="Set the ComfyUI user directory with an absolute path. Overrides --base-directory.")
|
||||||
|
|
||||||
parser.add_argument("--disable-compres-response-body", action="store_true", help="Disable compressing response body.")
|
parser.add_argument("--enable-compress-response-body", action="store_true", help="Enable compressing response body.")
|
||||||
|
|
||||||
if comfy.options.args_parsing:
|
if comfy.options.args_parsing:
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
5
nodes.py
5
nodes.py
@ -1064,10 +1064,11 @@ class StyleModelApply:
|
|||||||
for t in conditioning:
|
for t in conditioning:
|
||||||
(txt, keys) = t
|
(txt, keys) = t
|
||||||
keys = keys.copy()
|
keys = keys.copy()
|
||||||
if strength_type == "attn_bias" and strength != 1.0:
|
# even if the strength is 1.0 (i.e, no change), if there's already a mask, we have to add to it
|
||||||
|
if "attention_mask" in keys or (strength_type == "attn_bias" and strength != 1.0):
|
||||||
# math.log raises an error if the argument is zero
|
# math.log raises an error if the argument is zero
|
||||||
# torch.log returns -inf, which is what we want
|
# torch.log returns -inf, which is what we want
|
||||||
attn_bias = torch.log(torch.Tensor([strength]))
|
attn_bias = torch.log(torch.Tensor([strength if strength_type == "attn_bias" else 1.0]))
|
||||||
# get the size of the mask image
|
# get the size of the mask image
|
||||||
mask_ref_size = keys.get("attention_mask_img_shape", (1, 1))
|
mask_ref_size = keys.get("attention_mask_img_shape", (1, 1))
|
||||||
n_ref = mask_ref_size[0] * mask_ref_size[1]
|
n_ref = mask_ref_size[0] * mask_ref_size[1]
|
||||||
|
@ -57,8 +57,6 @@ async def cache_control(request: web.Request, handler):
|
|||||||
async def compress_body(request: web.Request, handler):
|
async def compress_body(request: web.Request, handler):
|
||||||
accept_encoding = request.headers.get("Accept-Encoding", "")
|
accept_encoding = request.headers.get("Accept-Encoding", "")
|
||||||
response: web.Response = await handler(request)
|
response: web.Response = await handler(request)
|
||||||
if args.disable_compres_response_body:
|
|
||||||
return response
|
|
||||||
if not isinstance(response, web.Response):
|
if not isinstance(response, web.Response):
|
||||||
return response
|
return response
|
||||||
if response.content_type not in ["application/json", "text/plain"]:
|
if response.content_type not in ["application/json", "text/plain"]:
|
||||||
@ -165,7 +163,10 @@ class PromptServer():
|
|||||||
self.client_session:Optional[aiohttp.ClientSession] = None
|
self.client_session:Optional[aiohttp.ClientSession] = None
|
||||||
self.number = 0
|
self.number = 0
|
||||||
|
|
||||||
middlewares = [cache_control, compress_body]
|
middlewares = [cache_control]
|
||||||
|
if args.enable_compress_response_body:
|
||||||
|
middlewares.append(compress_body)
|
||||||
|
|
||||||
if args.enable_cors_header:
|
if args.enable_cors_header:
|
||||||
middlewares.append(create_cors_middleware(args.enable_cors_header))
|
middlewares.append(create_cors_middleware(args.enable_cors_header))
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user