Skip to content

[CB] Refactor any model-related code in a separate class#45654

Merged
remi-or merged 10 commits into
mainfrom
cb-model-runner
May 6, 2026
Merged

[CB] Refactor any model-related code in a separate class#45654
remi-or merged 10 commits into
mainfrom
cb-model-runner

Conversation

@remi-or

@remi-or remi-or commented Apr 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR simplifies the continuous batching code by refactoring away any model-related code in the ModelRunner class. This is because the ContinuousBatchingProcessor class is starting to get too big and this will help keep things organized.
Draft until #45653 is merged.

Performance

label samples avg_in max_new time (s) tokens tok/s mem (GB)
gsm8k_default 1319 94 256 27.36 337664 12341 72.57
gsm8k_sampling 1319 94 256 28.32 337664 11922.8 71.95
gsm8k_compile 1319 94 256 27.07 337664 12472.6 72.01
gsm8k_no_fast_decode 1319 94 256 30.65 337664 11015.3 71.95
rollouts_1024 32 256 1024 9.97 32768 3286.04 72.01
rollouts_2048 32 256 2048 20.95 65536 3128.95 71.98
rollouts_4096 32 256 4096 46.97 131072 2790.29 72.01
rollouts_8192 32 256 8192 115.66 262144 2266.54 71.97
rollouts_16384 32 256 16384 351.32 524288 1492.34 72
few_blocks 20 256 256 7.29 5120 702.41 16.88
multi_return_seq 50 256 256 8.37 12800 1528.67 72

Perf is on par with main, which is to be expected.

Tests

All good

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah 300 loc is quite a lot, sounds good!

@remi-or
remi-or marked this pull request as ready for review May 4, 2026 09:53
@remi-or
remi-or added this pull request to the merge queue May 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 4, 2026
@remi-or
remi-or force-pushed the cb-model-runner branch from b58395b to 298f250 Compare May 6, 2026 06:00
@remi-or
remi-or added this pull request to the merge queue May 6, 2026
Merged via the queue into main with commit 7f6419e May 6, 2026
32 checks passed
@remi-or
remi-or deleted the cb-model-runner branch May 6, 2026 06:39
Exile333 pushed a commit to Exile333/transformers that referenced this pull request May 6, 2026
…#45654)

* Squashed model runner commits

* Rebase fixes

* Overhaul init

* Style

* Fix bugs

* Fixes and simplicfications

* Style

* Fixes for failing tests

* nit

* Remove useless test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants