Skip to content

Commit d2716d0

Browse files
committed
ruff fixes
1 parent 0b16072 commit d2716d0

17 files changed

Lines changed: 119 additions & 390 deletions

File tree

modules/MMAudio/mmaudio/data/eval/audiocaps.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22
import os
3-
from collections import defaultdict
43
from pathlib import Path
54
from typing import Union
65

modules/MMAudio/mmaudio/data/extracted_audio.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from tensordict import TensorDict
88
from torch.utils.data.dataset import Dataset
99

10-
from mmaudio.utils.dist_utils import local_rank
1110

1211
log = logging.getLogger()
1312

modules/MMAudio/mmaudio/data/extraction/wav_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __getitem__(self, idx: int) -> torch.Tensor:
8989
audio_chunk = audio_chunk / abs_max * 0.95
9090

9191
if self.reject_silent and abs_max < 1e-6:
92-
log.warning(f'Rejecting silent audio')
92+
log.warning('Rejecting silent audio')
9393
return None
9494

9595
audio_chunk = audio_chunk[start_sample:end_sample]

modules/MMAudio/mmaudio/ext/bigvgan_v2/bigvgan.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,13 @@ def _from_pretrained(
397397
# instantiate BigVGAN using h
398398
if use_cuda_kernel:
399399
print(
400-
f"[WARNING] You have specified use_cuda_kernel=True during BigVGAN.from_pretrained(). Only inference is supported (training is not implemented)!"
400+
"[WARNING] You have specified use_cuda_kernel=True during BigVGAN.from_pretrained(). Only inference is supported (training is not implemented)!"
401401
)
402402
print(
403-
f"[WARNING] You need nvcc and ninja installed in your system that matches your PyTorch build is using to build the kernel. If not, the model will fail to initialize or generate incorrect waveform!"
403+
"[WARNING] You need nvcc and ninja installed in your system that matches your PyTorch build is using to build the kernel. If not, the model will fail to initialize or generate incorrect waveform!"
404404
)
405405
print(
406-
f"[WARNING] For detail, see the official GitHub repository: https://github.com/NVIDIA/BigVGAN?tab=readme-ov-file#using-custom-cuda-kernel-for-synthesis"
406+
"[WARNING] For detail, see the official GitHub repository: https://github.com/NVIDIA/BigVGAN?tab=readme-ov-file#using-custom-cuda-kernel-for-synthesis"
407407
)
408408
model = cls(h, use_cuda_kernel=use_cuda_kernel)
409409

@@ -431,7 +431,7 @@ def _from_pretrained(
431431
model.load_state_dict(checkpoint_dict["generator"])
432432
except RuntimeError:
433433
print(
434-
f"[INFO] the pretrained checkpoint does not contain weight norm. Loading the checkpoint after removing weight norm!"
434+
"[INFO] the pretrained checkpoint does not contain weight norm. Loading the checkpoint after removing weight norm!"
435435
)
436436
model.remove_weight_norm()
437437
model.load_state_dict(checkpoint_dict["generator"])

modules/MMAudio/mmaudio/ext/synchformer/synchformer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import logging
21
from typing import Any, Mapping
32

43
import torch

modules/MMAudio/mmaudio/ext/synchformer/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def check_if_file_exists_else_download(path, fname2link=FNAME2LINK, chunk_size=1
7272
link = fname2link.get(path.name, None)
7373
if link is None:
7474
raise ValueError(f'Cant find the checkpoint file: {path}.',
75-
f'Please download it manually and ensure the path exists.')
75+
'Please download it manually and ensure the path exists.')
7676
with requests.get(fname2link[path.name], stream=True) as r:
7777
total_size = int(r.headers.get('content-length', 0))
7878
with tqdm(total=total_size, unit='B', unit_scale=True) as pbar:

modules/MMAudio/mmaudio/ext/synchformer/vit_helper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from einops import rearrange, repeat
1212
from timm.layers import to_2tuple
1313
from torch import einsum
14-
from torch.nn import functional as F
1514

1615
default_cfgs = {
1716
'vit_1k':
@@ -360,7 +359,7 @@ def load_pretrained(model,
360359
print(
361360
f'Converted input conv {input_conv_name} pretrained weights from 3 to {in_chans} channel(s)'
362361
)
363-
except NotImplementedError as e:
362+
except NotImplementedError:
364363
del state_dict[weight_name]
365364
strict = False
366365
print(

modules/interface.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def update_stats(*args):
116116
f"""<div style="display: flex; align-items: center;"><h1 class='toolbar-title'>FP Studio</h1><p class='toolbar-version'>{APP_VERSION_DISPLAY}</p><p class='toolbar-patreon'><a href='https://patreon.com/Colinu' target='_blank'>{patreon_svg_inline}</a></p><p class='toolbar-discord'><a href='https://discord.com/invite/MtuM7gFJ3V' target='_blank'>{discord_svg_inline}</a></p></div>"""
117117
)
118118
with gr.Column(scale=3, min_width=250, elem_id="toolbar-right-col"):
119-
queue_stats_display = gr.HTML(
119+
gr.HTML(
120120
"""
121121
<div id='queue-stats' class='queue-stats'>
122122
<div class='queue-stats-bar'>
@@ -128,8 +128,8 @@ def update_stats(*args):
128128
</div>
129129
"""
130130
)
131-
with gr.Column(scale=9, min_width=250, elem_id="toolbar-right-col"):
132-
toolbar_stats_container = gr.HTML(
131+
with gr.Column(scale=9, min_width=250, elem_id="toolbar-right-col"):
132+
gr.HTML(
133133
"""
134134
<div id="toolbar-stats-container" class="toolbar-stat-html">
135135
<div class="stats-stack">
@@ -162,10 +162,10 @@ def update_stats(*args):
162162
--qs-label: 'Q: 0 • R: 0 • C: 0';
163163
}
164164
</style>
165-
"""
166-
, elem_id="queue-stats-vars-wrapper")
167-
168-
165+
""",
166+
elem_id="queue-stats-vars-wrapper",
167+
)
168+
169169
toolbar_stats_vars = gr.HTML(
170170
"""
171171
<style id="toolbar-stats-vars">
@@ -178,8 +178,9 @@ def update_stats(*args):
178178
--gpu-text: 'N/A';
179179
}
180180
</style>
181-
"""
182-
, elem_id="toolbar-stats-vars-wrapper")
181+
""",
182+
elem_id="toolbar-stats-vars-wrapper",
183+
)
183184

184185
# --- Tabs ---
185186
with gr.Tabs(elem_id="main_tabs") as main_tabs_component:

modules/pipelines/metadata_utils.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,20 @@ def create_metadata(job_params, job_id, settings, save_placeholder=False):
280280
# Fallback: positional mapping when lengths match selected list
281281
idx = selected_loras.index(lora_name)
282282
weight = lora_values[idx]
283-
elif isinstance(lora_values, list) and len(lora_values) == len(selected_loras):
283+
elif isinstance(lora_values, list) and len(lora_values) == len(
284+
selected_loras
285+
):
284286
# Fallback when no loaded_names but lengths match
285287
idx = selected_loras.index(lora_name)
286288
weight = lora_values[idx]
287289

288290
# Normalize weight types
289291
if isinstance(weight, np.ndarray):
290-
weight_value = float(weight.item()) if weight.size == 1 else float(weight.mean())
292+
weight_value = (
293+
float(weight.item())
294+
if weight.size == 1
295+
else float(weight.mean())
296+
)
291297
elif isinstance(weight, list):
292298
weight_value = float(weight[0]) if len(weight) > 0 else 1.0
293299
else:

modules/pipelines/single_frame_pipeline.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)