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

HPU only release binary #302

Merged
merged 27 commits into from
Nov 11, 2024
Merged

HPU only release binary #302

merged 27 commits into from
Nov 11, 2024

Conversation

yiliu30
Copy link
Contributor

@yiliu30 yiliu30 commented Nov 5, 2024

The expected behavior is to build a binary for HPU-only, as we did for INC 3x intel/neural-compressor#1336.

Usage

  1. Install the released package
pip install auto-round[hpu]
# It will install auto-round with `requirements-hpu.txt`
  1. Install from source
python setup.py install hpu
# Within the gaudi docker, install hpu-only version by default
python setup.py install 

cc @thuang6

Test scope:

To ensure that new PRs don't break this version, we need to define a set of smoke tests for it. Additionally, we need a runner that installs the HPU-only version and runs these tests.

pytest -sv ./test/test_auto_round_hpu_only.py

@@ -0,0 +1,3 @@
def test_import():
from auto_round import AutoRound
from auto_round.export.export_to_itrex.export import export_to_itrex
Copy link
Contributor

Choose a reason for hiding this comment

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

@WeiweiZhang1 the import is very confusing, better rename one of them

@yiliu30 yiliu30 changed the title HPU only release binary [WIP]HPU only release binary Nov 5, 2024
@yiliu30 yiliu30 marked this pull request as ready for review November 6, 2024 09:50
@yiliu30 yiliu30 changed the title [WIP]HPU only release binary HPU only release binary Nov 7, 2024
Signed-off-by: yiliu30 <[email protected]>
from .export_to_autoround.export import save_quantized_as_autoround
from .export_to_awq.export import save_quantized_as_autoawq
from auto_round.utils import LazyImport
save_quantized_as_autogptq = LazyImport("auto_round.export.export_to_autogptq.export.save_quantized_as_autogptq")
Copy link
Contributor

@wenhuach21 wenhuach21 Nov 7, 2024

Choose a reason for hiding this comment

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

a little ugly if others see the code, how about first exporting them in auto_round.export, then we could just call auto_round.export.save_xxx

Copy link
Contributor Author

@yiliu30 yiliu30 Nov 8, 2024

Choose a reason for hiding this comment

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

Update by registering all export formats in __init__.py, and only invoke the save function when necessary.

from auto_round.utils import LazyImport
save_quantized_as_autogptq = LazyImport("auto_round.export.export_to_autogptq.export.save_quantized_as_autogptq")
save_quantized_as_itrex = LazyImport("auto_round.export.export_to_itrex.export.save_quantized_as_itrex")
QuantConfig = LazyImport("auto_round.export.export_to_itrex.config.QuantConfig")
Copy link
Contributor

Choose a reason for hiding this comment

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

Better change the quantconfig to itrex_quantconfig

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since it's specific to the export format, remove it from __init__.py and use it with the full path: from auto_round.export.export_to_itrex import QuantConfig.

from auto_round.utils import LazyImport
qlinear_qbits = LazyImport("auto_round_extension.qbits.qlinear_qbits")
qlinear_qbits_gptq = LazyImport("auto_round_extension.qbits.qlinear_qbits_gptq")
qlinear_ipex_gptq = LazyImport("auto_round_extension.ipex.qlinear_ipex_gptq")
Copy link
Contributor

Choose a reason for hiding this comment

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

we have no unit test for generation due to several reasons. Could you help have a test to make sure the change in this file is ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update to import them only when needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Local test results:

python main.py --format auto_round:gptq --task wikitext
python main.py --format auto_gptq --task wikitext
python main.py --format auto_round --task wikitext


| Tasks  |Version|Filter|n-shot|    Metric     |   | Value |   |Stderr|
|--------|------:|------|-----:|---------------|---|------:|---|------|
|wikitext|      2|none  |     0|bits_per_byte  || 0.9433|±  |N/A   |
|        |       |none  |     0|byte_perplexity|| 1.9229|±  |N/A   |
|        |       |none  |     0|word_perplexity||32.9958|±  |N/A   |

| Tasks  |Version|Filter|n-shot|    Metric     |   | Value |   |Stderr|
|--------|------:|------|-----:|---------------|---|------:|---|------|
|wikitext|      2|none  |     0|bits_per_byte  || 0.9433|±  |N/A   |
|        |       |none  |     0|byte_perplexity|| 1.9229|±  |N/A   |
|        |       |none  |     0|word_perplexity||32.9958|±  |N/A   |

| Tasks  |Version|Filter|n-shot|    Metric     |   | Value |   |Stderr|
|--------|------:|------|-----:|---------------|---|------:|---|------|
|wikitext|      2|none  |     0|bits_per_byte  || 0.9433|±  |N/A   |
|        |       |none  |     0|byte_perplexity|| 1.9229|±  |N/A   |
|        |       |none  |     0|word_perplexity||32.9958|±  |N/A   |

@yiliu30
Copy link
Contributor Author

yiliu30 commented Nov 8, 2024

/azp run Unit-Test-HPU-AutoRound

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

yiliu30 and others added 2 commits November 7, 2024 21:26
Signed-off-by: Sun, Xuehao <[email protected]>
@wenhuach21 wenhuach21 self-requested a review November 11, 2024 05:06
@yiliu30 yiliu30 merged commit 5cd255e into main Nov 11, 2024
11 of 13 checks passed
@yiliu30 yiliu30 deleted the hpu_only_pkg branch November 11, 2024 05:48
@yiliu30 yiliu30 restored the hpu_only_pkg branch November 11, 2024 06:09
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