Skip to content

Commit 0a2d743

Browse files
committed
fix(lint): instantiate NotImplementedError() consistently
Replace bare NotImplementedError raises with explicit instantiation. Updated datasets, LoRA engine, and stable_diffusion modules. Aligns with pre-commit lint rules; no functional change.
1 parent 88a44eb commit 0a2d743

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/xturing/datasets/text2image_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ def __init__(self, path: Union[str, Path]):
99
raise NotImplementedError("Text2ImageDataset is not implemented yet.")
1010

1111
def _validate(self):
12-
raise NotImplementedError
12+
raise NotImplementedError()

src/xturing/engines/lora_engine/lora.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def mark_only_lora_as_trainable(model: nn.Module, bias: str = "none") -> None:
521521
if isinstance(m, LoraLayer) and hasattr(m, "bias") and m.bias is not None:
522522
m.bias.requires_grad = True
523523
else:
524-
raise NotImplementedError
524+
raise NotImplementedError()
525525

526526

527527
class LoraLayer:

src/xturing/engines/lora_engine/save_and_load.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def get_peft_model_state_dict(model, state_dict=None):
4848
if bias_name in state_dict:
4949
to_return[bias_name] = state_dict[bias_name]
5050
else:
51-
raise NotImplementedError
51+
raise NotImplementedError()
5252
to_return = {
5353
k: v for k, v in to_return.items() if (("lora_" in k) or ("bias" in k))
5454
}

src/xturing/models/stable_diffusion.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ def finetune(self, dataset: Text2ImageDataset, logger=True):
1919
dataset (Text2ImageDataset): Dataset to finetune on.
2020
logger (bool, optional): To be setup with a Pytorch Lightning logger when implemented.
2121
"""
22-
raise NotImplementedError
22+
raise NotImplementedError()
2323

2424
def generate(
2525
self,
2626
texts: Optional[Union[List[str], str]] = None,
2727
dataset: Optional[Text2ImageDataset] = None,
2828
):
29-
raise NotImplementedError
29+
raise NotImplementedError()
3030

3131
def save(self, path: Union[str, Path]):
32-
raise NotImplementedError
32+
raise NotImplementedError()

0 commit comments

Comments
 (0)