Migrate node2vec_movielens keras2 code to keras3#2278
Migrate node2vec_movielens keras2 code to keras3#2278sachinprasadhs merged 8 commits intokeras-team:masterfrom
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 updates the node2vec_movielens tutorial to be fully compatible with Keras 3. The core changes involve adapting the data loading pipeline, implementing a custom skip-gram generation method, and refactoring model components and utility functions to utilize Keras 3's backend-agnostic keras.ops API. This ensures the tutorial can run seamlessly across JAX, PyTorch, and TensorFlow backends, enhancing its versatility and future-proofing. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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.
Code Review
This pull request successfully migrates the node2vec example from Keras 2 to Keras 3, making it backend-agnostic. The changes are well-structured, replacing tf.data.Dataset with keras.utils.PyDataset and implementing a manual skip-gram generation function. I've identified a critical issue regarding input shapes in the model, a high-severity issue in the negative sampling logic, and a couple of medium-severity suggestions for performance and documentation. Overall, this is a great update.
sachinprasadhs
left a comment
There was a problem hiding this comment.
Added my review comment, please address it.
|
Address Gemini comments and also delete ml-latest-small dir and all it's files and also remove .zip file which is committed. |
sachinprasadhs
left a comment
There was a problem hiding this comment.
Just 2 small comments.
|
|
This PR migrates the Graph representation learning with node2vec tutorial from Keras 2 to Keras 3. The implementation is now fully backend-agnostic, supporting JAX, PyTorch, and TensorFlow backends. gist
The major changes are:
Data Pipeline:
Replaced the tf.data.Dataset pipeline with keras.utils.PyDataset.
This ensures the data loading process is thread-safe and avoids "Symbolic Tensor" errors when running on JAX or PyTorch.
Custom Skip-gram Generation:
Since keras.preprocessing.sequence.skipgrams is no longer available in Keras 3, I implemented a NumPy-based manual_skipgrams utility. This maintains the tutorial's logic while remaining compatible with the new Keras 3 structure.