Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
scripta
eScriptorium
Commits
590ba2d8
Commit
590ba2d8
authored
Sep 15, 2020
by
Robin Tissot
Browse files
Attempt to bypass batching recognition training.
parent
42e506c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/apps/core/tasks.py
View file @
590ba2d8
...
...
@@ -16,8 +16,10 @@ from celery import shared_task
from
celery.signals
import
before_task_publish
,
task_prerun
,
task_success
,
task_failure
from
django_redis
import
get_redis_connection
from
easy_thumbnails.files
import
get_thumbnailer
from
kraken.lib
import
default_specs
from
kraken.lib
import
train
as
kraken_train
from
users.consumers
import
send_event
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -350,6 +352,8 @@ def train_(qs, document, transcription, model=None, user=None):
DEVICE
=
getattr
(
settings
,
'KRAKEN_TRAINING_DEVICE'
,
'cpu'
)
LOAD_THREADS
=
getattr
(
settings
,
'KRAKEN_TRAINING_LOAD_THREADS'
,
0
)
hyper_params
=
default_specs
.
RECOGNITION_HYPER_PARAMS
.
copy
()
hyper_params
[
'batch_size'
]
=
1
trainer
=
(
kraken_train
.
KrakenTrainer
.
recognition_train_gen
(
device
=
DEVICE
,
load
=
load
,
...
...
@@ -357,9 +361,10 @@ def train_(qs, document, transcription, model=None, user=None):
format_type
=
None
,
training_data
=
training_data
,
evaluation_data
=
evaluation_data
,
resize
=
'
both
'
,
resize
=
'
add
'
,
threads
=
LOAD_THREADS
,
augment
=
True
,
hyper_params
=
hyper_params
,
load_hyper_parameters
=
True
))
def
_print_eval
(
epoch
=
0
,
accuracy
=
0
,
chars
=
0
,
error
=
0
,
val_metric
=
0
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment