Skip to content

[gemini] support save state dict in shards#3581

Merged
ver217 merged 6 commits intohpcaitech:mainfrom
ver217:feature/gemini-shard-sd
Apr 17, 2023
Merged

[gemini] support save state dict in shards#3581
ver217 merged 6 commits intohpcaitech:mainfrom
ver217:feature/gemini-shard-sd

Conversation

@ver217
Copy link
Copy Markdown
Contributor

@ver217 ver217 commented Apr 17, 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

📝 What does this PR do?

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

Support save state dict in shards and add corresponding test. This will save peak memory usage compared to gathering the whole state dict then sharding.

Usage:

model = ZeroDDP(model, ...)

for shard in model.state_dict_shard(max_shard_size=1024):
    # save the shard
    pass

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

@ver217 ver217 added Run Build and Test gemini related to the gemini feature labels Apr 17, 2023
@ver217 ver217 requested review from 1SAA and FrankLeeeee April 17, 2023 07:29
@ver217 ver217 self-assigned this Apr 17, 2023
@ver217 ver217 merged commit f313bab into hpcaitech:main Apr 17, 2023
@ver217 ver217 deleted the feature/gemini-shard-sd branch April 17, 2023 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gemini related to the gemini feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants