feat(medcat): CU-869d9n2rg Avoid running pipe twice for supervised training#467
Open
mart-r wants to merge 15 commits into
Open
feat(medcat): CU-869d9n2rg Avoid running pipe twice for supervised training#467mart-r wants to merge 15 commits into
mart-r wants to merge 15 commits into
Conversation
adam-sutton-1992
approved these changes
May 14, 2026
Contributor
adam-sutton-1992
left a comment
There was a problem hiding this comment.
LGTM. Should be a big speedup.
One minor question below.
Comment on lines
+422
to
+427
| ent = self._pipeline.entity_from_tokens_in_doc(tkns, doc) | ||
| # avoid setting CUI so as to not show our hand | ||
| raw_name = ann['value'].lower().replace( | ||
| " ", self.cdb.config.general.separator) | ||
| ent.detected_name = raw_name | ||
| ents.append(ent) |
Contributor
There was a problem hiding this comment.
As in the correct CUI isn't already set when performing training?
Collaborator
Author
There was a problem hiding this comment.
You're right - it doesn't matter. Even in the previous case this would have already gone through the pipe. Might as well add that as well.
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.
This PR separates the callers used for supervised and self-supervised training.
The self-supervised training will run the entire pipe.
And the supervised training only runs the tokenizer.
Along the way also fixed up a few minor things
Original(ish) description
If all goes well this just works out of the box.EDIT:
Looks like it's not working since the linker unsupervised training needs the NER step to have run because otherwise it doesn't know what entities to train on. Need to figure out a solution for that.