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

llm weight compression tool #3290

Draft
wants to merge 11 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions tools/llm_weight_compression/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# LLM Weight Compression Tool

## Install

```bash
python3.10 -m venv env
. env/bin/activate
pip install --upgrade pip

pip install openvino==2025.0.0
pip install nncf==2.15.0
pip install "git+https://github.com/huggingface/[email protected]"
pip install "git+https://github.com/huggingface/[email protected]"
pip install "git+https://github.com/EleutherAI/[email protected]"
pip install xlsxwriter

# #whowhatbench
git clone --depth 1 --branch 2025.0.0.0 https://github.com/openvinotoolkit/openvino.genai.git

cd openvino.genai/tools/who_what_benchmark
pip install .
```

```bash
# For test
python run.py \
--model-id facebook/opt-125m \
--config config_optimum_lm_eval.json \
--root-dir experiment_dir \
--dump-packages
```
23 changes: 23 additions & 0 deletions tools/llm_weight_compression/config_optimum_lm_eval.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think about splitting compression and evaluation configs into separate files?

"compression": {
"backend": "optimum_cli",
"params": [
{
"task": ["text-generation"],
"weight_format": ["int4"],
"ratio": [0.2, 0.4],
"group_size": [64, 128],
"awq": [false, true],
"dataset": ["auto"]
}
]
},
"evaluation": {
"backend": "lm_eval",
"params": {
"tasks": ["wikitext"],
"device": "cpu",
"limit": 3
}
}
}
23 changes: 23 additions & 0 deletions tools/llm_weight_compression/config_optimum_wwb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compression": {
"backend": "optimum_cli",
"params": [
{
"task": ["text-generation"],
"weight_format": ["int4"],
"ratio": [0.2],
"group_size": [64],
"awq": [false],
"dataset": ["auto"]
}
]
},
"evaluation": {
"backend": "who_what_benchmark",
"params": {
"model_type": "text",
"device": "CPU",
"language": "en"
}
}
}
1 change: 1 addition & 0 deletions tools/llm_weight_compression/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO
Loading
Loading