Skip to content

Commit 3065186

Browse files
committed
running with corrected black version
1 parent 8bcd198 commit 3065186

20 files changed

Lines changed: 64 additions & 66 deletions

File tree

demo/halomi/reproduce_evaluation.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,7 @@ def main(data_root):
118118
print("Direction-wise mean score for hallucination detection:")
119119
results = {}
120120
for fe_name, fe in feature_sets.items():
121-
(
122-
word_level_preds,
123-
direction2auc,
124-
) = evaluate_token_level_features(
121+
(word_level_preds, direction2auc,) = evaluate_token_level_features(
125122
tokens_dataset, fe, word_to_character_maps, word_labels
126123
)
127124
auc = np.mean(list(direction2auc.values()))
@@ -152,10 +149,7 @@ def main(data_root):
152149
results = {}
153150
print("Direction-wise mean score for omission detection:")
154151
for fe_name, fe in feature_sets.items():
155-
(
156-
word_level_preds,
157-
direction2auc,
158-
) = evaluate_token_level_features(
152+
(word_level_preds, direction2auc,) = evaluate_token_level_features(
159153
tokens_dataset, fe, word_to_character_maps, word_labels
160154
)
161155
auc = np.mean(list(direction2auc.values()))

stopes/core/cache.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,17 @@ def save_cache(
8080
value: tp.Any,
8181
iteration_value: tp.Optional[tp.Any] = None,
8282
iteration_index: int = 0,
83-
): ...
83+
):
84+
...
8485

8586
@abstractmethod
8687
def invalidate_cache(
8788
self,
8889
module: "StopesModule",
8990
iteration_value: tp.Optional[tp.Any] = None,
9091
iteration_index: int = 0,
91-
): ...
92+
):
93+
...
9294

9395
def invalidate_module_cache(
9496
self,

stopes/eval/local_prosody/unity2_forced_aligner_f2.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ class UnitY2F2ForcedAlignerConfig:
4040
aligner_name: str = "nar_t2u_aligner"
4141
unit_extractor_name: str = "xlsr2_1b_v2"
4242
unit_extractor_output_layer_n: int = 35
43-
unit_extractor_kmeans_uri: str = (
44-
"https://dl.fbaipublicfiles.com/seamlessM4T/models/unit_extraction/kmeans_10k.npy"
45-
)
43+
unit_extractor_kmeans_uri: str = "https://dl.fbaipublicfiles.com/seamlessM4T/models/unit_extraction/kmeans_10k.npy"
4644
device: str = "cpu"
4745

4846
fps: float = (

stopes/modules/bitext/mining/calculate_distances.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class CalculateDistancesConfig:
3636
index_other_lang: str = MISSING # "path/to/index"
3737
index_other_lang_type: str = MISSING # type of the index
3838

39-
output_dir: tp.Optional[str] = (
40-
None # If None, will be set to dist.src-tgt.knn.numprobe.gpu_type
41-
)
39+
output_dir: tp.Optional[
40+
str
41+
] = None # If None, will be set to dist.src-tgt.knn.numprobe.gpu_type
4242

4343
num_probe: int = 128
4444
knn: int = 16

stopes/modules/preprocess/sonar_text_embedding.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ def _apply_on_simple_column(
9191
self,
9292
col: tp.Union[pa.Array, pa.ChunkedArray],
9393
lang_value: str,
94-
) -> tp.Union[pa.Array, pa.ChunkedArray]: ...
94+
) -> tp.Union[pa.Array, pa.ChunkedArray]:
95+
...
9596

9697
def _apply_on_unique_lang_table(
9798
self, table: pa.Table, config: LangColumnConfig

stopes/modules/preprocess/train_spm.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ class TrainSpmConfig:
2727
model_type: str = "unigram"
2828
shuffle_input_sentence: bool = True
2929
num_threads: int = 4
30-
model_prefix_spm: str = (
31-
"" # optional value; if passed as empty, will be auto set based on train_data_file name
32-
)
30+
model_prefix_spm: str = "" # optional value; if passed as empty, will be auto set based on train_data_file name
3331

3432

3533
@dataclasses.dataclass()

stopes/modules/speech/denoise.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ class DenoiserConfig:
6060
compute_snr: whether to compute signal-to-noise ratio after denoising
6161
"""
6262

63-
shards: tp.Any = (
64-
MISSING # it is tp.Union[Path, tp.List[Path]], but such annotation is not supported by OmegaConf
65-
)
63+
shards: tp.Any = MISSING # it is tp.Union[Path, tp.List[Path]], but such annotation is not supported by OmegaConf
6664
output_dir: Path = MISSING
6765
model_name: str = "mdx_extra"
6866
source_id: tp.Union[str, int] = "vocals"

stopes/modules/speech/video_alignement/video_segmentor.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ class WhisperSegmentorConfig:
9292
"""
9393
Filtering option. If not None, it represents a list of languages to restrict on.
9494
"""
95-
sibling_ids: tp.Optional[tp.List[str]] = (
96-
None # specific videos ids that we want to segment
97-
)
95+
sibling_ids: tp.Optional[
96+
tp.List[str]
97+
] = None # specific videos ids that we want to segment
9898
"""
9999
Filtering option. If not None, it represents a list of ids to restrict on.
100100
"""
@@ -272,10 +272,10 @@ def get_sentence_segments_dataframe(
272272
& (words_df["capital_case"] | words_df["punctuation_nonstops"])
273273
) | words_df["punctuation_stops"]
274274

275-
words_df["new_segment_index"] = (
276-
WhisperSegmentorModule._segments_with_duration_limit(
277-
words_df, max_duration_expected
278-
)
275+
words_df[
276+
"new_segment_index"
277+
] = WhisperSegmentorModule._segments_with_duration_limit(
278+
words_df, max_duration_expected
279279
)
280280

281281
grouper_ = words_df.groupby("new_segment_index")

stopes/modules/tests/test_embedding_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ def test_save_embeddings(
9898
sample = np.random.choice(
9999
len(test_data), round(len(test_data) * sample_fraction), replace=False
100100
)
101-
final_result = test_data[sample,]
101+
final_result = test_data[
102+
sample,
103+
]
102104
emb.save(copy_path, sample, fp16, mode=read_mode)
103105
assert np.array_equal(np.load(copy_path), final_result)
104106

stopes/modules/tests/test_partitioned_data_mapper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ class IdentityPartitionedDataMapper(PartitionedDataMapper):
3838
def get_batch_mapper(self):
3939
return lambda batch: batch
4040

41-
def requirements(self): ...
41+
def requirements(self):
42+
...
4243

4344
def get_custom_metadata(self, *args, **kwargs) -> Dict[str, Any]:
4445
return {}

0 commit comments

Comments
 (0)