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.
Related to #410
Tried on local (MacOS) with python3.10 - works fine
Tried on a fresh Ubuntu with python3.10 - works fine
Tried on Ubuntu with python3.11 - verified the issue
Checked the depdenency versions on Ubuntu - they were near identical (only differences being
async-timeout==4.0.3
andexceptiongroup==1.2.0
additions in 3.10).It seems to have to do with something with pickling the partial function. Perhaps the performance enhancements in 3.11 broke something?
I've verified that the config.linking.weighted_average_function value is a
functools.partial
and it has a keyword argumentfactor=0.0004
in python3.11.So what this PR does:
config.linking.weighted_average_function
__init__
functools.partial
withargs
and/irkwargs
tomedcat.config.weighted_average
is usedpartial
ofmedcat.config.weighted_average
the fix failsThis fix is only really able to remedy the default
medcat.config.weighted_average
method based values. Otherwise it's not straight forward to figure out what the underlying method may be.With that said, all this PR does is apply a patch for the issue at hand. I still don't fully understand why this happens. Though I did verify that this seems to be a broader issue of saving using
dill
to dumpfunctools.partial
methods in older python (up to and including 3.10) and subsequently loading them in newer python (3.11+). I also verified that the issue does not seem to exist if you do the same within the same python version (be it 3.10 or 3.11).