Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NACSOS Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MCC APSIS
NACSOS
NACSOS Core
Commits
198f3f40
Commit
198f3f40
authored
1 year ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
fix build
parent
f931877d
No related branches found
Branches containing commit
No related tags found
1 merge request
!60
Master
Pipeline
#2139
failed
1 year ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/api/routes/evaluation.py
+28
-27
28 additions, 27 deletions
server/api/routes/evaluation.py
server/util/config.py
+4
-4
4 additions, 4 deletions
server/util/config.py
with
32 additions
and
31 deletions
server/api/routes/evaluation.py
+
28
−
27
View file @
198f3f40
...
@@ -141,33 +141,34 @@ async def bg_populate_tracker(tracker_id: str, batch_size: int | None = None, la
...
@@ -141,33 +141,34 @@ async def bg_populate_tracker(tracker_id: str, batch_size: int | None = None, la
if
labels
is
None
or
len
(
labels
)
==
0
:
if
labels
is
None
or
len
(
labels
)
==
0
:
labels
=
tracker
.
labels
labels
=
tracker
.
labels
flat_labels
=
[
lab
for
batch
in
labels
for
lab
in
batch
]
if
labels
is
not
None
:
flat_labels
=
[
lab
for
batch
in
labels
for
lab
in
batch
]
recall
=
compute_recall
(
labels_
=
flat_labels
)
recall
=
compute_recall
(
labels_
=
flat_labels
)
if
tracker
.
recall
is
None
:
if
tracker
.
recall
is
None
:
tracker
.
recall
=
recall
tracker
.
recall
=
recall
else
:
else
:
tracker
.
recall
+=
recall
tracker
.
recall
+=
recall
await
session
.
flush
()
# Initialise buscar scores
if
tracker
.
buscar
is
None
:
tracker
.
buscar
=
[]
if
batch_size
is
None
:
# Use scopes as batches
it
=
calculate_h0s_for_batches
(
labels
=
tracker
.
labels
,
recall_target
=
tracker
.
recall_target
,
n_docs
=
tracker
.
n_items_total
)
else
:
# Ignore the batches derived from scopes and use fixed step sizes
it
=
calculate_h0s
(
labels_
=
flat_labels
,
batch_size
=
batch_size
,
recall_target
=
tracker
.
recall_target
,
n_docs
=
tracker
.
n_items_total
)
for
x
,
y
in
it
:
tracker
.
buscar
=
tracker
.
buscar
+
[(
x
,
y
)]
# save after each step, so the user can refresh the page and get data as it becomes available
await
session
.
flush
()
await
session
.
flush
()
# Initialise buscar scores
if
tracker
.
buscar
is
None
:
tracker
.
buscar
=
[]
if
batch_size
is
None
:
# Use scopes as batches
it
=
calculate_h0s_for_batches
(
labels
=
tracker
.
labels
,
recall_target
=
tracker
.
recall_target
,
n_docs
=
tracker
.
n_items_total
)
else
:
# Ignore the batches derived from scopes and use fixed step sizes
it
=
calculate_h0s
(
labels_
=
flat_labels
,
batch_size
=
batch_size
,
recall_target
=
tracker
.
recall_target
,
n_docs
=
tracker
.
n_items_total
)
for
x
,
y
in
it
:
tracker
.
buscar
=
tracker
.
buscar
+
[(
x
,
y
)]
# save after each step, so the user can refresh the page and get data as it becomes available
await
session
.
flush
()
This diff is collapsed.
Click to expand it.
server/util/config.py
+
4
−
4
View file @
198f3f40
...
@@ -6,7 +6,7 @@ import os
...
@@ -6,7 +6,7 @@ import os
from
pydantic_settings
import
SettingsConfigDict
,
BaseSettings
from
pydantic_settings
import
SettingsConfigDict
,
BaseSettings
from
pydantic.networks
import
PostgresDsn
from
pydantic.networks
import
PostgresDsn
from
pydantic
import
field_validator
,
Field
ValidationInfo
,
AnyHttpUrl
,
BaseModel
,
EmailStr
from
pydantic
import
field_validator
,
ValidationInfo
,
AnyHttpUrl
,
BaseModel
,
EmailStr
# For more information how BaseSettings work, check the documentation:
# For more information how BaseSettings work, check the documentation:
...
@@ -60,7 +60,7 @@ class DatabaseConfig(BaseModel):
...
@@ -60,7 +60,7 @@ class DatabaseConfig(BaseModel):
CONNECTION_STR
:
PostgresDsn
|
None
=
None
CONNECTION_STR
:
PostgresDsn
|
None
=
None
@field_validator
(
'
CONNECTION_STR
'
,
mode
=
'
before
'
)
@field_validator
(
'
CONNECTION_STR
'
,
mode
=
'
before
'
)
def
build_connection_string
(
cls
,
v
:
str
|
None
,
info
:
Field
ValidationInfo
)
->
PostgresDsn
:
def
build_connection_string
(
cls
,
v
:
str
|
None
,
info
:
ValidationInfo
)
->
PostgresDsn
:
assert
info
.
config
is
not
None
assert
info
.
config
is
not
None
if
isinstance
(
v
,
str
):
if
isinstance
(
v
,
str
):
...
@@ -88,7 +88,7 @@ class EmailConfig(BaseModel):
...
@@ -88,7 +88,7 @@ class EmailConfig(BaseModel):
@field_validator
(
'
ENABLED
'
,
mode
=
'
before
'
)
@field_validator
(
'
ENABLED
'
,
mode
=
'
before
'
)
@classmethod
@classmethod
def
get_emails_enabled
(
cls
,
v
:
str
|
None
,
info
:
Field
ValidationInfo
)
->
bool
:
def
get_emails_enabled
(
cls
,
v
:
str
|
None
,
info
:
ValidationInfo
)
->
bool
:
assert
info
.
config
is
not
None
assert
info
.
config
is
not
None
return
bool
(
return
bool
(
info
.
data
.
get
(
'
SMTP_HOST
'
)
info
.
data
.
get
(
'
SMTP_HOST
'
)
...
@@ -135,7 +135,7 @@ class Settings(BaseSettings):
...
@@ -135,7 +135,7 @@ class Settings(BaseSettings):
@field_validator
(
'
LOGGING_CONF
'
,
mode
=
'
before
'
)
@field_validator
(
'
LOGGING_CONF
'
,
mode
=
'
before
'
)
@classmethod
@classmethod
def
get_emails_enabled
(
cls
,
v
:
dict
[
str
,
Any
]
|
None
,
info
:
Field
ValidationInfo
)
->
dict
[
str
,
Any
]:
def
get_emails_enabled
(
cls
,
v
:
dict
[
str
,
Any
]
|
None
,
info
:
ValidationInfo
)
->
dict
[
str
,
Any
]:
assert
info
.
config
is
not
None
assert
info
.
config
is
not
None
if
isinstance
(
v
,
dict
):
if
isinstance
(
v
,
dict
):
...
...
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