-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Hyper-parameter Optimization algorithm (#786)
* add hpo * add ut&example, update code * fix Signed-off-by: Guo, Heng <[email protected]> * add requirement Signed-off-by: Guo, Heng <[email protected]> * pylint * add readme * requir * modify readme Signed-off-by: Guo, Heng <[email protected]> * modify api * logger * modify example and ut * add hpo api&config Signed-off-by: Guo, Heng <[email protected]> * fix * modify api Signed-off-by: Guo, Heng <[email protected]> * modify readme Signed-off-by: Guo, Heng <[email protected]> * spell Signed-off-by: Guo, Heng <[email protected]> * sync readme Signed-off-by: Guo, Heng <[email protected]> * modify readme Signed-off-by: Guo, Heng <[email protected]> --------- Signed-off-by: Guo, Heng <[email protected]>
- Loading branch information
Showing
14 changed files
with
1,525 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2698,3 +2698,7 @@ Vanhoucke | |
ONNXCommunityMeetup | ||
luYBWA | ||
pQ | ||
xgb | ||
xgboost | ||
hpo | ||
HPO |
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
29 changes: 29 additions & 0 deletions
29
examples/pytorch/nlp/huggingface_models/text-classification/pruning/hpo/README.md
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,29 @@ | ||
Step-by-Step | ||
============ | ||
|
||
This document presents step-by-step instructions for pruning Huggingface models with HPO feature using the Intel® Neural Compressor. | ||
|
||
# Prerequisite | ||
## 1. Environment | ||
Python 3.6 or higher version is recommended. | ||
The dependent packages are listed in `requirements.txt`, please install them as follows, | ||
```shell | ||
cd examples/pytorch/nlp/huggingface_models/text-classification/pruning/hpo/ | ||
pip install -r requirements.txt | ||
``` | ||
## 2. Prepare Dataset | ||
|
||
The dataset will be downloaded automatically from the datasets Hub. | ||
See more about loading [huggingface dataset](https://huggingface.co/docs/datasets/loading_datasets.html) | ||
|
||
# Run | ||
To get tuned model and its accuracy: | ||
```shell | ||
python run_glue_no_trainer.py \ | ||
--model_name_or_path M-FAC/bert-mini-finetuned-mrpc \ | ||
--task_name mrpc \ | ||
--per_device_eval_batch_size 18 \ | ||
--per_device_train_batch_size 18 \ | ||
--do_prune | ||
|
||
``` |
12 changes: 12 additions & 0 deletions
12
examples/pytorch/nlp/huggingface_models/text-classification/pruning/hpo/requirements.txt
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,12 @@ | ||
accelerate | ||
datasets | ||
sentencepiece | ||
scipy | ||
scikit-learn | ||
protobuf | ||
torch | ||
evaluate | ||
transformers | ||
tqdm | ||
xgboost | ||
|
Oops, something went wrong.