[chatgpt] startegy add prepare method
π 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.
I think it is not same to accelerate, accelerate know also have trainer
εε²δΈηδ»ε€©εηεͺδΊε€§δΊοΌ
Bot detected the issue body's language is not English, translate it automatically. π―ππ»π§βπ€βπ§π«π§πΏβπ€βπ§π»π©πΎβπ€βπ¨πΏπ¬πΏ
What major events happened today in history?