feat(medcat-trainer): Avoid loading meta cat upon model pack upload#567
Merged
mart-r merged 19 commits intoJun 25, 2026
Merged
Conversation
alhendrickson
approved these changes
Jun 25, 2026
alhendrickson
left a comment
Collaborator
There was a problem hiding this comment.
lgtm, should really speed it up
tomolopolis
approved these changes
Jun 25, 2026
Member
There was a problem hiding this comment.
generally dislike the term 'fake' model. either use dummy or example? fake personally sounds like its not a test or perhaps not a model at all, when in fact it is both a real model and even a real model on disk by the looks of it.
| with patch.object(MetaCATAddon, "__init__") as mock_init: | ||
| import_model_pack( | ||
| MODEL_PATH, | ||
| name='fake-test-model', |
Member
|
Lgtm |
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 allows model packs with MetaCATs (and other addons) to be uploaded without the need to load all these addons.
The reason they were previously loaded (though notably addons other than MetaCAT weren't used) was to get some information for meta tasks.
In an ideal world, we'd have all the sufficient information saved in the model card. But alas, we don't.
So what this PR does is load the model pack's config (only) and gets the relevant information from there.
This should save a considerable amount of time (and memory) since loading all these addons (in an ephemral way, no less) can consume a lot of resources and loading just the (admittedly dill-serialised) json should be a lot leaner.
NB! Limitations:
This is currently hard-coded to
dillserialisations of the model pack. While this is currently the only serialisation we provide, this does create tight coupling. So we may need to review this in the future.