Skip to content
Snippets Groups Projects
Commit 56af98f8 authored by Manon Blanco's avatar Manon Blanco
Browse files

Update ruff pre commit hook and add formatter

parent 4ab36328
No related branches found
No related tags found
1 merge request!330Update ruff pre commit hook and add formatter
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.282
rev: v0.1.6
hooks:
# Run the linter.
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/ambv/black
rev: 23.7.0
hooks:
- id: black
# Run the formatter.
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
......
......@@ -106,7 +106,14 @@ class MetricManager:
display_values["sample_time"] = float(round(sample_time, 4))
display_values[metric_name] = value
continue
case "cer" | "cer_no_token" | "wer" | "wer_no_punct" | "wer_no_token" | "ner":
case (
"cer"
| "cer_no_token"
| "wer"
| "wer_no_punct"
| "wer_no_token"
| "ner"
):
keyword = METRICS_KEYWORD[metric_name[:3]]
suffix = metric_name[3:]
num_name, denom_name = (
......@@ -150,7 +157,14 @@ class MetricManager:
gt, prediction = values["str_y"], values["str_x"]
for metric_name in metric_names:
match metric_name:
case "cer" | "cer_no_token" | "wer" | "wer_no_punct" | "wer_no_token" | "ner":
case (
"cer"
| "cer_no_token"
| "wer"
| "wer_no_punct"
| "wer_no_token"
| "ner"
):
task = metric_name[:3]
keyword = METRICS_KEYWORD[task]
suffix = metric_name[3:]
......
......@@ -144,7 +144,8 @@ def start_mlflow_run(config: dict):
assert experiment_id, "Missing MLflow experiment ID in the configuration"
# Start run
yield mlflow.start_run(
run_id=run_id, run_name=run_name, experiment_id=experiment_id
), run_id is None
yield (
mlflow.start_run(run_id=run_id, run_name=run_name, experiment_id=experiment_id),
run_id is None,
)
mlflow.end_run()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment