diff --git a/comfy/cli_args.py b/comfy/cli_args.py index a92fc0db..ec8f92e8 100644 --- a/comfy/cli_args.py +++ b/comfy/cli_args.py @@ -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("--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: args = parser.parse_args() diff --git a/nodes.py b/nodes.py index ba9c4e4b..1d2b1f9f 100644 --- a/nodes.py +++ b/nodes.py @@ -1064,10 +1064,11 @@ class StyleModelApply: for t in conditioning: (txt, keys) = t 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 # 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 mask_ref_size = keys.get("attention_mask_img_shape", (1, 1)) n_ref = mask_ref_size[0] * mask_ref_size[1] diff --git a/server.py b/server.py index 7b860847..1a79da7e 100644 --- a/server.py +++ b/server.py @@ -57,8 +57,6 @@ async def cache_control(request: web.Request, handler): async def compress_body(request: web.Request, handler): accept_encoding = request.headers.get("Accept-Encoding", "") response: web.Response = await handler(request) - if args.disable_compres_response_body: - return response if not isinstance(response, web.Response): return response if response.content_type not in ["application/json", "text/plain"]: @@ -165,7 +163,10 @@ class PromptServer(): self.client_session:Optional[aiohttp.ClientSession] = None 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: middlewares.append(create_cors_middleware(args.enable_cors_header)) else: