-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Simplify and clarify enable/disable behavior of spacy.load() #11459
Simplify and clarify enable/disable behavior of spacy.load() #11459
Conversation
… config options. Extend error message on conflict. Add warning message in case of overwriting config option with arguments.
…g of enable/disable.
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.
This looks like the best solution to me, and at least provides some helpful warnings to guide users to the correct usage of this functionality.
I agree, but is it really more correct than checking if it's an empty |
Are all empty instances identical? I mean, what if a user specifically calls the function with an empty Apart from that argument, there's also a worry of maintainability - if we ever do change the default to |
…used values are default value.
Yeah, I agree.
Not via equality, but via identity. The latest commit includes a suggestion for how we could do this, based on your idea of a private global variable and |
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.
This looks good to me. Still trying to think of a decent name though. Maybe _DEFAULT_EMPTY_PIPES
? We'd never have one default which contained actual pipe names, because then we couldn't reuse this var across disable
, enable
and exclude
.
Some load functions used SimpleFrozenList() directly instead of the _DEFAULT_EMPTY_PIPES parameter. That mostly worked as intended, but the changes in explosion#11459 check for equality using identity, not value, so a warning is incorrectly raised sometimes, as in explosion#11706. This change just has all the load functions use the singleton value instead.
* Fix default parameters for load functions Some load functions used SimpleFrozenList() directly instead of the _DEFAULT_EMPTY_PIPES parameter. That mostly worked as intended, but the changes in #11459 check for equality using identity, not value, so a warning is incorrectly raised sometimes, as in #11706. This change just has all the load functions use the singleton value instead. * Add test that there are no warnings on module-based load This will succeed due to changes in this branch, but local tests with the latest release failed as intended. * Try reverting commit and see if CI changes There is an error in CI that is probably unrelated. Revert "Fix default parameters for load functions" This reverts commit dc46b35. * Revert "Try reverting commit and see if CI changes" This reverts commit 2514ed0. Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
…osion#11713) * Fix default parameters for load functions Some load functions used SimpleFrozenList() directly instead of the _DEFAULT_EMPTY_PIPES parameter. That mostly worked as intended, but the changes in explosion#11459 check for equality using identity, not value, so a warning is incorrectly raised sometimes, as in explosion#11706. This change just has all the load functions use the singleton value instead. * Add test that there are no warnings on module-based load This will succeed due to changes in this branch, but local tests with the latest release failed as intended. * Try reverting commit and see if CI changes There is an error in CI that is probably unrelated. Revert "Fix default parameters for load functions" This reverts commit dc46b35. * Revert "Try reverting commit and see if CI changes" This reverts commit 2514ed0. Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
…osion#11713) * Fix default parameters for load functions Some load functions used SimpleFrozenList() directly instead of the _DEFAULT_EMPTY_PIPES parameter. That mostly worked as intended, but the changes in explosion#11459 check for equality using identity, not value, so a warning is incorrectly raised sometimes, as in explosion#11706. This change just has all the load functions use the singleton value instead. * Add test that there are no warnings on module-based load This will succeed due to changes in this branch, but local tests with the latest release failed as intended. * Try reverting commit and see if CI changes There is an error in CI that is probably unrelated. Revert "Fix default parameters for load functions" This reverts commit dc46b35. * Revert "Try reverting commit and see if CI changes" This reverts commit 2514ed0. Co-authored-by: Adriane Boyd <adrianeboyd@gmail.com>
Description
As brought up in #11443, the current behavior of
spacy.load()
w.r.t.enable
,disable
and theenabled
/disabled
options in the config is opaque and inconvenient to work around in case of a conflict. This PRenable
/disable
values passed tospacy.load()
take precedence over config values, i.e. config values are overwritten if function arguments are passed, andTypes of change
Enhancement (maybe fix?).
Checklist