loaded scann index can not use k param
See original GitHub issuehttps://github.com/tensorflow/recommenders/blob/main/docs/examples/basic_retrieval.ipynb
# Export the query model.
with tempfile.TemporaryDirectory() as tmp:
path = os.path.join(tmp, "model")
# Save the index.
index.save(path)
# Load it back; can also be done in TensorFlow Serving.
loaded = tf.keras.models.load_model(path)
# Pass a user id in, get top predicted movie titles back.
scores, titles = loaded(["42"])
print(f"Recommendations: {titles[0][:3]}")
loaded object have not k param,so i can not return k(default 10) than 10 movies?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
Efficient serving with ScaNN for retrieval (Building ... - YouTube
In our earlier videos, we showed you how to use the brute force approach in your retrieval system. In this video, we are...
Read more >Postgres not using index when index scan is much better option
I found out that the query plan does a seq scan on the large table email_activities (~10m rows) while I think using indexes...
Read more >Index Seek scanning whole table dependent on parameter ...
When there is a mismatch between the data types of the column and variable, SQL Server cannot directly use the seeking ability of...
Read more >Force use of index even when index value in where clause is
The optimizer cannot compare "JOHN" against the index entries, ... but since we re-load the entire data on certain fact tables, we cant...
Read more >Indexing for Better Performance - JanusGraph Docs
Mixed indexes can be used for lookups on any combination of indexed keys and ... In the absence of an index, JanusGraph will...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@maciejkula I have two issues concerning the answer you gave above.
First, although I call the functions before creating concrete functions, it still requires me to pass input specs. I got some results using the following snippet but I don’t think it’s the right way to do so:
My second issue was creating a concrete function for
query_with_exclusions. I’ve used the following code:This way I can save and load the index but I can only pass a single exclusion id because its shape is set to (1, 1).
Any idea on how to solve these two issues?
@maciejkula is there a reason why (other than it feeling like a bit of a hack…) you couldn’t just define the argument
kintopK.query_with_exclusionsas atf.Tensorand then just extract the value from that? Would that allow you to define it viaTensorSpecto get a concrete function that allows for multiple values ofkat inference time?