Apply ruff flake8-comprehensions (#21694)
This commit is contained in:
@@ -293,7 +293,7 @@ def main():
|
||||
audio["array"], max_length=data_args.max_length_seconds, sample_rate=feature_extractor.sampling_rate
|
||||
)
|
||||
output_batch["input_values"].append(wav)
|
||||
output_batch["labels"] = [label for label in batch[data_args.label_column_name]]
|
||||
output_batch["labels"] = list(batch[data_args.label_column_name])
|
||||
|
||||
return output_batch
|
||||
|
||||
@@ -303,14 +303,14 @@ def main():
|
||||
for audio in batch[data_args.audio_column_name]:
|
||||
wav = audio["array"]
|
||||
output_batch["input_values"].append(wav)
|
||||
output_batch["labels"] = [label for label in batch[data_args.label_column_name]]
|
||||
output_batch["labels"] = list(batch[data_args.label_column_name])
|
||||
|
||||
return output_batch
|
||||
|
||||
# Prepare label mappings.
|
||||
# We'll include these in the model's config to get human readable labels in the Inference API.
|
||||
labels = raw_datasets["train"].features[data_args.label_column_name].names
|
||||
label2id, id2label = dict(), dict()
|
||||
label2id, id2label = {}, {}
|
||||
for i, label in enumerate(labels):
|
||||
label2id[label] = str(i)
|
||||
id2label[str(i)] = label
|
||||
|
||||
Reference in New Issue
Block a user