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
Index - Single Input #161
Comments
Thanks for the feedback, can you provide some more details on the strided slice errors you're seeing? Currently the add_batch method is meant to accept batch sizes >= 1
Regarding initializing the index within |
So if I have an example model built, and the indexer setup I can run this and get the anticipated output;
Out:
All good. But if I select the first entry, and expand dims to give it the batch at the front to make it compat with .predict():
Out:
In my head, they're identical but just batch size = 1, so I'm not sure why the labels[idx] is looking for the 1st element and not the 0th element. Much appreciated, |
Thanks for details Alex. I think the issue might be with your custom SimilarityModelTest(). Would you be able to share more details on the SimilarityModelTest() setup? I'm able to index single examples using the following: Model
Indexing
I'm on the tf.sim 0.14 branch and using:
|
As an example
However, by just swapping Happy to remove the PR I submitted for the Note that the Thanks! |
The embedding_output is meant to tell the indexer which of the output heads we should take as the embedding. If the embedding_output is None, then we take the prediction[0] see indexer.py +186, else if the embedding_output is >= 0 then we assume a multi headed output and take the prediction[embedding_output][0]. |
Hi Alex, I refactored the model class and added a create_index method as part of pull request #164 I think that addresses the issues. Let me know if we can close out your single_index PR. |
Actually, had a chat and support for adding a single embedding would be very helpful. I'll add a few notes on the PR and then we can merge it in. Thanks for taking the time to submit the PR. |
Thanks for explaining that! I've made the requested updates for review! Feel free to close this if you're happy with the PR 👍 |
Thanks! PR looks good. I'll merge once the checks are finished. |
Hello,
The
SimilarityModel.index
method seems to require a batch size greater than 1, as it uses theadd_batch
method from theIndexer
, which appears to cause some strided slice errors.Could we get an update to
index
to check for a batch size of one and use theadd
fromIndexer
instead ofadd_batch
? Or given there's already asingle_lookup
just a new methodsingle_index
if it's preffered?Also as a side-note, is there a reason that the
SimilarityModel._index
is limited to either thecompile
orload_index
methods? I'm using the sub-classing API, and due to custom training loops accommodating dynamic sizes, I never need to callcompile
so had to manually set the_index
when running through the first time without a saved one.Thank you for your time :)
(Note i'm happy to make a small PR to fix it!)
The text was updated successfully, but these errors were encountered: