-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO: Remove old implementation and update documentation
- Loading branch information
Showing
102 changed files
with
5,318 additions
and
548 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,7 @@ celerybeat.pid | |
# Environments | ||
.env | ||
.venv | ||
.vs | ||
env/ | ||
venv/ | ||
ENV/ | ||
|
Empty file.
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,27 @@ | ||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
# -------------------------------------------------------------------------- | ||
import argparse | ||
import json | ||
from pathlib import Path | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"--optimize", | ||
action="store_true", | ||
help="If set, run transformers optimization pass", | ||
) | ||
args = parser.parse_args() | ||
|
||
input_filename = "bert_cuda_gpu.template.json" | ||
with Path(input_filename).open("r") as f: | ||
config = json.load(f) | ||
|
||
if not args.optimize: | ||
del config["passes"]["transformers_optimization"] | ||
|
||
output_filename = input_filename.replace(".template", "") | ||
with Path(output_filename).open("w") as strm: | ||
json.dump(config, fp=strm, indent=4) |
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
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
import torch | ||
import torchmetrics | ||
import transformers | ||
from datasets import load_dataset, load_metric | ||
from datasets import load_dataset | ||
Check failure Code scanning / lintrunner MYPY/import Error
Cannot find implementation or library stub for module named "datasets"
To disable, use # type: ignore[import]
|
||
from datasets.utils import logging as datasets_logging | ||
from neural_compressor.data import DefaultDataLoader | ||
from torch.utils.data import Dataset | ||
|
@@ -26,6 +26,11 @@ | |
from olive.data.registry import Registry | ||
from olive.model import OliveModelHandler | ||
|
||
try: | ||
from datasets import load_metric | ||
Check notice Code scanning / lintrunner PYLINT/C0412 Note
Imports from package datasets are not grouped (ungrouped-imports)
See ungrouped-imports. |
||
except ImportError: | ||
from evaluate import load as load_metric | ||
Check failure Code scanning / lintrunner MYPY/import Error
Cannot find implementation or library stub for module named "evaluate"
To disable, use # type: ignore[import]
|
||
|
||
datasets_logging.disable_progress_bar() | ||
datasets_logging.set_verbosity_error() | ||
|
||
|
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,32 @@ | ||
# ------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
# -------------------------------------------------------------------------- | ||
import argparse | ||
import json | ||
from pathlib import Path | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"--device", | ||
choices=["cpu", "gpu", "multi_ep"], | ||
help="Device to use", | ||
) | ||
parser.add_argument( | ||
"--quantize", | ||
action="store_true", | ||
help="If set, run transformers optimization pass", | ||
) | ||
args = parser.parse_args() | ||
|
||
input_filename = f"config_{args.device}.template.json" | ||
with Path(input_filename).open("r") as f: | ||
config = json.load(f) | ||
|
||
if not args.quantize: | ||
del config["passes"]["blockwise_quant_int4"] | ||
|
||
output_filename = input_filename.replace(".template", "") | ||
with Path(output_filename).open("w") as strm: | ||
json.dump(config, fp=strm, indent=4) |
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
Oops, something went wrong.