-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix several bugs & add Bert inc example to pipeline (#1492)
## Describe your changes Fix Olive bugs & Add Bert inc examples to example pipeline. - `batch_size` is needed for Inc dataloader. Set default size to 1. - Custom eval func doesn't have batch_size as input. - For `QuantizationAwareTraining` pass, `train_data_config` is not required if user provides `training_loop_func`. - Latest transformers package will automatically save trained model as safetensors format. Add `save_safetensors` as false to train argument. - Some passes may have nested data_config in its config. Update auto-fill data_config logic to achieve this. ## Checklist before requesting a review - [ ] Add unit tests for this change. - [ ] Make sure all tests can pass. - [ ] Update documents if necessary. - [ ] Lint and apply fixes to your code by running `lintrunner -a` - [ ] Is this a user-facing change? If yes, give a description of this change to be included in the release notes. - [ ] Is this PR including examples changes? If yes, please remember to update [example documentation](https://github.com/microsoft/Olive/blob/main/docs/source/examples.md) in a follow-up PR. ## (Optional) Issue link
- Loading branch information
1 parent
40dc359
commit f47265f
Showing
7 changed files
with
63 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
# -------------------------------------------------------------------------- | ||
import json | ||
import os | ||
|
||
import pytest | ||
|
||
from ..utils import check_output, get_example_dir | ||
|
||
|
||
@pytest.fixture(scope="module", autouse=True) | ||
def setup(): | ||
"""Setups any state specific to the execution of the given module.""" | ||
os.chdir(get_example_dir("bert")) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"olive_json", | ||
[ | ||
"bert_inc_dynamic_ptq_cpu.json", | ||
"bert_inc_ptq_cpu.json", | ||
"bert_inc_smoothquant_ptq_cpu.json", | ||
"bert_inc_static_ptq_cpu.json", | ||
], | ||
) | ||
def test_bert(olive_json): | ||
from olive.workflows import run as olive_run | ||
|
||
with open(olive_json) as f: | ||
olive_config = json.load(f) | ||
|
||
footprint = olive_run(olive_config, tempdir=os.environ.get("OLIVE_TEMPDIR", None)) | ||
check_output(footprint) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters