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

feat: add simple tests for weights #2092

Merged
merged 6 commits into from
Jun 25, 2024
Merged

feat: add simple tests for weights #2092

merged 6 commits into from
Jun 25, 2024

Conversation

drbh
Copy link
Collaborator

@drbh drbh commented Jun 19, 2024

This PR adds a few more server tests for loading weights

@drbh drbh force-pushed the add-weights-tests branch from b407587 to 70e1982 Compare June 19, 2024 21:04
Copy link
Member

@danieldk danieldk left a comment

Choose a reason for hiding this comment

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

Really nice to have these tests!

Column gptq/marlin/exl2 and column-packed gptq/marlin tests seem to be missing?

),
},
"test_get_multi_weights_row_gptq": {
"weight.qweight": torch.tensor(
Copy link
Member

Choose a reason for hiding this comment

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

I think the quantizers should probably be tested with the real data types to check that there are no accidental dtype conversions happening. So int32 for qweight, qzeros, and g_idx, and f16 for scales.

Maybe also real shapes? (e.g. currently qzeros does not line up with just having one group) Probably less important.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

great points, I've updated the types in the latest changes but the values are still not fully realistic, happy to follow up in this or a future PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

also I'm not 100% sure if col_packed_exl2 is suppose to be supported or not? I was a bit confused about the expected weight names ("weights" vs "qweights")... is this intended? I'll update the test accordingly 🙂

Copy link
Member

Choose a reason for hiding this comment

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

Great question! This path is missing in weights, I'll create a ticket and look it. I can update the test here once it's properly implemented.

server/tests/utils/test_weights.py Show resolved Hide resolved
server/tests/utils/test_weights.py Outdated Show resolved Hide resolved
server/tests/utils/test_weights.py Outdated Show resolved Hide resolved
server/tests/utils/test_weights.py Outdated Show resolved Hide resolved
server/tests/utils/test_weights.py Outdated Show resolved Hide resolved
@drbh
Copy link
Collaborator Author

drbh commented Jun 20, 2024

updated to include more test (21)

python -m pytest -vvv server/tests/utils/test_weights.py

============================================ test session starts ============================================
platform linux -- Python 3.11.1, pytest-7.4.0, pluggy-1.5.0 -- /home/ubuntu/Projects/text-generation-inference/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/ubuntu/Projects/text-generation-inference/server
configfile: pyproject.toml
plugins: asyncio-0.23.7, anyio-4.3.0, syrupy-4.0.1
asyncio: mode=Mode.STRICT
collected 23 items

server/tests/utils/test_weights.py::test_weights PASSED                                               [  4%]
server/tests/utils/test_weights.py::test_get_tensor PASSED                                            [  8%]
server/tests/utils/test_weights.py::test_get_weights_col_packed PASSED                                [ 13%]
server/tests/utils/test_weights.py::test_get_weights_col_packed_block_size PASSED                     [ 17%]
server/tests/utils/test_weights.py::test_get_weights_col_packed_block_size_arr PASSED                 [ 21%]
server/tests/utils/test_weights.py::test_get_multi_weights_col PASSED                                 [ 26%]
server/tests/utils/test_weights.py::test_get_multi_weights_row PASSED                                 [ 30%]
server/tests/utils/test_weights.py::test_get_weights_col_awq PASSED                                   [ 34%]
server/tests/utils/test_weights.py::test_get_weights_col_gtpq PASSED                                  [ 39%]
server/tests/utils/test_weights.py::test_get_weights_col_exl2 PASSED                                  [ 43%]
server/tests/utils/test_weights.py::test_get_weights_col_marlin PASSED                                [ 47%]
server/tests/utils/test_weights.py::test_get_weights_col_packed_awq PASSED                            [ 52%]
server/tests/utils/test_weights.py::test_get_weights_col_packed_exl2 SKIPPED (Review expected
functionality)                                                                                        [ 56%]
server/tests/utils/test_weights.py::test_get_weights_col_packed_gptq PASSED                           [ 60%]
server/tests/utils/test_weights.py::test_get_weights_col_packed_marlin PASSED                         [ 65%]
server/tests/utils/test_weights.py::test_get_multi_weights_col_awq PASSED                             [ 69%]
server/tests/utils/test_weights.py::test_get_multi_weights_col_exl2 PASSED                            [ 73%]
server/tests/utils/test_weights.py::test_get_multi_weights_col_gptq PASSED                            [ 78%]
server/tests/utils/test_weights.py::test_get_multi_weights_col_marlin PASSED                          [ 82%]
server/tests/utils/test_weights.py::test_get_multi_weights_row_awq PASSED                             [ 86%]
server/tests/utils/test_weights.py::test_get_multi_weights_row_exl2 PASSED                            [ 91%]
server/tests/utils/test_weights.py::test_get_multi_weights_row_gptq PASSED                            [ 95%]
server/tests/utils/test_weights.py::test_get_multi_weights_row_marlin PASSED                          [100%]

------------------------------------------ snapshot report summary ------------------------------------------

======================================= 22 passed, 1 skipped in 3.74s =======================================

@Narsil Narsil merged commit 3f3b7ff into main Jun 25, 2024
6 checks passed
@Narsil Narsil deleted the add-weights-tests branch June 25, 2024 10:23
yuanwu2017 pushed a commit to yuanwu2017/tgi-gaudi that referenced this pull request Sep 26, 2024
* feat: add simple tests for weights

* fix: adjust types and add tests

* fix: adjust so all tests pass

* feat: improve weight tests

* fix: add missing tests and renames

* fix: tweak shapes
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