Skip to content

Commit e5e9338

Browse files
committed
Address ruff violations in examples/.
1 parent c97b985 commit e5e9338

6 files changed

Lines changed: 5 additions & 7 deletions

File tree

ML-Frameworks/pytorch-aarch64/examples/executor/model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import os
99
import runpy
1010
import time
11-
import sys
1211
from urllib.parse import urlparse
1312
import warnings
1413
import zipfile

ML-Frameworks/pytorch-aarch64/examples/transformers_llm_text_gen.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ def eval_quantized_output(quantized_model, tokenizer, input_tensor, max_min_toke
158158

159159

160160
def main(args):
161-
name_string = f"{args.model}"
162-
quantized_model_, tokenizer_, config_ = get_quantized_model(args)
161+
quantized_model_, tokenizer_, _ = get_quantized_model(args)
163162
input_tensor = tokenizer_.encode(args.prompt, return_tensors="pt")
164163
eval_quantized_output(
165164
quantized_model_, tokenizer_, input_tensor, args.max_new_tokens

ML-Frameworks/pytorch-aarch64/examples/utils/image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ def _postprocess_image_for_openimages_detection(
247247

248248
# resizing the box values from the 800x800 image to the original
249249
# resolution.
250-
resize = lambda x, orig: int((x / 800) * orig)
250+
def resize(x, orig):
251+
return int((x / 800) * orig)
251252
left = resize(box[0], width)
252253
top = resize(box[1], height)
253254
right = resize(box[2], width)

ML-Frameworks/pytorch-aarch64/examples/utils/vision_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def parse_arguments():
6161
else:
6262
try:
6363
os.path.isfile(args["image"])
64-
except:
64+
except Exception as _:
6565
assert False, "Image not found"
6666

6767
return args

ML-Frameworks/tensorflow-aarch64/examples/executor/model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import zipfile
1414

1515
import numpy as np
16-
import yaml
1716
from tqdm import tqdm
1817

1918
import tensorflow as tf

ML-Frameworks/tensorflow-aarch64/examples/utils/vision_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def parse_arguments():
8989
else:
9090
try:
9191
os.path.isfile(args["image"])
92-
except:
92+
except Exception as _:
9393
assert False, "Image not found"
9494

9595
return args

0 commit comments

Comments
 (0)