Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DAN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
DAN
Commits
ea6286c1
Commit
ea6286c1
authored
1 year ago
by
Yoann Schneider
Browse files
Options
Downloads
Plain Diff
Merge branch 'ruff-formatter' into 'main'
Update ruff pre commit hook and add formatter Closes
#238
See merge request
!330
parents
41e0c881
56af98f8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!330
Update ruff pre commit hook and add formatter
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.pre-commit-config.yaml
+4
-5
4 additions, 5 deletions
.pre-commit-config.yaml
dan/ocr/manager/metrics.py
+16
-2
16 additions, 2 deletions
dan/ocr/manager/metrics.py
dan/ocr/mlflow.py
+4
-3
4 additions, 3 deletions
dan/ocr/mlflow.py
with
24 additions
and
10 deletions
.pre-commit-config.yaml
+
4
−
5
View file @
ea6286c1
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
:
...
...
This diff is collapsed.
Click to expand it.
dan/ocr/manager/metrics.py
+
16
−
2
View file @
ea6286c1
...
...
@@ -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
:]
...
...
This diff is collapsed.
Click to expand it.
dan/ocr/mlflow.py
+
4
−
3
View file @
ea6286c1
...
...
@@ -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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment