Skip to content

refactor(core): Move context recovery logic strictly to the NeMo layer#19

Merged
Leahlijuan merged 12 commits intomainfrom
refactor/context
Feb 4, 2026
Merged

refactor(core): Move context recovery logic strictly to the NeMo layer#19
Leahlijuan merged 12 commits intomainfrom
refactor/context

Conversation

@Leahlijuan
Copy link
Collaborator

  • Extracts context recovery logic from DefaultMLFlashpointCheckpointLoader

  • Introduces _get_extra_local_objects and _get_extra_needed_objects to DefaultMLFlashpointCheckpointLoader

  • Updates NeMo wrapper to instantiate the new NeMoMLFlashpointCheckpointLoader

- Extracts context recovery logic from DefaultMLFlashpointCheckpointLoader

- Introduces _get_extra_local_objects and _get_extra_needed_objects to DefaultMLFlashpointCheckpointLoader

- Updates NeMo wrapper to instantiate the new NeMoMLFlashpointCheckpointLoader
@Leahlijuan Leahlijuan marked this pull request as draft January 29, 2026 21:04
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Leahlijuan, 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 significantly refactors the checkpoint loading architecture by isolating framework-specific context recovery logic into a dedicated NeMo component. This enhances modularity and makes the core checkpoint loader more extensible, providing clear interfaces for specialized behaviors. The change ensures that NeMo's context recovery is managed precisely within its own layer, streamlining the overall design and maintainability.

Highlights

  • Refactored Context Recovery: The logic responsible for recovering context directories during checkpoint loading has been extracted from the generic DefaultMLFlashpointCheckpointLoader and moved into a new, specialized NeMoMLFlashpointCheckpointLoader.
  • Introduced Extension Points: The DefaultMLFlashpointCheckpointLoader now includes two new protected methods, _get_extra_local_objects and _get_extra_needed_objects, which serve as hooks for subclasses to define their own additional object recovery logic.
  • NeMo-Specific Loader Implementation: A new class, NeMoMLFlashpointCheckpointLoader, has been created. It inherits from DefaultMLFlashpointCheckpointLoader and overrides the newly introduced extension points to implement the NeMo-specific context recovery behavior.
  • Updated NeMo Integration: The NeMo wrapper has been updated to instantiate and utilize the NeMoMLFlashpointCheckpointLoader, ensuring that NeMo-related context recovery is handled by its dedicated implementation.
  • Test Refactoring: Existing tests related to context recovery in the core checkpoint loader have been removed, and new, specific tests for the NeMoMLFlashpointCheckpointLoader have been added to validate its functionality.

🧠 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.

Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 refactors the context recovery logic out of the DefaultMLFlashpointCheckpointLoader and into a new, NeMo-specific NeMoMLFlashpointCheckpointLoader. This is a great improvement as it separates the core logic from framework-specific implementations, making the base loader more generic and extensible. The changes are well-implemented, introducing hooks in the base class and moving the specific logic to the subclass. The tests have also been refactored accordingly, with new tests for the new class and removal of the old ones. I have one suggestion for a minor performance improvement and a typo fix in a comment in the new NeMoMLFlashpointCheckpointLoader.

@Leahlijuan
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 effectively refactors the NeMo-specific context recovery logic out of the core DefaultMLFlashpointCheckpointLoader and into a new NeMoMLFlashpointCheckpointLoader. This is a solid architectural improvement that enhances modularity and separation of concerns. The use of _get_extra_local_objects and _get_extra_needed_objects as hooks in the base class is a clean application of the Template Method design pattern. The new logic is also well-covered by new unit tests. Overall, this is a high-quality refactoring. I have one minor suggestion for consistency.

@Leahlijuan
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 effectively refactors the context recovery logic from the generic DefaultMLFlashpointCheckpointLoader into a specialized NeMoMLFlashpointCheckpointLoader. This is a solid architectural improvement that enhances modularity by separating core logic from framework-specific implementations. The introduction of _get_extra_local_objects and _get_extra_needed_objects as hooks in the base class is a clean way to allow for such extensions. The corresponding tests have been correctly moved and updated to reflect these changes. I have a couple of minor suggestions in the comments and tests to improve clarity.

@Leahlijuan Leahlijuan marked this pull request as ready for review February 3, 2026 15:39
@Leahlijuan Leahlijuan self-assigned this Feb 3, 2026
@Leahlijuan Leahlijuan requested review from g-husam and kkkapu February 3, 2026 16:44
Leahlijuan and others added 3 commits February 3, 2026 22:16
Clarifying where the improved read/write speedups were exactly. Also
adding note on infra-agnosticism, and removing the WIP label from the
doc site.
@Leahlijuan Leahlijuan merged commit 066f2a3 into main Feb 4, 2026
5 checks passed
@Leahlijuan Leahlijuan deleted the refactor/context branch February 4, 2026 14:49
Leahlijuan added a commit that referenced this pull request Feb 4, 2026
#19)

- Extracts context recovery logic from
DefaultMLFlashpointCheckpointLoader

- Introduces _get_extra_local_objects and _get_extra_needed_objects to
DefaultMLFlashpointCheckpointLoader

- Updates NeMo wrapper to instantiate the new
NeMoMLFlashpointCheckpointLoader

---------

Co-authored-by: g-husam <husameldawi@google.com>
Leahlijuan added a commit that referenced this pull request Feb 4, 2026
#19)

- Extracts context recovery logic from
DefaultMLFlashpointCheckpointLoader

- Introduces _get_extra_local_objects and _get_extra_needed_objects to
DefaultMLFlashpointCheckpointLoader

- Updates NeMo wrapper to instantiate the new
NeMoMLFlashpointCheckpointLoader

---------

Co-authored-by: g-husam <husameldawi@google.com>
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.

2 participants