-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Replace references to thinc.backends.linalg
in the parser
#11292
Replace references to thinc.backends.linalg
in the parser
#11292
Conversation
Quick note about the failing tests: They continue to fail locally even without my changes 🤔 I'll see if I can fix it. EDIT: PR for the fix. |
…into refactor/replace-thinc-linalg-backend
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.
Nice to have this replace by C BLAS calls. Did you run an evaluation to ensure that there is no regression parsing accuracy? (It all looks correct, but never bad to do a sanity check.)
@@ -561,3 +559,15 @@ cdef void _sum_state_features(CBlas cblas, float* output, | |||
feature = &cached[idx] | |||
saxpy(cblas)(O, one, <const float*>feature, 1, &output[b*O], 1) | |||
token_ids += F | |||
|
|||
cdef inline int _arg_max(const float* scores, const int n_classes) nogil: |
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.
Probably not for this PR, but we have other argmax implementations in spacy/ml/parser_model.pyx
. It would be nice if they were somewhere together.
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.
spacy/ml/parser_model.pyx
is no longer part of the parser codebase post-refactor, right? I can't find it in this branch anymore.
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.
Ah, right, I was looking at the wrong branch. There is another one in spacy/pipeline/_parser_internals/transition_system.pyx
.
Re-tested - can confirm that there is no regression in parsing accuracy. |
Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: #11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: #11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
* Move `thinc.extra.search` to `spacy.pipeline._parser_internals` Backport of: explosion#11317 Co-authored-by: Madeesh Kannan <[email protected]> * Replace references to `thinc.backends.linalg` with `CBlas` Backport of: explosion#11292 Co-authored-by: Madeesh Kannan <[email protected]> * Use cross entropy from `thinc.legacy` * Require thinc>=9.0.0.dev0,<9.1.0 Co-authored-by: Madeesh Kannan <[email protected]>
Description
This PR replaces references to the vestigial
thinc.backend.linalg
module withCBlas
calls and a local function. The aforementioned module will be removed once this PR is merged.Types of change
Refactoring
Checklist