Conversation
Summary of ChangesHello @divyashreepathihalli, 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 comprehensive support for ML Pathways (LeaderWorkerSet) as an alternative backend for keras_remote job execution. It enables users to leverage Pathways for distributed training, particularly for multi-host TPU setups, by providing a new backend implementation, client-side logic for managing LeaderWorkerSet resources, and an updated 'run' decorator with intelligent backend auto-detection. This enhancement expands the capabilities of keras_remote for scalable machine learning workloads on Kubernetes. 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 introduces Pathways integration as a new backend for remote execution, which is a great addition. The changes are well-organized, with a new PathwaysBackend and pathways_client to handle LeaderWorkerSet (LWS) jobs on GKE. The auto-detection of the backend based on the accelerator type in core.py is a nice touch that aligns with the goal of minimizing user configuration. I have a couple of suggestions to improve maintainability and consistency.
JyotinderSingh
left a comment
There was a problem hiding this comment.
Thanks for these changes! Left a few comments.
Also, I'm a little unfamiliar with Pathways, but from my understanding we might need to add a couple of environment variables for collective communication (MEGASCALE_COORDINATOR_ADDRESS, TPU_WORKER_ID, etc.). The leader and worker templates are identical for now, they might need to integrate this information.
| def install_lws(): | ||
| """Install the LeaderWorkerSet custom resource controller. | ||
|
|
||
| This enables Pathways scheduling on the GKE cluster. | ||
| """ | ||
| subprocess.run( | ||
| ["kubectl", "apply", "--server-side", "-f", LWS_INSTALL_URL], | ||
| check=True, | ||
| ) |
There was a problem hiding this comment.
We're not calling this function anywhere.
There was a problem hiding this comment.
ahh, missed adding this to up.py - done
|
Thanks for the review Jyotinder. Updated the code and re-ran the example to verify execution. |
| history = model.fit(x, y, epochs=5, batch_size=32, validation_split=0.2) | ||
|
|
||
| print("\nTraining completed successfully on Pathways!") | ||
| return history.history |
There was a problem hiding this comment.
Just to confirm, there are no user code changes to run on Pathways within their remote function? All it needs is backend="pathways"? That's pretty cool
There was a problem hiding this comment.
yeah if it is None. It auto detects if the user requested for a multi node TPU and picks the pathways backend
| ) | ||
| logger.info(f"Deleted LeaderWorkerSet: {job_name}") | ||
| except ApiException as e: | ||
| if e.status != 404: |
There was a problem hiding this comment.
What if it is 404? Should it be re-raised?
There was a problem hiding this comment.
Updated this. A 404 Not Found during deletion means the LeaderWorkerSet has already been deleted. we should not re raise this as it would crash the clean up routine.
|
Thanks! |
Example execution.

Fixes #19