mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-01 11:19:32 -05:00
Handles a special case where the classification model exists, but no items are auto matching any longer
This commit is contained in:
parent
ef749f9a29
commit
0640f571a8
@ -65,6 +65,12 @@ def train_classifier():
|
||||
and not Correspondent.objects.filter(matching_algorithm=Tag.MATCH_AUTO).exists()
|
||||
and not StoragePath.objects.filter(matching_algorithm=Tag.MATCH_AUTO).exists()
|
||||
):
|
||||
logger.info("No automatic matching items, not training")
|
||||
# Special case, items were once auto and trained, so remove the model
|
||||
# and prevent its use again
|
||||
if settings.MODEL_FILE.exists():
|
||||
logger.info(f"Removing {settings.MODEL_FILE} so it won't be used")
|
||||
settings.MODEL_FILE.unlink()
|
||||
return
|
||||
|
||||
classifier = load_classifier()
|
||||
|
Loading…
x
Reference in New Issue
Block a user