Is there any way to inference from hidden layers in SpaCy? #5092
Replies: 1 comment
-
|
This is currently not available out-of-the-box in spaCy, but you could dive into the code to hack together what you need. Currently the Machine Learning architectures are defined in _ml.py, e.g. The machine learning models are created with Thinc. You have something like There's some changes happening though, which may be relevant for you as well. The current spaCy 2.2.x versions rely on Thinc 7.x. However, there's been a complete overhaul of Thinc, and the new 8.0 version was recently released and documented at thinc.ai. We are currently in the process of also upgrading spaCy to use this new Thinc, which will make it much easier to define your own ML models for your pipeline components. Basically you will be able to define them in a config file that refers to registered functions. We are working on this on the develop branch, and you can see such an example config here. We've also moved & restructured the relevant ML code into a package here. So our example Thinc has this mechanism of keeping track of sublayers in a model by setting If you do decide to start poking around on the I'll close this issue as there is no immediate action for us right now, but please feel free to comment / ask further follow up questions and I'll do my best to address them! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to get the hidden layer outputs from the trained classifier in my application.
Is there any way to do that? does SpaCy capable of inference from hidden layers and just to returns sentence embeddings?
Beta Was this translation helpful? Give feedback.
All reactions