-
Notifications
You must be signed in to change notification settings - Fork 254
Add option to remove duplicate samples in training #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -683,6 +683,18 @@ def sentence_pairs_generation_cos_sim(sentences, pairs, cos_sim_matrix): | |
| return pairs | ||
|
|
||
|
|
||
| def sentence_pairs_remove_duplicates(sentences: List[InputExample]): | ||
| key_pairs = set() | ||
| rm_duplicate_sentences = [] | ||
| for s in sentences: | ||
| key = tuple(sorted(s.texts)) | ||
| if key not in key_pairs: | ||
| key_pairs.add(key) | ||
| if key[0] != key[1]: | ||
| rm_duplicate_sentences.append(s) | ||
| return rm_duplicate_sentences | ||
|
Comment on lines
+686
to
+695
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. Tbh I wrote these changes ages ago but only got round to evaluating on public dataset/ PR yesterday. I can run some tests again with 2. applied or not, and we can see what the analysis shows. My intuition would say labelling identical pairs wouldn't improve performance, but we can see.. But will hold off until have some resolution about it should be applied (based on your first comment @tomaarsen) 👍 |
||
|
|
||
|
|
||
| class SKLearnWrapper: | ||
| def __init__(self, st_model=None, clf=None): | ||
| self.st_model = st_model | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to add a training time argument here.