mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-27 23:00:20 +08:00
Fix pylint issues
This commit is contained in:
parent
83ae94b96c
commit
0cfde0ad6d
@ -79,7 +79,7 @@ class ForgeParams4bit(Params4bit):
|
|||||||
if device is not None and device.type == "cuda" and not self.bnb_quantized:
|
if device is not None and device.type == "cuda" and not self.bnb_quantized:
|
||||||
return self._quantize(device)
|
return self._quantize(device)
|
||||||
else:
|
else:
|
||||||
n = ForgeParams4bit(
|
n = ForgeParams4bit( # pylint: disable=unexpected-keyword-arg
|
||||||
torch.nn.Parameter.to(self, device=device, dtype=dtype, non_blocking=non_blocking),
|
torch.nn.Parameter.to(self, device=device, dtype=dtype, non_blocking=non_blocking),
|
||||||
requires_grad=self.requires_grad,
|
requires_grad=self.requires_grad,
|
||||||
quant_state=copy_quant_state(self.quant_state, device),
|
quant_state=copy_quant_state(self.quant_state, device),
|
||||||
@ -134,7 +134,7 @@ class ForgeLoader4Bit(torch.nn.Module):
|
|||||||
del self.dummy
|
del self.dummy
|
||||||
elif hasattr(self, 'dummy'):
|
elif hasattr(self, 'dummy'):
|
||||||
if prefix + 'weight' in state_dict:
|
if prefix + 'weight' in state_dict:
|
||||||
self.weight = ForgeParams4bit(
|
self.weight = ForgeParams4bit( # pylint: disable=unexpected-keyword-arg
|
||||||
state_dict[prefix + 'weight'].to(self.dummy),
|
state_dict[prefix + 'weight'].to(self.dummy),
|
||||||
requires_grad=False,
|
requires_grad=False,
|
||||||
compress_statistics=True,
|
compress_statistics=True,
|
||||||
|
|||||||
@ -20,7 +20,8 @@ class RegexFlags(CustomNode):
|
|||||||
|
|
||||||
def execute(self, **kwargs) -> tuple[int]:
|
def execute(self, **kwargs) -> tuple[int]:
|
||||||
has_noflag = hasattr(re.RegexFlag, "NOFLAG")
|
has_noflag = hasattr(re.RegexFlag, "NOFLAG")
|
||||||
flags = re.RegexFlag.NOFLAG if has_noflag else 0
|
# use getattr for python 3.10 compatibility
|
||||||
|
flags = getattr(re.RegexFlag, "NOFLAG") if has_noflag else 0
|
||||||
for name, on in kwargs.items():
|
for name, on in kwargs.items():
|
||||||
if on and hasattr(re.RegexFlag, name):
|
if on and hasattr(re.RegexFlag, name):
|
||||||
flags |= int(re.RegexFlag[name])
|
flags |= int(re.RegexFlag[name])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user