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 test for open-llama-3b-v2-f16 model through sharktank. #272

Merged
merged 12 commits into from
Jun 28, 2024

Conversation

ScottTodd
Copy link
Member

@ScottTodd ScottTodd commented Jun 26, 2024

Progress on nod-ai/sharktank#22

This adds one test for a llama model running through https://github.com/nod-ai/sharktank. That project is still getting set up, so new docs for this particular workflow are coming in at nod-ai/sharktank#69 and tests in that repo are in nod-ai/sharktank#70.

Specifically, this exercises:

Ideas for future work:

  • Test cases for the same model/parameters
    • Other batch sizes
    • decode() as well as prefill()
    • Real inputs with expected outputs (decode() crashes on some faked inputs still 🤔)
    • Other flag combinations and target configurations (starting simple though)
  • Test cases for other models/parameters
    • 8b / 70b parameter models
    • Mistral, Mixtral, Gemma, etc.

@ScottTodd ScottTodd requested a review from saienduri June 26, 2024 21:45
@saienduri
Copy link
Contributor

Nice, is there a reason that sharktank needs its own config file? Pytorch models and sharktank have the same starting point of mlir, so maybe just having one overarching models configuration could work.

@ScottTodd
Copy link
Member Author

Nice, is there a reason that sharktank needs its own config file? Pytorch models and sharktank have the same starting point of mlir, so maybe just having one overarching models configuration could work.

I'm going back and forth on that, thanks for noticing too.

With multiple files we keep the test lists separate. The lists are short, but unqualified right now. I think I want them to be qualified for merging, so this:

"skip_compile_tests": [
"sdxl-scheduled-unet-3-tank",
"sdxl-vae-decode-tank",
"sdxl-prompt-encoder-tank"
],

would be

    "skip_compile_tests": [
      "pytorch/models/sdxl-scheduled-unet-3-tank",
      "pytorch/models/sdxl-vae-decode-tank",
      "pytorch/models/sdxl-prompt-encoder-tank"
    ],

then we'd also have new models:

    "skip_compile_tests": [
      "pytorch/models/sdxl-scheduled-unet-3-tank",
      "pytorch/models/sdxl-vae-decode-tank",
      "pytorch/models/sdxl-prompt-encoder-tank",
      "sharktank/llama/open-llama-3b-v2-f16",
    ],

Let me check if that works... the test names are still a bit awkwardly passed through pytest / conftest.py.

@ScottTodd
Copy link
Member Author

ScottTodd commented Jun 26, 2024

I'm also debating naming/grouping

PR currently:

test suite exists in iree_tests? config name
onnx ops yes onnx
pytorch ops no pytorch
pytorch models yes pytorch_models
sharktank models yes (this PR) sharktank

One alternative (grouping ops across frameworks and models across frameworks):

test suite exists in iree_tests? config name
onnx ops yes ops
pytorch ops no ops
pytorch models yes models
sharktank models yes (this PR) models

@ScottTodd
Copy link
Member Author

... and deciding how to run the tests:

By directory, reusing configs:

pytest iree_tests/pytorch/models --config-files=models.json
pytest iree_tests/sharktank --config-files=models.json

By directory, separate configs:

pytest iree_tests/pytorch/models --config-files=pytorch_models.json
pytest iree_tests/sharktank --config-files=sharktank.json

If we ran pytest iree_tests/ --config-files=models.json, that would go down into onnx/node/.

Ah! Nevermind -- we can run pytest dir1 dir2. Maybe not super convenient for local use though - would need to know which configs map to which test suite subfolders.

@saienduri
Copy link
Contributor

Let me check if that works... the test names are still a bit awkwardly passed through pytest / conftest.py.

Yup would be nice to have the them qualified and merge.
image
I think you would just have to change it to check that the test_directory relative path to repo_root is in the config file rather than just the test_directory name as it is now

@saienduri
Copy link
Contributor

... and deciding how to run the tests:

By directory, reusing configs:

pytest iree_tests/pytorch/models --config-files=models.json
pytest iree_tests/sharktank --config-files=models.json

I think of the options, by directory reusing configs looks like the cleanest

@ScottTodd
Copy link
Member Author

Sorry, building up a stack of merge conflicts with #271 here x_x

@ScottTodd
Copy link
Member Author

@ScottTodd ScottTodd marked this pull request as ready for review June 28, 2024 22:50
Copy link
Contributor

@saienduri saienduri left a comment

Choose a reason for hiding this comment

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

LGTM.

@ScottTodd ScottTodd merged commit 3603a45 into nod-ai:main Jun 28, 2024
2 of 3 checks passed
@ScottTodd ScottTodd deleted the sharktank-testing branch June 28, 2024 23:24
ScottTodd added a commit to iree-org/iree that referenced this pull request Jul 1, 2024
Progress on nod-ai/sharktank#22. See
nod-ai/SHARK-TestSuite#272 for the specifics of
what the new test is exercising.

The "models" tests now include `pytorch/models/` and `sharktank/`, so
all test names are qualified relative to `iree_tests/` in the test suite
repo. (Totally inflating my commit stats here, sorry :P)

ci-exactly: build_packages,regression_test
renxida pushed a commit that referenced this pull request Jul 18, 2024
Progress on nod-ai/sharktank#22

This adds one test for a llama model running through
https://github.com/nod-ai/sharktank. That project is still getting set
up, so new docs for this particular workflow are coming in at
nod-ai/sharktank#69 and tests in that repo are
in nod-ai/sharktank#70.

Specifically, this exercises:
*
[`sharktank/models/llama/llama.py`](https://github.com/nod-ai/sharktank/blob/main/sharktank/sharktank/models/llama/llama.py)
*
[`sharktank/examples/export_paged_llm_v1.py`](https://github.com/nod-ai/sharktank/blob/main/sharktank/sharktank/examples/export_paged_llm_v1.py)
with batch sizes == [4]
* The `open-llama-3b-v2-f16.gguf` file from
https://huggingface.co/SlyEcho/open_llama_3b_v2_gguf
* Compilation and crashless execution, _not_ numerical correctness (yet)

Ideas for future work:

* Test cases for the same model/parameters
  * Other batch sizes
  * `decode()` as well as `prefill()`
* Real inputs with expected outputs (`decode()` crashes on some faked
inputs still 🤔)
* Other flag combinations and target configurations (starting simple
though)
* Test cases for other models/parameters
  * 8b / 70b parameter models
  * Mistral, Mixtral, Gemma, etc.
LLITCHEV pushed a commit to LLITCHEV/iree that referenced this pull request Jul 30, 2024
Progress on nod-ai/sharktank#22. See
nod-ai/SHARK-TestSuite#272 for the specifics of
what the new test is exercising.

The "models" tests now include `pytorch/models/` and `sharktank/`, so
all test names are qualified relative to `iree_tests/` in the test suite
repo. (Totally inflating my commit stats here, sorry :P)

ci-exactly: build_packages,regression_test
Signed-off-by: Lubo Litchev <[email protected]>
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.

None yet

2 participants