Skip to content

Commit 32a49ac

Browse files
committed
chore: fix code formatting and update linter config
- Fix duplicate 'ignore' key in pyproject.toml - Add extend-exclude for VideoAlign and HPSv3 submodules - Remove deprecated UP038 rule from ruff config - Apply ruff formatting to all project files
1 parent 4b7ad4f commit 32a49ac

5 files changed

Lines changed: 6 additions & 12 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repos:
44
rev: v0.11.0
55
hooks:
66
- id: ruff
7-
args: [--fix, --respect-gitignore, --config=pyproject.toml, --ignore=UP038]
7+
args: [--fix, --respect-gitignore, --config=pyproject.toml]
88
- id: ruff-format
99
args: [--config=pyproject.toml]
1010

genrl/diffusers_patch/wan_pipeline_with_logprob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def wan_pipeline_with_logprob(
191191
):
192192
if callback_on_step_end_tensor_inputs is None:
193193
callback_on_step_end_tensor_inputs = ["latents"]
194-
if isinstance(callback_on_step_end, (PipelineCallback, MultiPipelineCallbacks)): # noqa: UP038
194+
if isinstance(callback_on_step_end, (PipelineCallback, MultiPipelineCallbacks)):
195195
callback_on_step_end_tensor_inputs = callback_on_step_end.tensor_inputs
196196

197197
self.check_inputs(

genrl/reward/hpsv3.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ def _fn(
145145
# Repeat the general prompt for all frames
146146
frame_prompts = [general_prompt] * len(frame_paths)
147147
with torch.no_grad(), torch.amp.autocast(device_type=device_type):
148-
frame_rewards_raw = inferencer.reward(
149-
frame_prompts, image_paths=frame_paths
150-
)
148+
frame_rewards_raw = inferencer.reward(frame_prompts, image_paths=frame_paths)
151149

152150
# Extract mu values (mean scores)
153151
# HPSv3 returns a list where each element is [mu, sigma] or a tensor
@@ -226,9 +224,7 @@ def _fn(
226224
# Use the same prompt for all frames in the video
227225
frame_prompts = [prompt] * len(frame_paths)
228226
with torch.no_grad(), torch.amp.autocast(device_type=device_type):
229-
frame_rewards_raw = inferencer.reward(
230-
frame_prompts, image_paths=frame_paths
231-
)
227+
frame_rewards_raw = inferencer.reward(frame_prompts, image_paths=frame_paths)
232228

233229
# Extract mu values (mean scores)
234230
# HPSv3 returns a list where each element is [mu, sigma] or a tensor

genrl/trainer/base_trainer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def log_metrics(
260260
# Handle Python native types (int, float)
261261
# Note: numpy.float64 is a subclass of float, but has dtype attribute
262262
# numpy.int64 is NOT a subclass of int, and has dtype attribute
263-
elif isinstance(value, (int, float)) and not hasattr(value, "dtype"): # noqa: UP038
263+
elif isinstance(value, (int, float)) and not hasattr(value, "dtype"):
264264
scalar_items[key] = float(value)
265265
# Handle numpy scalars (numpy.int64, numpy.float64, etc.)
266266
# numpy scalars have .item() method and .dtype attribute

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
[tool.ruff]
22
line-length = 120
33
target-version = "py310"
4+
extend-exclude = ["genrl/reward/VideoAlign", "genrl/reward/HPSv3"]
45

56
[tool.ruff.lint]
67
select = ["E", "F", "W", "I", "N", "UP", "B", "C4", "DTZ", "T10", "EM", "ISC", "ICN", "PIE", "T20", "PYI", "PT", "Q", "RSE", "RET", "SIM", "ARG", "PTH", "ERA", "PD", "PGH", "PL", "TRY", "NPY", "RUF"]
7-
ignore = [
8-
"UP038", # isinstance doesn't support X | Y syntax, must use tuple
9-
]
108
ignore = [
119
"PTH", # Prefer pathlib over os.path (too many changes needed)
1210
"PLR0913", # Too many arguments (acceptable for complex functions)

0 commit comments

Comments
 (0)