Skip to content

[checkpointio] Unsharded Optimizer Checkpoint for Gemini Plugin#4141

Merged
Fridge003 merged 2 commits intohpcaitech:mainfrom
Fridge003:feature/optimizer-checkpoint
Jul 7, 2023
Merged

[checkpointio] Unsharded Optimizer Checkpoint for Gemini Plugin#4141
Fridge003 merged 2 commits intohpcaitech:mainfrom
Fridge003:feature/optimizer-checkpoint

Conversation

@Fridge003
Copy link
Copy Markdown
Contributor

@Fridge003 Fridge003 commented Jul 3, 2023

📌 Checklist before creating the PR

  • I have created an issue for this PR for traceability
  • The title follows the standard format: [doc/gemini/tensor/...]: A concise description
  • I have added relevant tags if possible for us to better distinguish different PRs

🚨 Issue number

Link this PR to your issue with words like fixed to automatically close the linked issue upon merge

e.g. fixed #1234, closed #1234, resolved #1234

design: #4140

📝 What does this PR do?

Summarize your work here.
if you have any plots/diagrams/screenshots/tables, please attach them here.

  • Implement the unsharded optimizer checkpointing feature through overloading state_dict()/load_state_dict() methods for ZeroOptimizer.
  • Support compatibility with pytorch model/optimizer checkpoints and add relevant tests.

💥 Checklist before requesting a review

  • I have linked my PR to an issue (instruction)
  • My issue clearly describes the problem/feature/proposal, with diagrams/charts/table/code if possible
  • I have performed a self-review of my code
  • I have added thorough tests.
  • I have added docstrings for all the functions/methods I implemented

⭐️ Do you enjoy contributing to Colossal-AI?

  • 🌝 Yes, I do.
  • 🌚 No, I don't.

Tell us more if you don't enjoy contributing to Colossal-AI.

@Fridge003 Fridge003 requested a review from ver217 July 3, 2023 09:02
@Fridge003 Fridge003 force-pushed the feature/optimizer-checkpoint branch 5 times, most recently from ee09d08 to 4b648c8 Compare July 4, 2023 02:44
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 4, 2023

The code coverage for the changed files is 89%.

Click me to view the complete report
Name                                                    Stmts   Miss  Cover
---------------------------------------------------------------------------
colossalai/booster/plugin/gemini_plugin.py                117     14    88%
colossalai/checkpoint_io/checkpoint_io_base.py             66      9    86%
colossalai/checkpoint_io/general_checkpoint_io.py         107      8    93%
colossalai/checkpoint_io/utils.py                         250     44    82%
colossalai/interface/optimizer.py                          42      6    86%
colossalai/nn/optimizer/cpu_adam.py                        70      4    94%
colossalai/nn/optimizer/fused_adam.py                      57     11    81%
colossalai/nn/optimizer/hybrid_adam.py                     65      3    95%
colossalai/testing/comparison.py                           40      6    85%
colossalai/zero/gemini/gemini_optimizer.py                378     34    91%
tests/test_checkpoint_io/test_gemini_checkpoint_io.py      72      0   100%
---------------------------------------------------------------------------
TOTAL                                                    1264    139    89%

@Fridge003 Fridge003 force-pushed the feature/optimizer-checkpoint branch 4 times, most recently from 7e2028e to 15ecdee Compare July 5, 2023 02:07
Comment thread colossalai/booster/plugin/gemini_plugin.py Outdated
Comment thread colossalai/booster/plugin/gemini_plugin.py
Comment thread colossalai/checkpoint_io/utils.py
Comment thread colossalai/testing/comparison.py Outdated
@Fridge003 Fridge003 force-pushed the feature/optimizer-checkpoint branch from 15ecdee to 167dabd Compare July 5, 2023 08:47
Comment thread colossalai/zero/gemini/gemini_optimizer.py Outdated
Comment thread colossalai/zero/gemini/gemini_optimizer.py Outdated
Comment thread colossalai/zero/gemini/gemini_optimizer.py
Comment thread colossalai/zero/gemini/gemini_optimizer.py Outdated
Comment thread colossalai/zero/gemini/gemini_optimizer.py Outdated
Comment thread colossalai/zero/gemini/gemini_optimizer.py Outdated
@Fridge003 Fridge003 force-pushed the feature/optimizer-checkpoint branch 5 times, most recently from e861b71 to e2abdb1 Compare July 6, 2023 09:17
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 6, 2023

The code coverage for the changed files is 89%.

Click me to view the complete report
Name                                                        Stmts   Miss  Cover
-------------------------------------------------------------------------------
colossalai/booster/plugin/gemini_plugin.py                    114     12    89%
colossalai/checkpoint_io/checkpoint_io_base.py                 66      9    86%
colossalai/checkpoint_io/general_checkpoint_io.py             107      8    93%
colossalai/checkpoint_io/utils.py                             250     44    82%
colossalai/interface/optimizer.py                              42      5    88%
colossalai/nn/optimizer/cpu_adam.py                            70      4    94%
colossalai/nn/optimizer/fused_adam.py                          57     11    81%
colossalai/nn/optimizer/hybrid_adam.py                         65      3    95%
colossalai/testing/comparison.py                               77     21    73%
colossalai/zero/gemini/gemini_optimizer.py                    358     34    91%
tests/test_checkpoint_io/test_gemini_checkpoint_io.py          84      0   100%
tests/test_checkpoint_io/test_gemini_torch_compability.py     116      0   100%
-------------------------------------------------------------------------------
TOTAL                                                        1406    151    89%

Comment thread tests/test_checkpoint_io/test_gemini_checkpoint_io.py
Comment thread tests/test_checkpoint_io/test_gemini_torch_compability.py
@Fridge003 Fridge003 force-pushed the feature/optimizer-checkpoint branch from e2abdb1 to a3f72bf Compare July 7, 2023 04:59
@Fridge003 Fridge003 force-pushed the feature/optimizer-checkpoint branch from a3f72bf to 6cb7920 Compare July 7, 2023 07:38
@Fridge003
Copy link
Copy Markdown
Contributor Author

截屏2023-07-07 14 36 13

@Fridge003
Copy link
Copy Markdown
Contributor Author

截屏2023-07-07 16 29 44

@Fridge003 Fridge003 merged commit 5891344 into hpcaitech:main Jul 7, 2023
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