change lat_pred to predict
This commit is contained in:
Родитель
5530cc5bc5
Коммит
5e22c26b30
|
@ -98,16 +98,16 @@ After installation, a command named `nn-meter` is enabled. To predict the latenc
|
|||
|
||||
```bash
|
||||
# for Tensorflow (*.pb) file
|
||||
nn-meter lat_pred --predictor <hardware> [--predictor-version <version>] --tensorflow <pb-file_or_folder>
|
||||
nn-meter predict --predictor <hardware> [--predictor-version <version>] --tensorflow <pb-file_or_folder>
|
||||
|
||||
# for ONNX (*.onnx) file
|
||||
nn-meter lat_pred --predictor <hardware> [--predictor-version <version>] --onnx <onnx-file_or_folder>
|
||||
nn-meter predict --predictor <hardware> [--predictor-version <version>] --onnx <onnx-file_or_folder>
|
||||
|
||||
# for torch model from torchvision model zoo (str)
|
||||
nn-meter lat_pred --predictor <hardware> [--predictor-version <version>] --torchvision <model-name> <model-name>...
|
||||
nn-meter predict --predictor <hardware> [--predictor-version <version>] --torchvision <model-name> <model-name>...
|
||||
|
||||
# for nn-Meter IR (*.json) file
|
||||
nn-meter lat_pred --predictor <hardware> [--predictor-version <version>] --nn-meter-ir <json-file_or_folder>
|
||||
nn-meter predict --predictor <hardware> [--predictor-version <version>] --nn-meter-ir <json-file_or_folder>
|
||||
```
|
||||
|
||||
`--predictor-version <version>` arguments is optional. When the predictor version is not specified by users, nn-meter will use the latest version of the predictor.
|
||||
|
|
|
@ -10,17 +10,17 @@ You can save tensorflow models into frozen pb formats, and use the following nn-
|
|||
|
||||
```bash
|
||||
# for Tensorflow (*.pb) file
|
||||
nn-meter --predictor <hardware> --tensorflow <pb-file>
|
||||
nn-meter predict --predictor <hardware> [--predictor-version <version>] --tensorflow <pb-file_or_folder>
|
||||
```
|
||||
|
||||
For the other frameworks (e.g., PyTorch), you can convert the models into onnx models, and use the following nn-meter command to predict the latency:
|
||||
|
||||
```bash
|
||||
# for ONNX (*.onnx) file
|
||||
nn-meter --predictor <hardware> --onnx <onnx-file>
|
||||
nn-meter predict --predictor <hardware> [--predictor-version <version>] --onnx <onnx-file_or_folder>
|
||||
```
|
||||
|
||||
You can download the test [tensorflow models]("https://github.com/Lynazhang/nnmeter/releases/download/0.1/pb_models.zip") and [onnx models](https://github.com/Lynazhang/nnmeter/releases/download/0.1/onnx_models.zip).
|
||||
You can download the test [tensorflow models]("https://github.com/microsoft/nn-Meter/releases/download/v1.0-data/pb_models.zip") and [onnx models](https://github.com/microsoft/nn-Meter/releases/download/v1.0-data/onnx_models.zip).
|
||||
|
||||
### Input model as a code object
|
||||
|
||||
|
@ -29,7 +29,7 @@ You can also directly apply nn-Meter in your python code. In this case, please d
|
|||
```python
|
||||
from nn_meter import load_latency_predictor
|
||||
|
||||
predictor = load_lat_predictor(hardware_name) # case insensitive in backend
|
||||
predictor = load_latency_predictor(hardware_name) # case insensitive in backend
|
||||
|
||||
# build your model here
|
||||
model = ... # model is instance of torch.nn.Module
|
||||
|
@ -57,14 +57,14 @@ For a *node*, we use the identical node name ("conv1.conv/Conv2D") as the node k
|
|||
* outbounds: a list of outgoing node names. The inbounds and outbounds describe the node connections.
|
||||
* attr: a set of attributes for the node. The attributes can be different for different types of NN node.
|
||||
|
||||
You can download the example nn-Meter IR graphs through [here](https://github.com/Lynazhang/nnmeter/releases/download/0.1/ir_graphs.zip).
|
||||
You can download the example nn-Meter IR graphs through [here](https://github.com/microsoft/nn-Meter/releases/download/v1.0-data/ir_graphs.zip).
|
||||
|
||||
When you have a large amount of models to predict, you can also convert them into nn-Meter IR graphs to save the pre-processing time:
|
||||
|
||||
```
|
||||
# for Tensorflow (*.pb) file
|
||||
nn-meter getir --tensorflow <pb-file> --output <output-name>
|
||||
nn-meter get_ir --tensorflow <pb-file> [--output <output-name>]
|
||||
|
||||
# for ONNX (*.onnx) file
|
||||
nn-meter getir --onnx <onnx-file> --output <output-name>
|
||||
nn-meter get_ir --onnx <onnx-file> [--output <output-name>]
|
||||
```
|
||||
|
|
|
@ -36,16 +36,16 @@ After installation, a command named `nn-meter` is enabled. To predict the latenc
|
|||
|
||||
```bash
|
||||
# for Tensorflow (*.pb) file
|
||||
nn-meter lat_pred --predictor <hardware> [--predictor-version <version>] --tensorflow <pb-file_or_folder>
|
||||
nn-meter predict --predictor <hardware> [--predictor-version <version>] --tensorflow <pb-file_or_folder>
|
||||
|
||||
# for ONNX (*.onnx) file
|
||||
nn-meter lat_pred --predictor <hardware> [--predictor-version <version>] --onnx <onnx-file_or_folder>
|
||||
nn-meter predict --predictor <hardware> [--predictor-version <version>] --onnx <onnx-file_or_folder>
|
||||
|
||||
# for torch model from torchvision model zoo (str)
|
||||
nn-meter lat_pred --predictor <hardware> [--predictor-version <version>] --torchvision <model-name> <model-name>...
|
||||
nn-meter predict --predictor <hardware> [--predictor-version <version>] --torchvision <model-name> <model-name>...
|
||||
|
||||
# for nn-Meter IR (*.json) file
|
||||
nn-meter lat_pred --predictor <hardware> [--predictor-version <version>] --nn-meter-ir <json-file_or_folder>
|
||||
nn-meter predict --predictor <hardware> [--predictor-version <version>] --nn-meter-ir <json-file_or_folder>
|
||||
```
|
||||
|
||||
`--predictor-version <version>` arguments is optional. When the predictor version is not specified by users, nn-meter will use the latest version of the predictor.
|
||||
|
|
|
@ -113,7 +113,7 @@ def nn_meter_cli():
|
|||
subparsers = parser.add_subparsers()
|
||||
|
||||
# Usage 1: latency predictors
|
||||
lat_pred = subparsers.add_parser('lat_pred', help='apply latency predictor for testing model')
|
||||
lat_pred = subparsers.add_parser('predict', help='apply latency predictor for testing model')
|
||||
lat_pred.add_argument(
|
||||
"--predictor",
|
||||
type=str,
|
||||
|
|
|
@ -82,7 +82,7 @@ def integration_test(model_type, url, ppath, output_name = "tests/test_result.tx
|
|||
try:
|
||||
since = time.time()
|
||||
# print(f'nn-meter --{model_type} {ppath} --predictor {pred_name} --predictor-version {pred_version}')
|
||||
result = subprocess.check_output(['nn-meter', 'lat_pred', f'--{model_type}', f'{ppath}', '--predictor', f'{pred_name}', '--predictor-version', f'{pred_version}'])
|
||||
result = subprocess.check_output(['nn-meter', 'predict', f'--{model_type}', f'{ppath}', '--predictor', f'{pred_name}', '--predictor-version', f'{pred_version}'])
|
||||
runtime = time.time() - since
|
||||
except NotImplementedError:
|
||||
logging.error(f"Meets ERROR when checking --{model_type} {ppath} --predictor {pred_name} --predictor-version {pred_version}")
|
||||
|
|
|
@ -43,7 +43,7 @@ def integration_test_onnx_based_torch(model_type, model_list, output_name = "tes
|
|||
try:
|
||||
since = time.time()
|
||||
# print(f'nn-meter --torchvision ' + " ".join(model_list) + f' --predictor {pred_name} --predictor-version {pred_version}')
|
||||
result = subprocess.check_output(['nn-meter', 'lat_pred', f'--torchvision'] + model_list + ['--predictor', f'{pred_name}', '--predictor-version', f'{pred_version}'])
|
||||
result = subprocess.check_output(['nn-meter', 'predict', f'--torchvision'] + model_list + ['--predictor', f'{pred_name}', '--predictor-version', f'{pred_version}'])
|
||||
runtime = time.time() - since
|
||||
except NotImplementedError:
|
||||
logging.error("Meets ERROR when checking --torchvision {model_list} --predictor {pred_name} --predictor-version {pred_version}")
|
||||
|
|
Загрузка…
Ссылка в новой задаче