Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add batching support in inference server #11466

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

haifengqian
Copy link
Collaborator

@haifengqian haifengqian commented Dec 3, 2024

What does this PR do ?

add batching support in inference server

Collection: nlp

GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

Haifeng Qian and others added 5 commits December 3, 2024 12:26
Signed-off-by: haifengqian <[email protected]>
Signed-off-by: Haifeng Qian <[email protected]>
In theory, with the previous implementation it would have been possible
for a thread to re-use the output from a previous batch, if it happened
to grab the lock before the thread with queryid == 0.

Signed-off-by: Haifeng Qian <[email protected]>
This can give a small speedup for free, since usually batched queries
all come in within <0.5s

Signed-off-by: Haifeng Qian <[email protected]>
@haifengqian haifengqian self-assigned this Dec 3, 2024
Copy link
Contributor

github-actions bot commented Dec 3, 2024

[🤖]: Hi @haifengqian 👋,

We wanted to let you know that a CICD pipeline for this PR just finished successfully

So it might be time to merge this PR or get some approvals

I'm just a bot so I'll leave it you what to do next.

//cc @pablo-garay @ko3n1g

Copy link
Contributor

github-actions bot commented Dec 3, 2024

beep boop 🤖: 🙏 The following files have warnings. In case you are familiar with these, please try helping us to improve the code base.


Your code was analyzed with PyLint. The following annotations have been identified:

************* Module nemo.collections.nlp.modules.common.text_generation_server
nemo/collections/nlp/modules/common/text_generation_server.py:61:0: C0115: Missing class docstring (missing-class-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:72:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:76:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:102:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:172:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:284:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:295:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:461:0: C0115: Missing class docstring (missing-class-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:484:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:26:0: W0611: Unused get_prompt_template_example imported from nemo.collections.nlp.data.language_modeling.megatron.gpt_sft_chat_dataset (unused-import)
************* Module nemo.collections.nlp.modules.common.text_generation_utils
nemo/collections/nlp/modules/common/text_generation_utils.py:261:0: C0301: Line too long (137/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:695:0: C0301: Line too long (173/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:701:0: C0301: Line too long (148/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:931:0: C0301: Line too long (182/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:934:0: C0301: Line too long (177/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:942:0: C0301: Line too long (141/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:987:0: C0301: Line too long (156/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:1004:0: C0301: Line too long (145/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:1307:0: C0301: Line too long (120/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:72:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:89:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:96:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:211:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:320:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:382:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:570:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:898:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:903:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:1101:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:17:0: W0611: Unused import os (unused-import)
nemo/collections/nlp/modules/common/text_generation_utils.py:30:0: W0611: Unused DEFAULT_VID_END_TOKEN imported from nemo.collections.multimodal.data.neva.conversation (unused-import)
nemo/collections/nlp/modules/common/text_generation_utils.py:30:0: W0611: Unused DEFAULT_VID_START_TOKEN imported from nemo.collections.multimodal.data.neva.conversation (unused-import)

-----------------------------------
Your code has been rated at 9.65/10

Thank you for improving NeMo's documentation!

1 similar comment
Copy link
Contributor

github-actions bot commented Dec 3, 2024

beep boop 🤖: 🙏 The following files have warnings. In case you are familiar with these, please try helping us to improve the code base.


Your code was analyzed with PyLint. The following annotations have been identified:

************* Module nemo.collections.nlp.modules.common.text_generation_server
nemo/collections/nlp/modules/common/text_generation_server.py:61:0: C0115: Missing class docstring (missing-class-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:72:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:76:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:102:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:172:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:284:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:295:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:461:0: C0115: Missing class docstring (missing-class-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:484:4: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_server.py:26:0: W0611: Unused get_prompt_template_example imported from nemo.collections.nlp.data.language_modeling.megatron.gpt_sft_chat_dataset (unused-import)
************* Module nemo.collections.nlp.modules.common.text_generation_utils
nemo/collections/nlp/modules/common/text_generation_utils.py:261:0: C0301: Line too long (137/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:695:0: C0301: Line too long (173/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:701:0: C0301: Line too long (148/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:931:0: C0301: Line too long (182/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:934:0: C0301: Line too long (177/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:942:0: C0301: Line too long (141/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:987:0: C0301: Line too long (156/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:1004:0: C0301: Line too long (145/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:1307:0: C0301: Line too long (120/119) (line-too-long)
nemo/collections/nlp/modules/common/text_generation_utils.py:72:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:89:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:96:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:211:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:320:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:382:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:570:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:898:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:903:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:1101:0: C0116: Missing function or method docstring (missing-function-docstring)
nemo/collections/nlp/modules/common/text_generation_utils.py:17:0: W0611: Unused import os (unused-import)
nemo/collections/nlp/modules/common/text_generation_utils.py:30:0: W0611: Unused DEFAULT_VID_END_TOKEN imported from nemo.collections.multimodal.data.neva.conversation (unused-import)
nemo/collections/nlp/modules/common/text_generation_utils.py:30:0: W0611: Unused DEFAULT_VID_START_TOKEN imported from nemo.collections.multimodal.data.neva.conversation (unused-import)

-----------------------------------
Your code has been rated at 9.65/10

Thank you for improving NeMo's documentation!

Copy link
Contributor

github-actions bot commented Dec 4, 2024

[🤖]: Hi @haifengqian 👋,

We wanted to let you know that a CICD pipeline for this PR just finished successfully

So it might be time to merge this PR or get some approvals

I'm just a bot so I'll leave it you what to do next.

//cc @pablo-garay @ko3n1g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants