ColossalAI icon indicating copy to clipboard operation
ColossalAI copied to clipboard

[chatgpt] startegy add prepare method

Open ver217 opened this issue 3 years ago β€’ 3 comments

πŸ“Œ 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
  • [x] 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

NA

πŸ“ What does this PR do?

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

Add prepare() method for Strategy class. This helps users to prepare their models and optimizers easiy based on each strategy.

# when fine-tuning actor and critic
(actor, actor_optim), (critic, critic_optim), reward_model, initial_model = strategy.prepare((actor, actor_optim), (critic, critic_optim), reward_model, initial_model)
# or when training reward model
(reward_model, reward_model_optim) = strategy.prepare((reward_model, reward_model_optim))
# or just inference
actor, critic = strategy.prepare(actor, critic)

πŸ’₯ 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
  • [x] I have performed a self-review of my code
  • [ ] I have added thorough tests.
  • [x] I have added docstrings for all the functions/methods I implemented

⭐️ Do you enjoy contributing to Colossal-AI?

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

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

ver217 avatar Feb 16 '23 09:02 ver217

I think it is not same to accelerate, accelerate know also have trainer

Fazziekey avatar Feb 16 '23 10:02 Fazziekey

εŽ†ε²δΈŠηš„δ»Šε€©ε‘η”Ÿε“ͺδΊ›ε€§δΊ‹οΌŸ

yangtailu avatar Feb 16 '23 14:02 yangtailu

Bot detected the issue body's language is not English, translate it automatically. πŸ‘―πŸ‘­πŸ»πŸ§‘β€πŸ€β€πŸ§‘πŸ‘«πŸ§‘πŸΏβ€πŸ€β€πŸ§‘πŸ»πŸ‘©πŸΎβ€πŸ€β€πŸ‘¨πŸΏπŸ‘¬πŸΏ


What major events happened today in history?

Issues-translate-bot avatar Feb 16 '23 14:02 Issues-translate-bot