-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add ability to extract encoder embedding. #1604
base: master
Are you sure you want to change the base?
Conversation
Added methods to get encoder embedding
Added implementations of methods to get encoder embedding.
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.
Style
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.
so maybe it should expose a method that returns or populates a vector, instead of returning a ggml_tensor?
Yes, populating a buffer with the data would be more portable compared to returning ggml_tensor
:
WHISPER_API void whisper_get_encoder_embedding(float * buffer);
This leads to the question: how can user determine the size of the buffer? In this scenario, we end up with only a float pointer, which points to the buffer we've just filled in |
The buffer size can be determined using the model parameters: Lines 347 to 358 in 2623640
|
Adds the ability to get the encoder output. No other top-level methods expose ggml_tensors though - I'm not sure that's cool. It seemed the quickest way. What I'm doing, eventually, is this:
... so maybe it should expose a method that returns or populates a vector, instead of returning a ggml_tensor? What do you think?