# DeepSpeed giving Assertion Error

**URL:** <https://discuss.huggingface.co/t/deepspeed-giving-assertion-error/47261>\
**Category:** Intermediate\
**Created:** [July 18, 2023, 11:46pm UTC](https://discuss.huggingface.co/t/deepspeed-giving-assertion-error/47261 "2023-07-18T23:46:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![harik68](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/harik68/32/17117_2.png) [@harik68](https://discuss.huggingface.co/u/harik68)\
**Post date:** [July 18, 2023, 11:46pm UTC](https://discuss.huggingface.co/t/deepspeed-giving-assertion-error/47261/1 "2023-07-18T23:46:22Z")

</div>

I am facing some issues whe using Deep Speed for fine tuning StarCoder Model. I am exactly following the steps mentioned in this article [Creating a Coding Assistant with StarCoder](https://huggingface.co/blog/starchat-alpha) (section Fine-tuning StarCoder with DeepSpeed ZeRO-3). However I am getting the error “AssertionError: Check batch related parameters. train\_batch\_size is not equal to micro\_batch\_per\_gpu \* gradient\_acc\_step \* world\_size 256 != 4 \* 8 \* 1”. I did some research on this on Google and found this link explaining the reason [[BUG] batch\_size check failed with zero 2 (deepspeed v0.9.0) · Issue #3228 · microsoft/DeepSpeed · GitHub](https://github.com/microsoft/DeepSpeed/issues/3228) However even if I use the version of deepspeed mentioned in this article as working (v 0.9.0) I am getting the same error. I tried different versions of deepspeed and accelerate but couldn’t fix the issue. Any one has any suggestions? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![lewtun](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lewtun/32/30995_2.png) [@lewtun](https://discuss.huggingface.co/u/lewtun)\
**Post date:** [July 22, 2023, 7:22am UTC](https://discuss.huggingface.co/t/deepspeed-giving-assertion-error/47261/2 "2023-07-22T07:22:18Z")

</div>

cc @muellerzr this is possibly related to the recent refactoring of `Trainer` to use `accelerate` in the backend.

@harik68 I think you should be able to run the StarCoder script by pinning `accelerate==0.18.0` and `transformers==4.28.1`

---

<div class="post-metadata">

**Author:** ![muellerzr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/muellerzr/32/21583_2.png) [@muellerzr](https://discuss.huggingface.co/u/muellerzr)\
**Post date:** [July 22, 2023, 1:38pm UTC](https://discuss.huggingface.co/t/deepspeed-giving-assertion-error/47261/3 "2023-07-22T13:38:19Z")

</div>

cc @smangrul
