-
Notifications
You must be signed in to change notification settings - Fork 8
add fixed input for bert #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 26 commits
7b55ce5
1ede310
a31e5e1
6d5003d
776e70d
b3c4a0c
f8c8b06
df07b65
6626f91
01cb4de
bc405d6
ddf25ed
c4e81b0
c7764d4
146e3b0
83d284e
93ed7b4
07a1a34
ccddf0a
2a518e7
fe213de
02d4de6
d720b06
c682f18
2b56ab0
23e4287
871de3a
5ff4486
ee2acbd
0b9196f
5e97ac4
3ae639f
27af2ee
84eaf81
7181c43
47e0779
5ca5249
c2e309d
fba70f6
242ca72
e5f63ab
8628d9e
572eb52
58b26c7
6c47e2f
006ebb1
13e9fd7
706fe6e
ad8cf9f
8983fae
b22bd26
51f3b94
3f70599
4d8ec72
cfb802a
0face5a
14f0ab3
8351e91
0f8b11a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,6 +84,8 @@ jobs: | |
| wget https://ampereaimodelzoo.s3.eu-central-1.amazonaws.com/aio_objdet_dataset.tar.gz > /dev/null 2>&1 | ||
| tar -xf aio_objdet_dataset.tar.gz > /dev/null | ||
|
|
||
| apt-get update && apt-get install -y ffmpeg | ||
|
|
||
| wget $S3_URL_RESNET_50_V15_TF_FP32 > /dev/null 2>&1 | ||
| IGNORE_DATASET_LIMITS=1 python3 computer_vision/classification/resnet_50_v15/run.py -m resnet_50_v15_tf_fp32.pb -p fp32 -f tf --timeout=60 | ||
|
|
||
|
|
@@ -149,24 +151,24 @@ jobs: | |
| tar -xf aio_objdet_dataset.tar.gz > /dev/null | ||
|
|
||
| wget $S3_URL_RESNET_50_V15_TF_FP32 > /dev/null 2>&1 | ||
| IGNORE_DATASET_LIMITS=1 python3 computer_vision/classification/resnet_50_v15/run.py -m resnet_50_v15_tf_fp32.pb -p fp32 -f tf --timeout=60 | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 IGNORE_DATASET_LIMITS=1 python3 computer_vision/classification/resnet_50_v15/run.py -m resnet_50_v15_tf_fp32.pb -p fp32 -f tf --timeout=60 | ||
|
||
|
|
||
| IGNORE_DATASET_LIMITS=1 python3 computer_vision/classification/mobilenet_v2/run.py -p fp32 -f pytorch --timeout=60 | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 IGNORE_DATASET_LIMITS=1 python3 computer_vision/classification/mobilenet_v2/run.py -p fp32 -f pytorch --timeout=60 | ||
|
|
||
| wget https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt > /dev/null 2>&1 | ||
| IGNORE_DATASET_LIMITS=1 python3 computer_vision/object_detection/yolo_v8/run.py -m yolov8n.pt -f pytorch -p fp32 --timeout=60 | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 IGNORE_DATASET_LIMITS=1 python3 computer_vision/object_detection/yolo_v8/run.py -m yolov8n.pt -f pytorch -p fp32 --timeout=60 | ||
|
|
||
| python3 speech_recognition/whisper/run.py -m small.en | ||
|
|
||
| wget $S3_URL_SSD_INCEPTION_V2_TF_FP32 > /dev/null 2>&1 | ||
| IGNORE_DATASET_LIMITS=1 python3 computer_vision/object_detection/ssd_inception_v2/run.py -m ssd_inception_v2_tf_fp32.pb -p fp32 --timeout=60 | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 IGNORE_DATASET_LIMITS=1 python3 computer_vision/object_detection/ssd_inception_v2/run.py -m ssd_inception_v2_tf_fp32.pb -p fp32 --timeout=60 | ||
|
|
||
| wget https://zenodo.org/records/4735647/files/resnet50_v1.onnx > /dev/null 2>&1 | ||
| IGNORE_DATASET_LIMITS=1 python3 computer_vision/classification/resnet_50_v1/run.py -m resnet50_v1.onnx -p fp32 -f ort | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 IGNORE_DATASET_LIMITS=1 python3 computer_vision/classification/resnet_50_v1/run.py -m resnet50_v1.onnx -p fp32 -f ort | ||
|
|
||
| wget https://s3.amazonaws.com/onnx-model-zoo/vgg/vgg16/vgg16.tar.gz > /dev/null 2>&1 | ||
| tar -xf vgg16.tar.gz > /dev/null | ||
| IGNORE_DATASET_LIMITS=1 python3 computer_vision/classification/vgg_16/run.py -m vgg16/vgg16.onnx -p fp32 -f ort | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 IGNORE_DATASET_LIMITS=1 python3 computer_vision/classification/vgg_16/run.py -m vgg16/vgg16.onnx -p fp32 -f ort | ||
|
|
||
| test_pytorch_arm64_sh: | ||
| if: false | ||
|
|
@@ -257,21 +259,21 @@ jobs: | |
| tar -xf aio_objdet_dataset.tar.gz > /dev/null | ||
|
|
||
| wget https://github.com/tloen/alpaca-lora/raw/main/alpaca_data.json > /dev/null 2>&1 | ||
| AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 natural_language_processing/text_generation/llama2/run.py -m meta-llama/Llama-2-7b-chat-hf --dataset_path=alpaca_data.json | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 natural_language_processing/text_generation/llama2/run.py -m meta-llama/Llama-2-7b-chat-hf --dataset_path=alpaca_data.json | ||
|
|
||
| AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 recommendation/dlrm_torchbench/run.py -p fp32 | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 recommendation/dlrm_torchbench/run.py -p fp32 | ||
|
|
||
| IGNORE_DATASET_LIMITS=1 AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 computer_vision/classification/resnet_50_v15/run.py -m resnet50 -p fp32 -b 16 -f pytorch | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 IGNORE_DATASET_LIMITS=1 AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 computer_vision/classification/resnet_50_v15/run.py -m resnet50 -p fp32 -b 16 -f pytorch | ||
|
|
||
| AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 speech_recognition/whisper/run.py -m tiny.en | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 speech_recognition/whisper/run.py -m tiny.en | ||
|
|
||
| IGNORE_DATASET_LIMITS=1 python3 computer_vision/classification/mobilenet_v2/run.py -p fp32 -f pytorch --timeout=60 | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 IGNORE_DATASET_LIMITS=1 python3 computer_vision/classification/mobilenet_v2/run.py -p fp32 -f pytorch --timeout=60 | ||
|
|
||
| wget https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8l.pt > /dev/null 2>&1 | ||
| IGNORE_DATASET_LIMITS=1 AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 computer_vision/object_detection/yolo_v8/run.py -m yolov8l.pt -p fp32 -f pytorch | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 IGNORE_DATASET_LIMITS=1 AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 computer_vision/object_detection/yolo_v8/run.py -m yolov8l.pt -p fp32 -f pytorch | ||
|
|
||
| wget -O bert_large_mlperf.pt https://zenodo.org/records/3733896/files/model.pytorch?download=1 > /dev/null 2>&1 | ||
| AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 natural_language_processing/extractive_question_answering/bert_large/run_mlperf.py -m bert_large_mlperf.pt -p fp32 -f pytorch | ||
| OMP_NUM_THREADS=32 AIO_NUM_THREADS=32 AIO_IMPLICIT_FP16_TRANSFORM_FILTER=".*" python3 natural_language_processing/extractive_question_answering/bert_large/run_mlperf.py -m bert_large_mlperf.pt -p fp32 -f pytorch | ||
|
|
||
| test_tensorflow_arm64: | ||
| runs-on: self-hosted | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # Copyright (c) 2024, Ampere Computing LLC | ||
| # Copyright (c) 2025, Ampere Computing LLC | ||
| try: | ||
| from utils import misc # noqa | ||
| except ModuleNotFoundError: | ||
|
|
@@ -43,6 +43,10 @@ def parse_args(): | |
| parser.add_argument("--squad_path", | ||
| type=str, | ||
| help="path to directory with ImageNet validation images") | ||
| parser.add_argument("--fixed_input", action='store_true', | ||
| help="truncate input to fixed shape") | ||
| parser.add_argument("--input_size", type=int, default=384, | ||
|
||
| help='size of the input') | ||
| parser.add_argument("--disable_jit_freeze", action='store_true', | ||
| help="if true model will be run not in jit freeze mode") | ||
| return parser.parse_args() | ||
|
|
@@ -93,7 +97,8 @@ def run_tf_fp16(model_path, batch_size, num_runs, timeout, squad_path, **kwargs) | |
| return run_tf_fp(model_path, batch_size, num_runs, timeout, squad_path) | ||
|
|
||
|
|
||
| def run_pytorch_fp(model_path, batch_size, num_runs, timeout, squad_path, disable_jit_freeze=False): | ||
| def run_pytorch_fp(model_path, batch_size, num_runs, timeout, squad_path, | ||
| input_size, disable_jit_freeze=False, fixed_input=False): | ||
| from utils.benchmark import run_model | ||
| from utils.nlp.squad import Squad_v1_1 | ||
| from transformers import AutoTokenizer, BertConfig, BertForQuestionAnswering | ||
|
|
@@ -117,7 +122,11 @@ def run_single_pass(pytorch_runner, squad): | |
| padding=True, truncation=True, model_max_length=512) | ||
|
|
||
| def tokenize(question, text): | ||
| return tokenizer(question, text, padding=True, truncation=True, return_tensors="pt") | ||
| if fixed_input: | ||
| return tokenizer(question, text, padding="max_length", truncation=True, | ||
| max_length=input_size, return_tensors="pt") | ||
| else: | ||
| return tokenizer(question, text, padding=True, truncation=True, return_tensors="pt") | ||
|
|
||
| def detokenize(answer): | ||
| return tokenizer.convert_tokens_to_string(tokenizer.convert_ids_to_tokens(answer)) | ||
|
|
@@ -199,8 +208,10 @@ def detokenize(answer): | |
| return run_model(run_single_pass, runner, dataset, batch_size, num_runs, timeout) | ||
|
|
||
|
|
||
| def run_pytorch_fp32(model_path, batch_size, num_runs, timeout, squad_path, disable_jit_freeze, **kwargs): | ||
| return run_pytorch_fp(model_path, batch_size, num_runs, timeout, squad_path, disable_jit_freeze) | ||
| def run_pytorch_fp32(model_path, batch_size, num_runs, timeout, squad_path, | ||
| input_size, disable_jit_freeze, fixed_input, **kwargs): | ||
| return run_pytorch_fp(model_path, batch_size, num_runs, timeout, squad_path, | ||
| input_size, disable_jit_freeze, fixed_input) | ||
|
|
||
|
|
||
| def main(): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be handled by setup_deb.sh . One of the goals of this test to make sure all deps are installed by it, so if something is missing it should be added there.