-
Notifications
You must be signed in to change notification settings - Fork 50
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
[QST] How to use pretrained embeddings as features in DLRM? #1013
Comments
if you want to see how you can customize DLRM building blocks you can refer to this example: https://github.com/NVIDIA-Merlin/models/blob/main/examples/06-Define-your-own-architecture-with-Merlin-Models.ipynb
|
@rynak Thank you that's a very helpful lead. I'll look at the embeddings to the embedding layer. |
Hi @rnyak, Thanks for the example. I am trying to use embedding vectors from NLP and from CV models. The problem is that these extracted features are sometimes available for each item and sometimes not. I see from the example that if the
So Thanks for your help in advance! |
Hi, have you found a way to pass precomputed embeddings to the model? I have a very similar case and I cannot understasnd whether it is possible to just use the nvtabular Workflow or other methods to pass both user embeddings and item embeddings. For both I have a 1024 elements array associated with user or item respectively. I believe that these kind of inputs could be of very great help for the model performance but there are lot of memory issues as with ~3M rows this explodes quickly. The merlin-tensorflow documentation is missing this kind of examples, rather it associates the embeddings to the |
Hi @CarloNicolini , yes solved the problem. Just follow this example. If the embedding table is large, you have the option not to move it to the GPU, only in batches during training (see the 2nd case in the notebook). Keep in mind that the 0th index of the embedding table should be a full 0. vector which will correspond to unknown IDs. If there are multiple features corresponding to the same embedding table, you can make the embedding table shared for those features with this syntax:
You can verify that the features share the embedding table by checking the schema DataFrame. I hope this helps. |
In my case I have the remapped values from categorify starting from 3 (reading the |
@CarloNicolini I was also thinking about the same after reading this issue. However, the example I shared only adds one row. @rnyak could you please comment on this? |
I've experimented and checked thoroughly the values using |
@CarloNicolini we did not test the Pretrained embedding features with
if you apply Categorify op on a categorical column, we allocate |
Thanks for your feedback! By the way, this kind of operations strongly call for the need of a |
@CarloNicolini thanks. Currently we do not have bandwidth to add extra features to the library. If you are interested in, feel free to open a PR. |
❓ Questions & Help
I'm a beginner with Merlin Models. I'm setting up a DLRM model, with 3 types of input features:
For simplicity, we can assume we have a data frame with columns
user_id, item_id, categorical_1, continuous_1, embeddings_user, embeddings_item
.(1) and (2) are straightforward to add to the architecture via simply using the right tags and nvt.ops. However, I'm not sure how one could add in the
embeddings_1
. Is the right approach just to define a custom architecture using the merlin provided blocks? I would prefer theseembeddings_1
to be trainable if possible.Or is there a quicker way to use them with
DLRM
via the right nvtabular ops and tags? Thanks!The text was updated successfully, but these errors were encountered: