tensorflow / tensorflow/recommenders
Model implementation details leak outside the model
@maciejkula is already working on this.
Since Oct 6, 2020.
- Dominant language
- Python
- Stars
- 2k
- Forks
- 300
- PR merge metrics
- No merged PRs in 30d
Description
Since the base Model class doesn't implement (at least a placeholder for) the call() method, other parts of the library can't rely on that method being defined. As a result, the details of how to compute predictions from a model show up in multiple other places:
- The example model evaluation
- The retrieval task
- The topk layers (1, 2)
- The topk metrics
There are two flavors represented among those examples:
- Those with one-to-one relationships between query embeddings and candidate embeddings (like the topK metrics) that are implemented with element-wise products
- Those with many-to-many relationships between query embeddings and candidate embeddings (like the retrieval task) that are implemented with
matmuls
In order to consolidate the prediction code and abstract the way predictions are computed, it seems like these two modes could either be captured in a single Model method with a flag that selects between element-wise pairs and batch predictions, or represented as two Model methods.
Thoughts?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.