mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-20 11:20:18 +08:00
Fix Pylint warnings
This commit is contained in:
parent
fb7a3f9386
commit
264d84db39
@ -45,7 +45,7 @@ class InternalRoutes:
|
|||||||
return web.json_response("".join([(l["t"] + " - " + l["m"]) for l in logger.get_logs()]))
|
return web.json_response("".join([(l["t"] + " - " + l["m"]) for l in logger.get_logs()]))
|
||||||
|
|
||||||
@self.routes.get('/logs/raw')
|
@self.routes.get('/logs/raw')
|
||||||
async def get_logs(request):
|
async def get_logs_raw(request):
|
||||||
self.terminal_service.update_size()
|
self.terminal_service.update_size()
|
||||||
return web.json_response({
|
return web.json_response({
|
||||||
"entries": list(logger.get_logs()),
|
"entries": list(logger.get_logs()),
|
||||||
|
|||||||
@ -463,13 +463,13 @@ class MMDiT(nn.Module):
|
|||||||
if len(self.double_layers) > 0:
|
if len(self.double_layers) > 0:
|
||||||
for i, layer in enumerate(self.double_layers):
|
for i, layer in enumerate(self.double_layers):
|
||||||
if ("double_block", i) in blocks_replace:
|
if ("double_block", i) in blocks_replace:
|
||||||
def block_wrap(args):
|
def block_wrap_1(args):
|
||||||
out = {}
|
out = {}
|
||||||
out["txt"], out["img"] = layer(args["txt"],
|
out["txt"], out["img"] = layer(args["txt"],
|
||||||
args["img"],
|
args["img"],
|
||||||
args["vec"])
|
args["vec"])
|
||||||
return out
|
return out
|
||||||
out = blocks_replace[("double_block", i)]({"img": x, "txt": c, "vec": global_cond}, {"original_block": block_wrap})
|
out = blocks_replace[("double_block", i)]({"img": x, "txt": c, "vec": global_cond}, {"original_block": block_wrap_1})
|
||||||
c = out["txt"]
|
c = out["txt"]
|
||||||
x = out["img"]
|
x = out["img"]
|
||||||
else:
|
else:
|
||||||
@ -480,12 +480,12 @@ class MMDiT(nn.Module):
|
|||||||
cx = torch.cat([c, x], dim=1)
|
cx = torch.cat([c, x], dim=1)
|
||||||
for i, layer in enumerate(self.single_layers):
|
for i, layer in enumerate(self.single_layers):
|
||||||
if ("single_block", i) in blocks_replace:
|
if ("single_block", i) in blocks_replace:
|
||||||
def block_wrap(args):
|
def block_wrap_2(args):
|
||||||
out = {}
|
out = {}
|
||||||
out["img"] = layer(args["img"], args["vec"])
|
out["img"] = layer(args["img"], args["vec"])
|
||||||
return out
|
return out
|
||||||
|
|
||||||
out = blocks_replace[("single_block", i)]({"img": cx, "vec": global_cond}, {"original_block": block_wrap})
|
out = blocks_replace[("single_block", i)]({"img": cx, "vec": global_cond}, {"original_block": block_wrap_2})
|
||||||
cx = out["img"]
|
cx = out["img"]
|
||||||
else:
|
else:
|
||||||
cx = layer(cx, global_cond, **kwargs)
|
cx = layer(cx, global_cond, **kwargs)
|
||||||
|
|||||||
@ -120,12 +120,12 @@ class Flux(nn.Module):
|
|||||||
blocks_replace = patches_replace.get("dit", {})
|
blocks_replace = patches_replace.get("dit", {})
|
||||||
for i, block in enumerate(self.double_blocks):
|
for i, block in enumerate(self.double_blocks):
|
||||||
if ("double_block", i) in blocks_replace:
|
if ("double_block", i) in blocks_replace:
|
||||||
def block_wrap(args):
|
def block_wrap_1(args):
|
||||||
out = {}
|
out = {}
|
||||||
out["img"], out["txt"] = block(img=args["img"], txt=args["txt"], vec=args["vec"], pe=args["pe"])
|
out["img"], out["txt"] = block(img=args["img"], txt=args["txt"], vec=args["vec"], pe=args["pe"])
|
||||||
return out
|
return out
|
||||||
|
|
||||||
out = blocks_replace[("double_block", i)]({"img": img, "txt": txt, "vec": vec, "pe": pe}, {"original_block": block_wrap})
|
out = blocks_replace[("double_block", i)]({"img": img, "txt": txt, "vec": vec, "pe": pe}, {"original_block": block_wrap_1})
|
||||||
txt = out["txt"]
|
txt = out["txt"]
|
||||||
img = out["img"]
|
img = out["img"]
|
||||||
else:
|
else:
|
||||||
@ -142,12 +142,12 @@ class Flux(nn.Module):
|
|||||||
|
|
||||||
for i, block in enumerate(self.single_blocks):
|
for i, block in enumerate(self.single_blocks):
|
||||||
if ("single_block", i) in blocks_replace:
|
if ("single_block", i) in blocks_replace:
|
||||||
def block_wrap(args):
|
def block_wrap_2(args):
|
||||||
out = {}
|
out = {}
|
||||||
out["img"] = block(args["img"], vec=args["vec"], pe=args["pe"])
|
out["img"] = block(args["img"], vec=args["vec"], pe=args["pe"])
|
||||||
return out
|
return out
|
||||||
|
|
||||||
out = blocks_replace[("single_block", i)]({"img": img, "vec": vec, "pe": pe}, {"original_block": block_wrap})
|
out = blocks_replace[("single_block", i)]({"img": img, "vec": vec, "pe": pe}, {"original_block": block_wrap_2})
|
||||||
img = out["img"]
|
img = out["img"]
|
||||||
else:
|
else:
|
||||||
img = block(img, vec=vec, pe=pe)
|
img = block(img, vec=vec, pe=pe)
|
||||||
|
|||||||
@ -1057,15 +1057,15 @@ def reshape_mask(input_mask, output_shape):
|
|||||||
|
|
||||||
if dims == 1:
|
if dims == 1:
|
||||||
scale_mode = "linear"
|
scale_mode = "linear"
|
||||||
|
elif dims == 2:
|
||||||
if dims == 2:
|
|
||||||
input_mask = input_mask.reshape((-1, 1, input_mask.shape[-2], input_mask.shape[-1]))
|
input_mask = input_mask.reshape((-1, 1, input_mask.shape[-2], input_mask.shape[-1]))
|
||||||
scale_mode = "bilinear"
|
scale_mode = "bilinear"
|
||||||
|
elif dims == 3:
|
||||||
if dims == 3:
|
|
||||||
if len(input_mask.shape) < 5:
|
if len(input_mask.shape) < 5:
|
||||||
input_mask = input_mask.reshape((1, 1, -1, input_mask.shape[-2], input_mask.shape[-1]))
|
input_mask = input_mask.reshape((1, 1, -1, input_mask.shape[-2], input_mask.shape[-1]))
|
||||||
scale_mode = "trilinear"
|
scale_mode = "trilinear"
|
||||||
|
else:
|
||||||
|
raise ValueError(f"invalid dims={dims}")
|
||||||
|
|
||||||
mask = torch.nn.functional.interpolate(input_mask, size=output_shape[2:], mode=scale_mode)
|
mask = torch.nn.functional.interpolate(input_mask, size=output_shape[2:], mode=scale_mode)
|
||||||
if mask.shape[1] < output_shape[1]:
|
if mask.shape[1] < output_shape[1]:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user