Commit 865364f
George
[Oneshot Refactor] Main refactor (#1110)
ORDER OF REVIEWS:
1. #1108
2. #1103
3. #1109
4. #1110 <- current
PR
SUMMARY:
* Create a class to decouple dependency to `main`. Class `Oneshot`
consists of pre-processing, carrying out oneshot logic and
post-processing
* Move the oneshot class and method under
`llmcompressor/entrypoints/oneshot.py`.
* Add ReadMe in `/llmcompressor/entrypoints` for info on oneshot
* Delete oneshot logic from `/finetune` directory, add deprecation
warning
* Remove apply used only for stagerunner oneshot pathway in session.py
and session_function.py
* Add oneshot only calibration dataloader logic
* Add a return variable of `model: PretrainedModel` for `def oneshot`.
* Make oneshot carryout logic independent of `TrainingArguments`
* remove `overwrite_output_dir` as oneshot input arg -> only used for
`TrainingArguments`
* Update README on `/finetune` path. Remove `oneshot` logic and `oneshot
with fsdp`
* Update `wrap_save_pretrained` logic to run only if not updated already
-> used for stage runner to avoid double wrapping
Entrypoints:
```python3
from llmcompressor import oneshot
oneshot(**kwargs) # calls Oneshot
```
or
```python3
from llmcompressor import Oneshot
oneshot = Oneshot(**kwargs)
oneshot() # preprocesss, carries out logic and post process
```
TEST PLAN:
Pass all tests and examples.
Verified
https://github.com/vllm-project/llm-compressor/blob/main/examples/quantization_2of4_sparse_w4a16/llama7b_sparse_w4a16.py
works as expected.
FOLLOW UPS:
* Stage runner removal
* Update entrypoints folder with train, eval, predict, etc.
---------
Signed-off-by: George Ohashi <george@neuralmagic.com>
Signed-off-by: George <george@neuralmagic.com>1 parent 1101723 commit 865364f
File tree
61 files changed
+680
-270
lines changed- examples
- big_models_with_accelerate
- multimodal_audio
- multimodal_vision
- quantization_kv_cache
- quantization_w4a16
- quantization_w8a8_fp8
- quantization_w8a8_int8
- quantizing_moe
- sparse_2of4_quantization_fp8
- src/llmcompressor
- args
- core
- entrypoints
- transformers
- finetune
- data
- sparsification
- utils
- tests
- e2e
- llmcompressor
- entrypoints
- transformers
- compression
- finetune
- gptq
- kv_cache
- obcq
- oneshot
- sparsification
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
61 files changed
+680
-270
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | | - | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | | - | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | | - | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | | - | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | | - | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | | - | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | | - | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | | - | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
0 commit comments