Fix pylint issues

This commit is contained in:
Benjamin Berman 2025-02-18 20:23:09 -08:00
parent 83ae94b96c
commit 0cfde0ad6d
2 changed files with 4 additions and 3 deletions

View File

@ -79,7 +79,7 @@ class ForgeParams4bit(Params4bit):
if device is not None and device.type == "cuda" and not self.bnb_quantized:
return self._quantize(device)
else:
n = ForgeParams4bit(
n = ForgeParams4bit( # pylint: disable=unexpected-keyword-arg
torch.nn.Parameter.to(self, device=device, dtype=dtype, non_blocking=non_blocking),
requires_grad=self.requires_grad,
quant_state=copy_quant_state(self.quant_state, device),
@ -134,7 +134,7 @@ class ForgeLoader4Bit(torch.nn.Module):
del self.dummy
elif hasattr(self, 'dummy'):
if prefix + 'weight' in state_dict:
self.weight = ForgeParams4bit(
self.weight = ForgeParams4bit( # pylint: disable=unexpected-keyword-arg
state_dict[prefix + 'weight'].to(self.dummy),
requires_grad=False,
compress_statistics=True,

View File

@ -20,7 +20,8 @@ class RegexFlags(CustomNode):
def execute(self, **kwargs) -> tuple[int]:
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():
if on and hasattr(re.RegexFlag, name):
flags |= int(re.RegexFlag[name])