Repository navigation
Conversation
Training examples that follow the documented format pass both ner_labels and ner_negatives. The predefined list replaced the negatives, and bi-encoders read the unused key ner_label, so the published label set never reached the model. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
The training guide explicitly says:
Its example sets both
ner_labelsandner_negatives.batch_generate_class_mappingskept onlyner_labels, so the documented negatives never became candidates.On the docs example (
organization/person/date/locationplus negativesproduct,event,money), a uni-encoder mapping was:Bi-encoders looked up
ner_label(singular). The documented keyner_labelswas ignored, so an example whose gold span was onlyorganizationand whosener_labelswere["organization", "person", "location"]trained as:Relation labels had the same split:
rel_labelswas kept andrel_negativeswas dropped (['works_at']instead ofworks_at+founded).What changed
Predefined label lists still replace randomly sampled in-batch negatives. Explicit
ner_negatives/rel_negativesare appended, and duplicates keep the first occurrence so class ids stay contiguous. Bi-encoders readner_labels, and still accept the oldner_labelkey.For per-example uni-encoder and relation mappings, class ids of an existing label list stay
1..n; explicit negatives get the following ids. Bi-encoder candidate ordering keeps its existing shuffled shared-batch behavior, but the candidates now come from the documentedner_labelsset. Saved checkpoints are unchanged. Examples that set onlyner_labelskeep the same candidates.How verified
Python 3.12, from the clone:
34 passed. Ruff reported no issues.
tests/test_empty_ner.pystill covers emptyner_labelsandner_negativeswithoutner_labels.