Skip to content

Commit 1a5dbff

Browse files
authored
fix bug in onnxrt examples (#1188)
Signed-off-by: yuwenzho <[email protected]>
1 parent 3d11b5e commit 1a5dbff

File tree

7 files changed

+5
-9
lines changed

7 files changed

+5
-9
lines changed

examples/onnxrt/nlp/huggingface_model/language_modeling/quantization/ptq_static/main.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,7 @@ def main():
188188
parser.add_argument('-i', "--iter", default=0, type=int,
189189
help='For accuracy measurement only.')
190190
args = parser.parse_args()
191-
192-
device = torch.device("cuda" if torch.cuda.is_available() and not args.no_cuda else "cpu")
193-
args.device = device
191+
args.device = torch.device("cpu")
194192

195193
# Setup logging
196194
logging.basicConfig(format = '%(asctime)s - %(levelname)s - %(name)s - %(message)s',

examples/onnxrt/nlp/huggingface_model/question_answering/quantization/ptq_dynamic/main.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,6 @@ def main():
298298

299299
tokenizer = AutoTokenizer.from_pretrained(model_args.tokenizer_name or model_args.model_name_or_path)
300300

301-
training_args.do_eval = True
302-
training_args.do_predict = False
303-
304301
# Prepare the dataset downloading, preprocessing and metric creation to perform the evaluation step(s)
305302
# Get the datasets: you can either provide your own CSV/JSON/TXT training and evaluation files (see below)
306303
# or just provide the name of one of the public datasets available on the hub at

examples/onnxrt/nlp/huggingface_model/question_answering/quantization/ptq_dynamic/run_benchmark.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ function run_benchmark {
5151
--overwrite_output_dir \
5252
--dataset_name=squad \
5353
--batch_size=${batch_size} \
54+
--do_eval \
5455
--benchmark \
5556
${extra_cmd}
5657

examples/onnxrt/nlp/huggingface_model/question_answering/quantization/ptq_dynamic/run_quant.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function run_tuning {
5757
--model_name_or_path=${model_name_or_path} \
5858
--num_heads ${num_heads} \
5959
--hidden_size ${hidden_size} \
60+
--do_eval \
6061
--tune \
6162
${extra_cmd}
6263
}

examples/onnxrt/nlp/huggingface_model/question_answering/quantization/ptq_static/main.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,6 @@ def main():
301301

302302
tokenizer = AutoTokenizer.from_pretrained(model_args.tokenizer_name or model_args.model_name_or_path)
303303

304-
training_args.do_eval = True
305-
training_args.do_predict = False
306-
307304
# Prepare the dataset downloading, preprocessing and metric creation to perform the evaluation step(s)
308305
# Get the datasets: you can either provide your own CSV/JSON/TXT training and evaluation files (see below)
309306
# or just provide the name of one of the public datasets available on the hub at

examples/onnxrt/nlp/huggingface_model/question_answering/quantization/ptq_static/run_benchmark.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ function run_benchmark {
5151
--overwrite_output_dir \
5252
--dataset_name=squad \
5353
--batch_size=${batch_size} \
54+
--do_eval \
5455
--benchmark \
5556
${extra_cmd}
5657

examples/onnxrt/nlp/huggingface_model/question_answering/quantization/ptq_static/run_quant.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ function run_tuning {
6060
--model_name_or_path=${model_name_or_path} \
6161
--num_heads ${num_heads} \
6262
--hidden_size ${hidden_size} \
63+
--do_eval \
6364
--tune \
6465
${extra_cmd}
6566
}

0 commit comments

Comments
 (0)