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

test: Add OpenAI frontend testing for LLM API backend #8040

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

krishung5
Copy link
Contributor

@krishung5 krishung5 commented Feb 27, 2025

What does the PR do?

Add OpenAI frontend testing for LLM API backend. Some of the test cases are skipped for now due to issues with the random seeds sampling parameter. Will follow up with the TRT-LLM team.

Checklist

  • PR title reflects the change and is of format <commit_type>: <Title>
  • Changes are described in the pull request.
  • Related issues are referenced.
  • Populated github labels field
  • Added test plan and verified test passes.
  • Verified that the PR passes existing CI.
  • Verified copyright is correct on all changed files.
  • Added succinct git squash message before merging ref.
  • All template sections are filled out.
  • Optional: Additional screenshots for behavior/output changes with before/after.

Commit Type:

Check the conventional commit type
box here and add the label to the github PR.

  • build
  • ci
  • docs
  • feat
  • fix
  • perf
  • refactor
  • revert
  • style
  • test

Related PRs: LLM API backend MR.

Where should the reviewer start?

Test plan:

  • CI Pipeline ID: 24653671

Caveats:

Background

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • closes GitHub issue: #xxx

@krishung5 krishung5 changed the title ci: Add OpenAI frontend testing for LLM API backend test: Add OpenAI frontend testing for LLM API backend Feb 27, 2025
@krishung5 krishung5 added the PR: test Adding missing tests or correcting existing test label Feb 27, 2025
richardhuo-nv
richardhuo-nv previously approved these changes Feb 27, 2025
Copy link

@richardhuo-nv richardhuo-nv left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

Comment on lines 53 to 56
if LLMAPI_SETUP:
model = "tensorrt_llm"
else:
model = "tensorrt_llm_bls"
Copy link
Contributor

@rmccorm4 rmccorm4 Feb 27, 2025

Choose a reason for hiding this comment

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

Does it make sense to set backend = "llmapi" and use the backend fixture to check if llmapi in the tests, following similar patterns for vllm/trtllm in the existing tests?

ex:

if backend != "tensorrtllm":
pytest.skip(
reason="Only used to test TRT-LLM-specific temperature behavior"
)

Not sure what the config.pbtxt backend field will be for LLM API though - so let me know what you're thinking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The config.pbtxt backend field will be python for LLM API backend.

I thought that the LLM API backend is one of the tensorrtllm backends, so hence didn't have another "llmapi backend" fixture.

I think avoiding having an ENV makes more sense, however, right now the logic to determine which backend to use is to import tensorrtllm or vllm module and see if there's an import error, then set the backend and model name accordingly.

try:
import tensorrt_llm as _
backend = "tensorrtllm"
model = "tensorrt_llm_bls"
return backend, model
except ImportError:
print("No tensorrt_llm installation found.")

Both general tensorrtllm and llmapi backend cases will import the tensorrtllm module successfully. I think some sort of flags would still be required to know if this is a general trtllm model or a llmapi one.

Copy link
Contributor

Choose a reason for hiding this comment

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

The config.pbtxt backend field will be python for LLM API backend.

Do we plan to add a python-based backend like vllm is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean making it backend: llmapi in the config.pbtxt? I don't think there's a plan to do so right now. I could see it be less confusing having this after the pivot is more finalized, right now it's more like adding another python model just like the original one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh right because they're not using the runtime config.pbtxt feature currently, they just swapped the backend to python instead, gotcha - makes sense.

Will the llmapi model.py replace the existing model.py in trtllm backend? Hopefully we're not planning to support 3 implementations for now 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree - confirming w/ TRT-LLM team on this.

### TEST ENVIRONMENT SETUP ###
LLMAPI_SETUP = os.environ.get("LLMAPI_SETUP", 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to clean up some of the if/else everywhere for llmapi vs trtllm stuff, but hopefully we can consolidate the supported backend implementations once its a bit more mature.

rmccorm4
rmccorm4 previously approved these changes Feb 28, 2025
@krishung5
Copy link
Contributor Author

I'll be able to merge this PR only after the LLM API backend MR is merged. Also pending on CI - having some issues with the build which are not related to the openai changes. I'll ask for final review once we're ready to merge. Thanks!

@rmccorm4
Copy link
Contributor

rmccorm4 commented Mar 1, 2025

I'll be able to merge this PR only after the LLM API backend MR is merged. Also pending on CI - having some issues with the build which are not related to the openai changes. I'll ask for final review once we're ready to merge. Thanks!

Marking as draft for clarity - feel free to unmark it when ready

@rmccorm4 rmccorm4 marked this pull request as draft March 1, 2025 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: test Adding missing tests or correcting existing test
Development

Successfully merging this pull request may close these issues.

3 participants