-
Notifications
You must be signed in to change notification settings - Fork 5
Add swarm training mode #8
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
Conversation
Removed limitations section and Chinese version from TinkerScript documentation.
…ndling and configuration updates
…handling and episode management
Summary of ChangesHello @binary-husky, 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 novel 'swarm training mode' to AgentJet, fundamentally changing how reinforcement learning for large language models can be conducted. By decoupling the agent's execution logic from the core training loop, it allows for distributed computation where a central GPU server handles model training and inference, while numerous lightweight clients can run agent workflows and report rewards. This architecture significantly enhances flexibility, enabling agent development and rollout on diverse hardware, including machines without GPUs, while still leveraging powerful remote training infrastructure. 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
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 significant new feature: "swarm training mode". This mode enables a client-server architecture for distributed rollouts, allowing agent logic to run on client machines (potentially without GPUs) while the model training and inference are offloaded to a remote server. The changes are extensive and well-structured, touching upon data loading, context tracking, configuration, and the core training loop.
Key changes include:
- Swarm Architecture: Addition of a FastAPI-based swarm server for managing episodes and a Python client library for interacting with it.
- Efficient Data Loading: The task readers have been refactored to use Python generators and
datasets.Dataset.from_generator, which significantly improves memory efficiency for large datasets. - Enhanced Context Tracker: The
BaseTrackernow includes areset()method, making it reusable across multiple episodes, a key requirement for the swarm worker lifecycle. - Lazy Loading: The root
__init__.pynow uses lazy loading to improve the library's initial import time.
Overall, this is a well-executed feature addition that greatly enhances the framework's flexibility. I've identified one critical bug and a couple of areas for improvement related to performance and robustness.
| """ | ||
| assert yaml_path.endswith(".yaml"), "Configuration file must be a YAML file" | ||
| exp_base = os.path.dirname(yaml_path) | ||
| exp_base = os.path.exists(os.path.dirname(yaml_path)) |
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 line appears to contain a bug. os.path.exists() returns a boolean value, but the intention here seems to be to get the directory path of the yaml_path. This will likely lead to a FileNotFoundError in subsequent operations. It should be restored to use os.path.dirname().
| exp_base = os.path.exists(os.path.dirname(yaml_path)) | |
| exp_base = os.path.dirname(yaml_path) |
| # DEBUG = True | ||
| DEBUG = False | ||
| RCVTIMEO = 2 * 1000 | ||
| RCVTIMEO_OUT = 300 * 1000 |
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.
A 5-minute timeout (300 * 1000 ms) for a blocking operation within a server thread is quite long and could pose a risk to server stability. If multiple clients time out, this could lead to thread exhaustion. It's recommended to reduce RCVTIMEO_OUT to a more conservative value, such as 30 seconds, to enhance server responsiveness and prevent resource contention.
| RCVTIMEO_OUT = 300 * 1000 | |
| RCVTIMEO_OUT = 30 * 1000 |
| return True | ||
| if (observation_window["stop"] is not None) and observation_window["stop"][task_thread_index]: # check soft condition | ||
| # if soft condition met, check if episode is claimed | ||
| has_claimed = is_episode_claimed(self.config, workflow_task.episode_uuid) |
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.
The is_episode_claimed function executes an HTTP request to check the episode's status. Since should_interrupt_hard_fn may be called frequently within the rollout loop, these network calls could introduce noticeable latency and impact performance. To mitigate this, consider implementing a caching mechanism with a short time-to-live (TTL) for the result of is_episode_claimed. This would significantly reduce the number of HTTP requests and improve overall efficiency.
No description provided.