-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Added DLRM notebook and generated python script #2131
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
base: master
Are you sure you want to change the base?
Conversation
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.
Thanks for the PR! Left some comments, let me know what you think :).
Here are some notes for posterity (we don't need to implement these now in this PR):
- We should, in the future, also think about the specific case of how how DLRM implements distributed training. The embeddings are sharded across devices, whereas the MLP layers are DDP'd.
- The paper mentions that they use
torch.nn.EmbeddingBag
instead oftorch.nn.Embedding
. Apparently,torch.nn.EmbeddingBag
is more efficient thantorch.nn.Embedding
followed by some aggregation op. We should think about this at some later point (maybe,keras_rs.embeddings.DistributedEmbedding
solves this). Anyway, we can worry about this later!
Updated docstrings to match the context according to code
@kharshith-k - let me know when this is ready for another round of review. Thanks! |
|
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.
Thanks! Great work, this looks good to me, overall. Just one major comment on using dense features (it isn't DLRM without the two blocks for dense and categorical features)
Delete duplicate dlrm.ipynb
Hi @abheesht17, The changes are ready for review. I've used raw_user_age and timestamp for continuous features. Please let me know if any more changes would be required. Thanks! |
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.
Left a few comments, let's merge this after those are addressed. Thanks!
"download_config": tfds.download.DownloadConfig( | ||
verify_ssl=False, |
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.
Do we need this?
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.
Actually when I tried to download the dataset the other day, I was facing "server SSL certificate expired" error. So, as a work around I had to use this configuration. Should I keep it or remove it?
normalization_layers = {} | ||
for feature_name in MOVIELENS_CONFIG["continuous_features"]: | ||
normalization_layers[feature_name] = keras.layers.Normalization(axis=-1) |
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.
Sorry to be a pain here, but could you extract the hour of day, hour of week from the timestamp, and map it to a unit circle using sin, cos? That's a better way of encoding timestamp
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.
Sure not a problem! I will do the changes accordingly
# Layers for continuous features. | ||
self.continuous_dense_layers = {} | ||
for feature_name in MOVIELENS_CONFIG["continuous_features"]: | ||
# Use a small MLP to process continuous features | ||
self.continuous_dense_layers[feature_name] = keras.Sequential( | ||
[ | ||
keras.layers.Dense(mlp_dim, activation="relu"), | ||
keras.layers.Dense(mlp_dim), | ||
] | ||
) |
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.
Generally, we concatenate all dense features together, and use just one MLP. Let's do that, instead of creating separate MLPs from every dense feature.
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.
Sure!
Added DLRM.ipynb and generated dlrm.py