mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-08 15:55:31 +01:00
Fix: Enforce classifier training ordering to prevent extra training (#8822)
This commit is contained in:
parent
e1dde85c59
commit
fd425aa618
1 changed files with 5 additions and 5 deletions
|
|
@ -170,6 +170,7 @@ class DocumentClassifier:
|
||||||
)
|
)
|
||||||
.select_related("document_type", "correspondent", "storage_path")
|
.select_related("document_type", "correspondent", "storage_path")
|
||||||
.prefetch_related("tags")
|
.prefetch_related("tags")
|
||||||
|
.order_by("pk")
|
||||||
)
|
)
|
||||||
|
|
||||||
# No documents exit to train against
|
# No documents exit to train against
|
||||||
|
|
@ -199,11 +200,10 @@ class DocumentClassifier:
|
||||||
hasher.update(y.to_bytes(4, "little", signed=True))
|
hasher.update(y.to_bytes(4, "little", signed=True))
|
||||||
labels_correspondent.append(y)
|
labels_correspondent.append(y)
|
||||||
|
|
||||||
tags: list[int] = sorted(
|
tags: list[int] = list(
|
||||||
tag.pk
|
doc.tags.filter(matching_algorithm=MatchingModel.MATCH_AUTO)
|
||||||
for tag in doc.tags.filter(
|
.order_by("pk")
|
||||||
matching_algorithm=MatchingModel.MATCH_AUTO,
|
.values_list("pk", flat=True),
|
||||||
)
|
|
||||||
)
|
)
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
hasher.update(tag.to_bytes(4, "little", signed=True))
|
hasher.update(tag.to_bytes(4, "little", signed=True))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue