Skip to content

Conversation

kharshith-k
Copy link

Added DLRM.ipynb and generated dlrm.py

Copy link
Collaborator

@abheesht17 abheesht17 left a 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 of torch.nn.Embedding. Apparently, torch.nn.EmbeddingBag is more efficient than torch.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!

@abheesht17
Copy link
Collaborator

@kharshith-k - let me know when this is ready for another round of review. Thanks!

@kharshith-k
Copy link
Author

kharshith-k commented Jul 29, 2025

@kharshith-k - let me know when this is ready for another round of review. Thanks!
@abheesht17 - The changes are ready for review. Please let me know if any more changes would be required. Thanks!

@kharshith-k kharshith-k reopened this Jul 29, 2025
Copy link
Collaborator

@abheesht17 abheesht17 left a 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)

@kharshith-k
Copy link
Author

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!

Copy link
Collaborator

@abheesht17 abheesht17 left a 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!

Comment on lines +193 to +194
"download_config": tfds.download.DownloadConfig(
verify_ssl=False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

Copy link
Author

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?

Comment on lines +251 to +253
normalization_layers = {}
for feature_name in MOVIELENS_CONFIG["continuous_features"]:
normalization_layers[feature_name] = keras.layers.Normalization(axis=-1)
Copy link
Collaborator

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

Copy link
Author

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

Comment on lines +337 to +346
# 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),
]
)
Copy link
Collaborator

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants