# Using Transformers with DistributedDataParallel — any examples?

**URL:** <https://discuss.huggingface.co/t/using-transformers-with-distributeddataparallel-any-examples/10775>\
**Category:** Intermediate\
**Created:** [October 14, 2021, 2:33pm UTC](https://discuss.huggingface.co/t/using-transformers-with-distributeddataparallel-any-examples/10775 "2021-10-14T14:33:51Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![brando](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/brando/32/30114_2.png) [@brando](https://discuss.huggingface.co/u/brando)\
**Post date:** [August 17, 2022, 2:29pm UTC](https://discuss.huggingface.co/t/using-transformers-with-distributeddataparallel-any-examples/10775/8 "2022-08-17T14:29:33Z")

</div>

can you share the command you ran? and summarize what you did please? 🙂 @treeofknowledge

* * *

this discussion is slightly incomplete imho. For example, usually we wrap the mdl in DDP to have this type of (distributed) data parallel type of thing to work.

Did you

1. wrap the model in DDP?
2. change the args to trainer or trainer args in anyway?
3. wrap the optimizer in any distributed trainer (like cherry? cherry is a pytorch lib for things like this)
4. also, what about the init group that is usually needed?

Thanks in advance

made a real question of this here:

- [python - How to run an end to end example of distributed data parallel with hugging face's trainer api (ideally on a single node multiple gpus)? - Stack Overflow](https://stackoverflow.com/questions/73391230/how-to-run-an-end-to-end-example-of-distributed-data-parallel-with-hugging-face)
- [How to run an end to end example of distributed data parallel with hugging face's trainer api (ideally on a single node multiple gpus)?](https://discuss.huggingface.co/t/how-to-run-an-end-to-end-example-of-distributed-data-parallel-with-hugging-faces-trainer-api-ideally-on-a-single-node-multiple-gpus/21750)

---

_[View the full topic](https://discuss.huggingface.co/t/using-transformers-with-distributeddataparallel-any-examples/10775)._
