-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Introduce Generative Recommenders (GRs) Tutorial with HSTU Architecture #2210
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
Summary of ChangesHello @LakshmiKalaKadali, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a comprehensive tutorial for Generative Recommenders (GRs), specifically showcasing the Hierarchical Sequential Transduction Unit (HSTU) architecture. The tutorial provides an end-to-end example, from data loading and preprocessing using the MovieLens 1M dataset to the implementation of the core HSTU model components, and finally, training, evaluation, and inference. It aims to demonstrate how GRs reformulate recommendation tasks as sequential transduction, offering a scalable alternative to traditional Deep Learning Recommendation Models (DLRMs). Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a well-structured and comprehensive tutorial for Generative Recommenders using the HSTU architecture. The code is clear and follows the paper's implementation closely. I've provided a few suggestions to improve code efficiency and adhere more closely to Keras 3 best practices, such as optimizing the data loading pipeline and using backend-agnostic APIs.
| """ | ||
| Creates a tf.data.Dataset for training the Keras model. | ||
| """ | ||
| processed_df = load_and_process_data(dataset_name) |
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.
This function loads data on every call, which is inefficient. The data is loaded once before this function is called (to get VOCAB_SIZE), and then again for both training and validation dataset creation. To optimize this, you can refactor the function to accept a pre-loaded DataFrame.
This would involve:
- Changing the function signature at line 93 to
def create_tf_dataset(processed_df, batch_size, max_seq_len, num_targets=1):. - Removing this line (
processed_df = load_and_process_data(dataset_name)). - Updating the call sites at lines 482 and 533 to pass the
processed_dfDataFrame.
7e05401 to
79b85b6
Compare
This PR adds a tutorial demonstrating the implementation and core concepts of Generative Recommenders (GRs), leveraging the novel Hierarchical Sequential Transduction Unit (HSTU) architecture.