Skip to content

Commit

Permalink
Regression in pretraining
Browse files Browse the repository at this point in the history
legacy polygon status flag would cause crash in pretraining without
explicit validation set. Fixes #626.
  • Loading branch information
mittagessen committed Jul 23, 2024
1 parent e82ee4d commit 4730c5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions kraken/lib/pretrain/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ def __init__(self,
self.train_set, self.val_set = random_split(train_set, (train_len, val_len))

if format_type == 'binary':
legacy_train_status = train_set.legacy_polygons_status
if val_set and val_set.legacy_polygons_status != legacy_train_status:
legacy_train_status = self.train_set.dataset.legacy_polygons_status
if self.val_set.dataset.legacy_polygons_status != legacy_train_status:
logger.warning('Train and validation set have different legacy '
f'polygon status: {legacy_train_status} and '
f'{val_set.legacy_polygons_status}. Train set '
f'{self.val_set.dataset.legacy_polygons_status}. Train set '
'status prevails.')
if legacy_train_status == "mixed":
logger.warning('Mixed legacy polygon status in training dataset. Consider recompilation.')
Expand Down
6 changes: 3 additions & 3 deletions kraken/lib/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,11 @@ def __init__(self,
'command. Please add valid XML, line, or binary data.')

if format_type == 'binary':
legacy_train_status = train_set.legacy_polygons_status
if val_set and val_set.legacy_polygons_status != legacy_train_status:
legacy_train_status = self.train_set.dataset.legacy_polygons_status
if self.val_set.dataset.legacy_polygons_status != legacy_train_status:
logger.warning('Train and validation set have different legacy '
f'polygon status: {legacy_train_status} and '
f'{val_set.legacy_polygons_status}. Train set '
f'{self.val_set.dataset.legacy_polygons_status}. Train set '
'status prevails.')
if legacy_train_status == "mixed":
logger.warning('Mixed legacy polygon status in training dataset. Consider recompilation.')
Expand Down

0 comments on commit 4730c5e

Please sign in to comment.