Fix optimizer states dim(ckpt) of rowwise adagrad#305
Open
jiashuy wants to merge 1 commit intoNVIDIA:mainfrom
Open
Fix optimizer states dim(ckpt) of rowwise adagrad#305jiashuy wants to merge 1 commit intoNVIDIA:mainfrom
jiashuy wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
Collaborator
Author
Greptile OverviewGreptile SummaryThis PR fixes a checkpoint dimension mismatch issue for RowWise AdaGrad optimizer. RowWise AdaGrad stores optimizer states in a reduced dimension at runtime (calculated as
This ensures checkpoint compatibility and prevents dimension mismatches during save/load operations. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant KeyValueTable
participant Optimizer
participant Checkpoint
Note over Caller,Checkpoint: Checkpoint Save Flow
Caller->>KeyValueTable: dump()
KeyValueTable->>Optimizer: get_ckpt_state_dim(emb_dim)
Optimizer-->>KeyValueTable: 1 (for RowWise AdaGrad)
KeyValueTable->>Optimizer: get_state_dim(emb_dim)
Optimizer-->>KeyValueTable: _optim_state_dim (e.g., 4 or 8)
KeyValueTable->>KeyValueTable: truncate opt_states[:, :ckpt_state_dim]
KeyValueTable->>Checkpoint: write truncated states
Note over Caller,Checkpoint: Checkpoint Load Flow
Caller->>KeyValueTable: load()
KeyValueTable->>Optimizer: get_ckpt_state_dim(emb_dim)
Optimizer-->>KeyValueTable: 1 (for RowWise AdaGrad)
KeyValueTable->>Checkpoint: read ckpt_state_dim elements per row
KeyValueTable->>KeyValueTable: create padded tensor with initial_accumulator_value
KeyValueTable->>KeyValueTable: padded[:, :ckpt_state_dim] = loaded_states
KeyValueTable-->>Caller: return padded states
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Checklist